From c7af939fa107460910992b4dc554dd6120e28dc8 Mon Sep 17 00:00:00 2001 From: Roie Gal Date: Sat, 14 Oct 2023 15:26:51 -0500 Subject: [PATCH] ctrl-f (#363) hehe @babusid --- Apps/Src/CommandLine.c | 2 +- BSP/STM32F413/Src/BSP_UART.c | 2 +- CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h | 2 +- Docs/source/Drivers/CANBus.rst | 4 ++-- Drivers/Inc/CANbus.h | 2 +- Drivers/Src/CANbus.c | 12 ++++++------ 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Apps/Src/CommandLine.c b/Apps/Src/CommandLine.c index 79b5f480..5307f463 100644 --- a/Apps/Src/CommandLine.c +++ b/Apps/Src/CommandLine.c @@ -196,7 +196,7 @@ static bool cmd_CANbus_Read(void){ } if(CANbus_Read(&msg, blocking, bus) == SUCCESS){ - printf("msg recieved on %s (%s)\n\r", busInput, blockInput); + printf("msg received on %s (%s)\n\r", busInput, blockInput); printf("ID: %d, Data: ", msg.ID); for(int i = 0; i < 8; i++){ printf("[%d] %x \n\r", i, msg.data[i]); diff --git a/BSP/STM32F413/Src/BSP_UART.c b/BSP/STM32F413/Src/BSP_UART.c index f63cf8f1..b7ed8742 100644 --- a/BSP/STM32F413/Src/BSP_UART.c +++ b/BSP/STM32F413/Src/BSP_UART.c @@ -168,7 +168,7 @@ uint32_t BSP_UART_Read(UART_t usart, char *str) { bool *line_recvd = lineRecvd[usart]; while(*line_recvd == false){ - BSP_UART_Write(usart, "", 0); // needs to be in. Otherwise, usbLineRecieved will not update + BSP_UART_Write(usart, "", 0); // needs to be in. Otherwise, usbLineReceived will not update } USART_TypeDef *usart_handle = handles[usart]; diff --git a/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h b/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h index bff94e0a..765c07de 100644 --- a/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h +++ b/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h @@ -11939,7 +11939,7 @@ typedef struct #define ETH_DMASR_RPS_Waiting ((uint32_t)0x00060000) /* Running - waiting for packet */ #define ETH_DMASR_RPS_Suspended ((uint32_t)0x00080000) /* Suspended - Rx Descriptor unavailable */ #define ETH_DMASR_RPS_Closing ((uint32_t)0x000A0000) /* Running - closing descriptor */ - #define ETH_DMASR_RPS_Queuing ((uint32_t)0x000E0000) /* Running - queuing the recieve frame into host memory */ + #define ETH_DMASR_RPS_Queuing ((uint32_t)0x000E0000) /* Running - queuing the receive frame into host memory */ #define ETH_DMASR_NIS ((uint32_t)0x00010000) /* Normal interrupt summary */ #define ETH_DMASR_AIS ((uint32_t)0x00008000) /* Abnormal interrupt summary */ #define ETH_DMASR_ERS ((uint32_t)0x00004000) /* Early receive status */ diff --git a/Docs/source/Drivers/CANBus.rst b/Docs/source/Drivers/CANBus.rst index 74a973a2..25df95ae 100644 --- a/Docs/source/Drivers/CANBus.rst +++ b/Docs/source/Drivers/CANBus.rst @@ -26,8 +26,8 @@ Implementation Details The microcontroller's CAN hardware block includes three sending and three receiving mailboxes, which act as a small queue of CAN messages. The driver will write directly to the write mailboxes as long as they aren't full, and will block otherwise. -The receive mailboxes are constantly emptied (by the CAN recieve interrupt) -into a software queue in the BSP layer in order to deepen the queue (we recieve a lot of messages). +The receive mailboxes are constantly emptied (by the CAN receive interrupt) +into a software queue in the BSP layer in order to deepen the queue (we receive a lot of messages). When reading, the driver will read directly from a software queue in the BSP layer. A non-blocking read will return an error if the queue is empty. A blocking read will block on a driver-layer semaphore, to be woken up when data is avilable. Everytime the BSP software queue is posted to, a receive interrupt signals to a driver-layer semaphore that a message has been received. This allows any waiting tasks to wake up and read the message. This is done since tasks that read and write CAN messages don't usually have anything else to do while waiting, which makes blocking fairly efficient. diff --git a/Drivers/Inc/CANbus.h b/Drivers/Inc/CANbus.h index 33e8fc0e..93eb6615 100644 --- a/Drivers/Inc/CANbus.h +++ b/Drivers/Inc/CANbus.h @@ -106,7 +106,7 @@ ErrorStatus CANbus_Send(CANDATA_t CanData,bool blocking, CAN_t bus); /** * @brief Reads a CAN message from the CAN hardware and returns it to the provided pointers. - * @param data pointer to where to store the CAN id of the recieved msg + * @param data pointer to where to store the CAN id of the received msg * @param blocking Whether or not this read should be a blocking read * @param bus The bus to use. This should either be CARCAN or MOTORCAN. * @returns ERROR if read failed, SUCCESS otherwise diff --git a/Drivers/Src/CANbus.c b/Drivers/Src/CANbus.c index c199747c..efaec242 100755 --- a/Drivers/Src/CANbus.c +++ b/Drivers/Src/CANbus.c @@ -11,20 +11,20 @@ #include "CANConfig.h" static OS_SEM CANMail_Sem4[NUM_CAN]; // sem4 to count how many sending hardware mailboxes we have left (start at 3) -static OS_SEM CANBus_RecieveSem4[NUM_CAN]; // sem4 to count how many msgs in our recieving queue +static OS_SEM CANBus_ReceiveSem4[NUM_CAN]; // sem4 to count how many msgs in our recieving queue static OS_MUTEX CANbus_TxMutex[NUM_CAN]; // mutex to lock tx line static OS_MUTEX CANbus_RxMutex[NUM_CAN]; // mutex to lock Rx line /** - * @brief this function will be passed down to the BSP layer to trigger on RX events. Increments the recieve semaphore to signal message in hardware mailbox. Do not access directly outside this driver. + * @brief this function will be passed down to the BSP layer to trigger on RX events. Increments the receive semaphore to signal message in hardware mailbox. Do not access directly outside this driver. * @param bus The CAN bus to operate on. Should be CARCAN or MOTORCAN. */ void CANbus_RxHandler(CAN_t bus) { OS_ERR err; - OSSemPost(&(CANBus_RecieveSem4[bus]), OS_OPT_POST_1, &err); // increment our queue counter + OSSemPost(&(CANBus_ReceiveSem4[bus]), OS_OPT_POST_1, &err); // increment our queue counter assertOSError(OS_CANDRIVER_LOC,err); } @@ -95,7 +95,7 @@ ErrorStatus CANbus_Init(CAN_t bus, CANId_t* idWhitelist, uint8_t idWhitelistSize OSSemCreate(&(CANMail_Sem4[bus]), (bus == CAN_1 ? "CAN Mailbox Semaphore 1":"CAN Mailbox Semaphore 3"), 3, &err); // there's 3 hardware mailboxes on the board, so 3 software mailboxes assertOSError(OS_CANDRIVER_LOC,err); - OSSemCreate(&(CANBus_RecieveSem4[bus]), (bus == CAN_1 ? "CAN Recieved Msg Queue Ctr 1":"CAN Recieved Msg Queue Ctr 3"), 0, &err); // create a mailbox counter to hold the messages in as they come in + OSSemCreate(&(CANBus_ReceiveSem4[bus]), (bus == CAN_1 ? "CAN Received Msg Queue Ctr 1":"CAN Received Msg Queue Ctr 3"), 0, &err); // create a mailbox counter to hold the messages in as they come in assertOSError(OS_CANDRIVER_LOC,err); return SUCCESS; @@ -188,7 +188,7 @@ ErrorStatus CANbus_Read(CANDATA_t* MsgContainer, bool blocking, CAN_t bus) if (blocking == CAN_BLOCKING) { OSSemPend( // check if the queue actually has anything - &(CANBus_RecieveSem4[bus]), + &(CANBus_ReceiveSem4[bus]), 0, OS_OPT_PEND_BLOCKING, ×tamp, @@ -197,7 +197,7 @@ ErrorStatus CANbus_Read(CANDATA_t* MsgContainer, bool blocking, CAN_t bus) else { OSSemPend( - &(CANBus_RecieveSem4[bus]), + &(CANBus_ReceiveSem4[bus]), 0, OS_OPT_PEND_NON_BLOCKING, ×tamp,