@ -57,23 +57,43 @@
/* USER CODE END Includes */
/* USER CODE END Includes */
/* Variables -----------------------------------------------------------------*/
/* Variables -----------------------------------------------------------------*/
# define STACK_MAIN 160
# define STACK_MSG 170
# define STACK_LP 128
# define STACK_HP 128
osThreadId tskMainHandle ;
osThreadId tskMainHandle ;
uint32_t mainTaskBuffer [ 160 ] ;
uint32_t mainTaskBuffer [ STACK_MAIN ] ;
osStaticThreadDef_t mainTaskControlBlock ;
osStaticThreadDef_t mainTaskControlBlock ;
osThreadId tskMsgHandle ;
uint32_t msgTaskBuffer [ STACK_MSG ] ;
osStaticThreadDef_t msgTaskControlBlock ;
osThreadId tskSchedLPHandle ;
osThreadId tskSchedLPHandle ;
uint32_t schedLowBuffer [ 128 ] ;
uint32_t schedLowBuffer [ STACK_LP ] ;
osStaticThreadDef_t schedLowControlBlock ;
osStaticThreadDef_t schedLowControlBlock ;
osThreadId tskSchedHPHandle ;
osThreadId tskSchedHPHandle ;
uint32_t schedHighBuffer [ 128 ] ;
uint32_t schedHighBuffer [ STACK_HP ] ;
osStaticThreadDef_t schedHighControlBlock ;
osStaticThreadDef_t schedHighControlBlock ;
osMessageQId queSchedLPHandle ;
osMessageQId queSchedLPHandle ;
uint8_t myQueue01Buffer [ 5 * sizeof ( struct sched_que_item ) ] ;
uint8_t myQueue01Buffer [ LP_SCHED_CAPACITY * sizeof ( struct sched_que_item ) ] ;
osStaticMessageQDef_t myQueue01ControlBlock ;
osStaticMessageQDef_t myQueue01ControlBlock ;
osMessageQId queSchedHPHandle ;
osMessageQId queSchedHPHandle ;
uint8_t myQueue02Buffer [ 5 * sizeof ( struct sched_que_item ) ] ;
uint8_t myQueue02Buffer [ HP_SCHED_CAPACITY * sizeof ( struct sched_que_item ) ] ;
osStaticMessageQDef_t myQueue02ControlBlock ;
osStaticMessageQDef_t myQueue02ControlBlock ;
osMessageQId queRxDataHandle ;
uint8_t myQueue03Buffer [ RX_QUE_CAPACITY * sizeof ( struct rx_que_item ) ] ;
osStaticMessageQDef_t myQueue03ControlBlock ;
osMutexId mutTinyFrameTxHandle ;
osMutexId mutTinyFrameTxHandle ;
osStaticMutexDef_t myMutex01ControlBlock ;
osStaticMutexDef_t myMutex01ControlBlock ;
osSemaphoreId semVcomTxReadyHandle ;
osSemaphoreId semVcomTxReadyHandle ;
osStaticSemaphoreDef_t myBinarySem01ControlBlock ;
osStaticSemaphoreDef_t myBinarySem01ControlBlock ;
@ -85,6 +105,7 @@ osStaticSemaphoreDef_t myBinarySem01ControlBlock;
void TaskMain ( void const * argument ) ;
void TaskMain ( void const * argument ) ;
extern void TaskSchedLP ( void const * argument ) ;
extern void TaskSchedLP ( void const * argument ) ;
extern void TaskSchedHP ( void const * argument ) ;
extern void TaskSchedHP ( void const * argument ) ;
extern void TaskMessaging ( void const * argument ) ;
void MX_FREERTOS_Init ( void ) ; /* (MISRA C 2004 rule 8.1) */
void MX_FREERTOS_Init ( void ) ; /* (MISRA C 2004 rule 8.1) */
@ -127,6 +148,7 @@ void MX_FREERTOS_Init(void) {
stackmon_register ( " Main " , mainTaskBuffer , sizeof ( mainTaskBuffer ) ) ;
stackmon_register ( " Main " , mainTaskBuffer , sizeof ( mainTaskBuffer ) ) ;
stackmon_register ( " Job Queue Low " , schedLowBuffer , sizeof ( schedLowBuffer ) ) ;
stackmon_register ( " Job Queue Low " , schedLowBuffer , sizeof ( schedLowBuffer ) ) ;
stackmon_register ( " Job Queue High " , schedHighBuffer , sizeof ( schedHighBuffer ) ) ;
stackmon_register ( " Job Queue High " , schedHighBuffer , sizeof ( schedHighBuffer ) ) ;
stackmon_register ( " Messaging " , msgTaskBuffer , sizeof ( msgTaskBuffer ) ) ;
/* USER CODE END Init */
/* USER CODE END Init */
/* Create the mutex(es) */
/* Create the mutex(es) */
@ -154,30 +176,38 @@ void MX_FREERTOS_Init(void) {
/* Create the thread(s) */
/* Create the thread(s) */
/* definition and creation of tskMain */
/* definition and creation of tskMain */
osThreadStaticDef ( tskMain , TaskMain , osPriorityHigh , 0 , 160 , mainTaskBuffer , & mainTaskControlBlock ) ;
osThreadStaticDef ( tskMain , TaskMain , osPriorityHigh , 0 , STACK_MAIN , mainTaskBuffer , & mainTaskControlBlock ) ;
tskMainHandle = osThreadCreate ( osThread ( tskMain ) , NULL ) ;
tskMainHandle = osThreadCreate ( osThread ( tskMain ) , NULL ) ;
/* definition and creation of tskSchedLP */
/* definition and creation of tskSchedLP */
osThreadStaticDef ( tskSchedLP , TaskSchedLP , osPriorityLow , 0 , 128 , schedLowBuffer , & schedLowControlBlock ) ;
osThreadStaticDef ( tskSchedLP , TaskSchedLP , osPriorityLow , 0 , STACK_LP , schedLowBuffer , & schedLowControlBlock ) ;
tskSchedLPHandle = osThreadCreate ( osThread ( tskSchedLP ) , NULL ) ;
tskSchedLPHandle = osThreadCreate ( osThread ( tskSchedLP ) , NULL ) ;
/* definition and creation of tskSchedHP */
/* definition and creation of tskSchedHP */
osThreadStaticDef ( tskSchedHP , TaskSchedHP , osPriorityAboveNormal , 0 , 128 , schedHighBuffer , & schedHighControlBlock ) ;
osThreadStaticDef ( tskSchedHP , TaskSchedHP , osPriorityAboveNormal , 0 , STACK_HP , schedHighBuffer , & schedHighControlBlock ) ;
tskSchedHPHandle = osThreadCreate ( osThread ( tskSchedHP ) , NULL ) ;
tskSchedHPHandle = osThreadCreate ( osThread ( tskSchedHP ) , NULL ) ;
/* definition and creation of TaskMessaging */
osThreadStaticDef ( tskMsg , TaskMessaging , osPriorityNormal , 0 , STACK_MSG , msgTaskBuffer , & msgTaskControlBlock ) ;
tskMsgHandle = osThreadCreate ( osThread ( tskMsg ) , NULL ) ;
/* USER CODE BEGIN RTOS_THREADS */
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE END RTOS_THREADS */
/* Create the queue(s) */
/* Create the queue(s) */
/* definition and creation of queSchedLP */
/* definition and creation of queSchedLP */
osMessageQStaticDef ( queSchedLP , 5 , struct sched_que_item , myQueue01Buffer , & myQueue01ControlBlock ) ;
osMessageQStaticDef ( queSchedLP , LP_SCHED_CAPACITY , struct sched_que_item , myQueue01Buffer , & myQueue01ControlBlock ) ;
queSchedLPHandle = osMessageCreate ( osMessageQ ( queSchedLP ) , NULL ) ;
queSchedLPHandle = osMessageCreate ( osMessageQ ( queSchedLP ) , NULL ) ;
/* definition and creation of queSchedHP */
/* definition and creation of queSchedHP */
osMessageQStaticDef ( queSchedHP , 5 , struct sched_que_item , myQueue02Buffer , & myQueue02ControlBlock ) ;
osMessageQStaticDef ( queSchedHP , HP_SCHED_CAPACITY , struct sched_que_item , myQueue02Buffer , & myQueue02ControlBlock ) ;
queSchedHPHandle = osMessageCreate ( osMessageQ ( queSchedHP ) , NULL ) ;
queSchedHPHandle = osMessageCreate ( osMessageQ ( queSchedHP ) , NULL ) ;
/* definition and creation of queRxData */
osMessageQStaticDef ( queRxData , RX_QUE_CAPACITY , struct rx_que_item , myQueue03Buffer , & myQueue03ControlBlock ) ;
queRxDataHandle = osMessageCreate ( osMessageQ ( queRxData ) , NULL ) ;
/* USER CODE BEGIN RTOS_QUEUES */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* USER CODE END RTOS_QUEUES */