diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_polycopter.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_polycopter.c index a713ae80..3ca33f5a 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_polycopter.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_polycopter.c @@ -236,7 +236,8 @@ static void prv_SignalGatherFinishedTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -269,7 +270,8 @@ static void prv_SignalGatherTimeoutTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -305,7 +307,8 @@ static void prv_SignalProcessingActuateTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -324,7 +327,8 @@ static void prv_SignalProcessingAttitudeTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -372,7 +376,8 @@ static void prv_FlightControlAttitudeTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -391,7 +396,8 @@ static void prv_FlightControlActuateTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -410,7 +416,8 @@ static void prv_MavlinkSendTask(void *pvParameters) { trigger_job_done(); do { RNG_RESET - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); x = STRETCH_i32(inp); @@ -448,10 +455,12 @@ static void prv_CopterControlTask(void *pvParameters) { do { RNG_RESET #ifndef IGNORE_INTERRUPTS - unsigned long int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); #else xTaskDelayUntil( &xLastWakeTime, xFrequency ); - unsigned long int y = ulTaskNotifyTake(pdTRUE, 0); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); #endif STATE_PLUS_DATA(y) // introduce a data dependency inp = INPUT_SHORT_NEXT * CLAMP(y, 1, 3); @@ -493,13 +502,15 @@ void ISR_0_Handler(void) { x = TRANSLATE_9(x, 15, 50); x = WC_SWITCH(x, 50); WASTE_USEC(x); - xTaskNotifyFromISR(xTask_CopterControlTask, MAKE_OUTPUT, eNoAction, NULL); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + vTaskNotifyFromISR(xTask_CopterControlTask, MAKE_OUTPUT, eSetValueWithOverwrite, &xHigherPriorityTaskWoken); inp = INPUT_SHORT_NEXT; x = STRETCH_i32(inp); x = FUNCTION_10(x); x = TRANSLATE_10(x, 15, 50); x = WC_SWITCH(x, 50); WASTE_USEC(x); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_release.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_release.c index 4d7dd86b..6a9eabba 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_release.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_release.c @@ -164,7 +164,7 @@ static void prvTask1( void * pvParameters ) { // Actions -------------------------------------- volatile uint16_t x = INPUT_SHORT_NEXT; WCET_CLAMP(x, 5000, 7200, TASK_1_MESSAGE) - xTaskNotify(xTask2, DEBUG_VAL(x % 2 + 1, 1), eSetValueWithOverwrite); + xTaskNotify(xTask2, DEBUG_VAL(x % 2, 0), eSetValueWithOverwrite); // --------------------------------------------- trigger_job_done(); // trigger_Qemu_break(); @@ -186,7 +186,8 @@ static void prvTask2( void * pvParameters ) { torun += 1000; } WCET_CLAMP(torun, 1000, 2000, "") - int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); xSemaphoreGive(xMutex); // --------------------------------------------- trigger_job_done(); @@ -201,9 +202,11 @@ static void prvTask3( void * pvParameters ) { for( ;; ){ #ifdef IGNORE_INTERRUPTS xTaskDelayUntil( &xLastWakeTime, xFrequency ); // periodic - int y = ulTaskNotifyTake(pdTRUE, 0)-1; + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); #else - int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY)-1; // sporadic + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); // sporadic #endif RNG_RESET // Actions -------------------------------------- @@ -211,7 +214,7 @@ static void prvTask3( void * pvParameters ) { xSemaphoreTake(xMutex, portMAX_DELAY); // wost time: right after T2 locks the mutex volatile uint16_t x = INPUT_SHORT_NEXT; int torun = 0; - if (y>0) { + if ((int)y>=0) { torun = CLAMP(x, 0, 5000); } else { torun = CLAMP(x, 1000, 4000); @@ -248,7 +251,8 @@ static void prvTask5( void * pvParameters ) { xTaskDelayUntil( &xLastWakeTime, xFrequency ); // periodic // int y = ulTaskNotifyTake(pdTRUE, 0); #else - int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY)-1; // sporadic + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,portMAX_DELAY); // sporadic #endif RNG_RESET // Actions -------------------------------------- @@ -278,8 +282,9 @@ void ISR_0_Handler( void ) puts("Interrupt"); if (xTask3) { volatile uint16_t x = INPUT_SHORT_NEXT; - BaseType_t _tmp = 0; - xTaskNotifyFromISR(xTask3, DEBUG_VAL((x%10) == 0 + 1, 2), eSetValueWithOverwrite, &_tmp); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xTaskNotifyFromISR(xTask3, DEBUG_VAL((x%10) == 0, 1), eSetValueWithOverwrite, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } @@ -287,8 +292,9 @@ void ISR_1_Handler( void ) { puts("Interrupt"); if (xTask5) { - BaseType_t _tmp = 0; - xTaskNotifyFromISR(xTask5, 1, eSetValueWithOverwrite, &_tmp); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xTaskNotifyFromISR(xTask5, 1, eSetValueWithOverwrite, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_waters.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_waters.c index 8dab3648..771d2c9b 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_waters.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_waters.c @@ -273,16 +273,17 @@ static void prvTaskC22( void * pvParameters ) { // Output: g(x,y) = y * (x % 4) // WC Input: x = 2, y = 1 uint16_t x = INPUT_SHORT_NEXT; - int y = ulTaskNotifyTake(pdTRUE, 0); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); volatile int torun = 6035; - if (y > 0) { + if ((int)y > 0) { torun += 20000; } if (DEBUG_VAL(((x % 100) <= 5)*(x!=0), 1)) { torun += 50000; } WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, 76035*LOCAL_WCET_MULT, TASK_78_MESSAGE) - xTaskNotify(xTaskC23, DEBUG_VAL(y * (x % 4), 2), eSetValueWithOverwrite); + xTaskNotify(xTaskC23, DEBUG_VAL((int)y * (x % 4), 2), eSetValueWithOverwrite); // --------------------------------------------- trigger_job_done(); xTaskDelayUntil( &xLastWakeTime, xFrequency );} @@ -299,7 +300,8 @@ static void prvTaskC23( void * pvParameters ) { // Exectime: f(x,y) = rng(x)*y*c or (rng(x) % 1000) // WC Input: x = 2214, y = 2 uint32_t x = INPUT_LONG_NEXT; - int y = ulTaskNotifyTake(pdTRUE, 0); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); volatile int torun = 0; if (y == 2 && DEBUG_VAL(((x%100) <= 25), 1)) { torun = 1766; @@ -353,7 +355,8 @@ static void prvTaskC32( void * pvParameters ) { // Exectime: f(x) = c + 100*x // Output: g(x) = x % 4 // WC Input: x = 204 (local), y = 1 - int y = ulTaskNotifyTake(pdTRUE, 0); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); volatile uint16_t x = INPUT_CHAR_NEXT; x *= 100; int torun = 0; @@ -380,8 +383,9 @@ static void prvTaskC33( void * pvParameters ) { // Exectime: f(x) = c - x*y // WC Input: x = 0 | y = 0 volatile uint16_t x = INPUT_SHORT_NEXT; - int y = ulTaskNotifyTake(pdTRUE, 0); - int torun = 76865-((int)x)*y; + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,0); + int torun = 76865-((int)x)*(int)y; WCET_CLAMP(torun*LOCAL_WCET_MULT, 10000, 76865*LOCAL_WCET_MULT, TASK_1107_MESSAGE) // --------------------------------------------- trigger_job_done(); @@ -404,7 +408,7 @@ static void prvTaskC11( void * pvParameters ) { // Output: g(x) = x % 8 // WC Input: x = 629760 uint32_t x = INPUT_LONG_NEXT; - xTaskNotify(xTaskC12, DEBUG_VAL(x % 8 + 1, 1), eSetValueWithOverwrite); + xTaskNotify(xTaskC12, DEBUG_VAL(x % 8, 0), eSetValueWithOverwrite); volatile int torun = (x>>8) & 0x0fff; WCET_CLAMP(torun*LOCAL_WCET_MULT, 500*LOCAL_WCET_MULT, 2460*LOCAL_WCET_MULT, TASK_579_MESSAGE) // --------------------------------------------- @@ -424,8 +428,9 @@ static void prvTaskC12( void * pvParameters ) { // Output: g(x) = x % 8 == y // WC Input: x = 12000, y = 0 uint16_t x = INPUT_SHORT_NEXT; - int y = ulTaskNotifyTake(pdTRUE, NOTIFY_WAIT_TIME)-1; - xTaskNotify(xTaskC13, DEBUG_VAL((x % 8 == y) + 1, 2), eSetValueWithOverwrite); + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,NOTIFY_WAIT_TIME); + xTaskNotify(xTaskC13, DEBUG_VAL((x % 8 == y), 1), eSetValueWithOverwrite); volatile int torun = 0; if (x % 8 == y) { torun = 40000 + x; @@ -456,9 +461,10 @@ static void prvTaskC13( void * pvParameters ) { // WC Input: x = 65535 , y = 1 for "short" run // globally, short runs consume more time in subsequent jobs volatile uint32_t x = INPUT_SHORT_NEXT; - int y = ulTaskNotifyTake(pdTRUE, NOTIFY_WAIT_TIME)-1; + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,NOTIFY_WAIT_TIME); volatile int do_short_run = (y + ((x%100)<=5)) == 1; // XOR - xTaskNotify(xTaskC14, DEBUG_VAL(do_short_run+1, 2), eSetValueWithOverwrite); + xTaskNotify(xTaskC14, DEBUG_VAL(do_short_run, 1), eSetValueWithOverwrite); int torun = 0; if (do_short_run > 0) { torun = 40000 + x; @@ -487,7 +493,8 @@ static void prvTaskC14( void * pvParameters ) { // Exectime: f(x,y) = if y ? c1+2*x : c2-x // longmax - shortmax: 76955 volatile uint32_t x = INPUT_SHORT_NEXT; - int y = ulTaskNotifyTake(pdTRUE, NOTIFY_WAIT_TIME)-1; + unsigned long int y = 0; + xTaskNotifyWait(0,ULONG_MAX,&y,NOTIFY_WAIT_TIME); volatile int torun = 0; if (y) { torun = x*3; @@ -510,8 +517,9 @@ void ISR_0_Handler( void ) { puts("Interrupt"); if (xTaskC31) { - BaseType_t _tmp = 0; - xTaskNotifyFromISR(xTaskC31, 1, eSetValueWithOverwrite, &_tmp); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + vTaskNotifyGiveFromISR(xTaskC31, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_watersgen1.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_watersgen1.c index cb538009..56e19b51 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_watersgen1.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_watersgen1.c @@ -194,7 +194,6 @@ static void task_0_fn(void *pvParameters) { uint8_t chaininp = 0; uint16_t byteinp = 0; volatile int tmp=0; - trigger_job_done(); while(1) { RNG_RESET @@ -222,11 +221,16 @@ static void task_1_fn(void *pvParameters) { while(1) { ulTaskNotifyTakeIndexed(9,pdTRUE,portMAX_DELAY); RNG_RESET - int input_c27 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c32 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c34 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c42 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); + uint32_t input_c27=0; + uint32_t input_c32=0; + uint32_t input_c34=0; + uint32_t input_c42=0; + uint32_t input_c44=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c27,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c32,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c34,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c42,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c44,0); int32_t cond_27 = RNG_FROM(input_c27) % 16>=(INPUT_CHAR_NEXT % 16 ) || ! (input_c42!=(INPUT_CHAR_NEXT % 16 )) && ! (input_c27<=(INPUT_CHAR_NEXT % 16 )); int32_t cond_32 = input_c32==4; @@ -246,10 +250,10 @@ static void task_1_fn(void *pvParameters) { int output_c32 = (cond_27 | cond_34<<1 | cond_42<<2 || cond_32<<3); int output_c34 = (cond_44 | cond_27<<1 | cond_27<<2 || cond_44<<3); int output_c44 = (cond_42 | cond_27<<1 | cond_44<<2 || cond_27<<3); - xTaskNotifyIndexed(xTask_7_Handle,0,output_c13+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_6_Handle,1,output_c32+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_7_Handle,2,output_c34+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_6_Handle,4,output_c44+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_7_Handle,0,output_c13,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_6_Handle,1,output_c32,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_7_Handle,2,output_c34,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_6_Handle,4,output_c44,eSetValueWithOverwrite); trigger_job_done(); // xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -265,11 +269,16 @@ static void task_2_fn(void *pvParameters) { while(1) { ulTaskNotifyTakeIndexed(9,pdTRUE,portMAX_DELAY); RNG_RESET - int input_c20 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c22 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c27 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c34 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c42 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); + uint32_t input_c20=0; + uint32_t input_c22=0; + uint32_t input_c27=0; + uint32_t input_c34=0; + uint32_t input_c42=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c20,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c22,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c27,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c34,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c42,0); int32_t cond_20 = RNG_FROM(input_c20) % 16!=(INPUT_CHAR_NEXT % 16 ); int32_t cond_22 = input_c22<8 || (input_c34!=10) || ! (input_c20>14); @@ -289,10 +298,10 @@ static void task_2_fn(void *pvParameters) { int output_c22 = (cond_22 | cond_20<<1 | cond_27<<2 || cond_22<<3); int output_c27 = (cond_20 | cond_42<<1 | cond_42<<2 || cond_42<<3); int output_c42 = (cond_34 | cond_22<<1 | cond_20<<2 || cond_42<<3); - xTaskNotifyIndexed(xTask_5_Handle,0,output_c20+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_7_Handle,1,output_c22+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_1_Handle,0,output_c27+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_1_Handle,3,output_c42+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_5_Handle,0,output_c20,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_7_Handle,1,output_c22,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_1_Handle,0,output_c27,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_1_Handle,3,output_c42,eSetValueWithOverwrite); trigger_job_done(); // xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -320,8 +329,8 @@ static void task_3_fn(void *pvParameters) { int output_c7 = (INPUT_CHAR_NEXT % 16); int output_c34 = (INPUT_CHAR_NEXT % 16); - xTaskNotifyIndexed(xTask_4_Handle,1,output_c7+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_1_Handle,2,output_c34+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_4_Handle,1,output_c7,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_1_Handle,2,output_c34,eSetValueWithOverwrite); trigger_job_done(); // xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -335,9 +344,12 @@ static void task_4_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c1 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c7 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c27 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c1=0; + uint32_t input_c7=0; + uint32_t input_c27=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c1,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c7,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c27,0); int32_t cond_1 = input_c1<=16 || ! (input_c7>(INPUT_CHAR_NEXT % 16 )); int32_t cond_7 = input_c7=(INPUT_CHAR_NEXT % 16 ) || ! (input_c50<=input_c20); int32_t cond_50 = input_c50!=input_c20 || ! (input_c20>=input_c50); @@ -397,12 +411,18 @@ static void task_6_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c13 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c32 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c34 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c42 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); - int input_c50 = ulTaskNotifyTakeIndexed(5,pdTRUE,0); + uint32_t input_c13=0; + uint32_t input_c32=0; + uint32_t input_c34=0; + uint32_t input_c42=0; + uint32_t input_c44=0; + uint32_t input_c50=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c13,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c32,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c34,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c42,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c44,0); + xTaskNotifyWaitIndexed(5,0,ULONG_MAX,&input_c50,0); int32_t cond_13 = input_c13=4; @@ -424,11 +444,11 @@ static void task_6_fn(void *pvParameters) { int output_c42 = (cond_32 | cond_34<<1 | cond_44<<2 || cond_34<<3); int output_c44 = (cond_50 | cond_42<<1 | cond_32<<2 || cond_13<<3); int output_c50 = (cond_34 | cond_50<<1 | cond_13<<2 || cond_13<<3); - xTaskNotifyIndexed(xTask_4_Handle,2,output_c27+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_2_Handle,3,output_c34+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_19_Handle,1,output_c42+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_24_Handle,3,output_c44+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_5_Handle,1,output_c50+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_4_Handle,2,output_c27,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_2_Handle,3,output_c34,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_19_Handle,1,output_c42,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_24_Handle,3,output_c44,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_5_Handle,1,output_c50,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -442,9 +462,12 @@ static void task_7_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c13 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c22 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c34 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c13=0; + uint32_t input_c22=0; + uint32_t input_c34=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c13,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c22,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c34,0); int32_t cond_13 = input_c13>=(INPUT_CHAR_NEXT % 16 ) || ! (input_c13<3) && (input_c34>(INPUT_CHAR_NEXT % 16 )); int32_t cond_22 = input_c22>=9 && (input_c13<=9) && ! (input_c22>(INPUT_CHAR_NEXT % 16 )); @@ -463,11 +486,11 @@ static void task_7_fn(void *pvParameters) { int output_c22 = (cond_13 | cond_13<<1 | cond_13<<2 || cond_22<<3); int output_c32 = (cond_34 | cond_13<<1 | cond_34<<2 || cond_22<<3); int output_c34 = (cond_22 | cond_13<<1 | cond_22<<2 || cond_13<<3); - xTaskNotifyIndexed(xTask_4_Handle,0,output_c1+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_6_Handle,0,output_c13+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_21_Handle,0,output_c22+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_1_Handle,1,output_c32+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_6_Handle,2,output_c34+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_4_Handle,0,output_c1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_6_Handle,0,output_c13,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_21_Handle,0,output_c22,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_1_Handle,1,output_c32,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_6_Handle,2,output_c34,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -483,8 +506,10 @@ static void task_8_fn(void *pvParameters) { while(1) { ulTaskNotifyTakeIndexed(9,pdTRUE,portMAX_DELAY); RNG_RESET - int input_c15 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); + uint32_t input_c15=0; + uint32_t input_c44=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c15,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c44,0); int32_t cond_15 = input_c15<0; int32_t cond_44 = input_c44<=(INPUT_CHAR_NEXT % 16 ) && (input_c44==15); @@ -499,8 +524,8 @@ static void task_8_fn(void *pvParameters) { int output_c39 = (cond_44 | cond_44<<1 | cond_44<<2 || cond_15<<3); int output_c41 = (cond_15 | cond_15<<1 | cond_44<<2 || cond_15<<3); - xTaskNotifyIndexed(xTask_11_Handle,3,output_c39+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_10_Handle,1,output_c41+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_11_Handle,3,output_c39,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_10_Handle,1,output_c41,eSetValueWithOverwrite); trigger_job_done(); // xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -514,9 +539,12 @@ static void task_9_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c39 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c41 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c47 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c39=0; + uint32_t input_c41=0; + uint32_t input_c47=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c39,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c41,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c47,0); int32_t cond_39 = input_c39<=10 && ! (input_c39>(INPUT_CHAR_NEXT % 16 )); int32_t cond_41 = input_c4110 && (input_c41!=(INPUT_CHAR_NEXT % 16 )); @@ -571,10 +602,10 @@ static void task_10_fn(void *pvParameters) { int output_c33 = (cond_44 | cond_44<<1 | cond_15<<2 || cond_15<<3); int output_c41 = (cond_15 | cond_41<<1 | cond_41<<2 || cond_44<<3); int output_c44 = (cond_15 | cond_41<<1 | cond_44<<2 || cond_44<<3); - xTaskNotifyIndexed(xTask_8_Handle,0,output_c15+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_13_Handle,0,output_c33+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_11_Handle,4,output_c41+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_17_Handle,0,output_c44+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_8_Handle,0,output_c15,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_13_Handle,0,output_c33,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_11_Handle,4,output_c41,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_17_Handle,0,output_c44,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -588,11 +619,16 @@ static void task_11_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c5 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c12 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c33 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c39 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c41 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); + uint32_t input_c5=0; + uint32_t input_c12=0; + uint32_t input_c33=0; + uint32_t input_c39=0; + uint32_t input_c41=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c5,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c12,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c33,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c39,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c41,0); int32_t cond_5 = input_c5<(INPUT_CHAR_NEXT % 16 ) || (input_c12<(INPUT_CHAR_NEXT % 16 )) && ! (input_c33==input_c5) && (RNG_FROM(input_c5) % 16!=1); int32_t cond_12 = input_c12<=8 && ! (input_c12=input_c18 || ! (input_c47<=(INPUT_CHAR_NEXT % 16 )) && (input_c47>(INPUT_CHAR_NEXT % 16 )); int32_t cond_18 = input_c18==2; @@ -648,9 +687,9 @@ static void task_12_fn(void *pvParameters) { int output_c5 = (cond_5 | cond_18<<1 | cond_18<<2 || cond_5<<3); int output_c18 = (cond_47 | cond_5<<1 | cond_5<<2 || cond_47<<3); int output_c47 = (cond_47 | cond_47<<1 | cond_18<<2 || cond_18<<3); - xTaskNotifyIndexed(xTask_11_Handle,0,output_c5+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_15_Handle,3,output_c18+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_24_Handle,4,output_c47+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_11_Handle,0,output_c5,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_15_Handle,3,output_c18,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_24_Handle,4,output_c47,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -664,8 +703,10 @@ static void task_13_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c33 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); + uint32_t input_c33=0; + uint32_t input_c44=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c33,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c44,0); int32_t cond_33 = input_c33!=6; int32_t cond_44 = RNG_FROM(input_c44) % 16>(INPUT_CHAR_NEXT % 16 ) && ! (input_c44<=4); @@ -681,9 +722,9 @@ static void task_13_fn(void *pvParameters) { int output_c12 = (cond_44 | cond_33<<1 | cond_33<<2 || cond_44<<3); int output_c33 = (cond_44 | cond_33<<1 | cond_44<<2 || cond_44<<3); int output_c44 = (cond_44 | cond_44<<1 | cond_44<<2 || cond_44<<3); - xTaskNotifyIndexed(xTask_15_Handle,2,output_c12+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_11_Handle,2,output_c33+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_10_Handle,2,output_c44+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_15_Handle,2,output_c12,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_11_Handle,2,output_c33,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_10_Handle,2,output_c44,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -697,7 +738,8 @@ static void task_14_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c39 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); + uint32_t input_c39=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c39,0); int32_t cond_39 = input_c39==9; @@ -712,9 +754,9 @@ static void task_14_fn(void *pvParameters) { int output_c15 = (cond_39 | cond_39<<1 | cond_39<<2 || cond_39<<3); int output_c18 = (cond_39 | cond_39<<1 | cond_39<<2 || cond_39<<3); int output_c47 = (cond_39 | cond_39<<1 | cond_39<<2 || cond_39<<3); - xTaskNotifyIndexed(xTask_24_Handle,0,output_c15+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_12_Handle,1,output_c18+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_9_Handle,2,output_c47+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_24_Handle,0,output_c15,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_12_Handle,1,output_c18,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_9_Handle,2,output_c47,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -728,12 +770,18 @@ static void task_15_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c5 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c11 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c12 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c18 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c39 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); - int input_c41 = ulTaskNotifyTakeIndexed(5,pdTRUE,0); + uint32_t input_c5=0; + uint32_t input_c11=0; + uint32_t input_c12=0; + uint32_t input_c18=0; + uint32_t input_c39=0; + uint32_t input_c41=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c5,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c11,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c12,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c18,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c39,0); + xTaskNotifyWaitIndexed(5,0,ULONG_MAX,&input_c41,0); int32_t cond_5 = input_c5<=14 || ! (input_c12<(INPUT_CHAR_NEXT % 16 )) && (input_c11<=(INPUT_CHAR_NEXT % 16 )); int32_t cond_11 = input_c11>(INPUT_CHAR_NEXT % 16 ) || ! (RNG_FROM(input_c39) % 16=input_c18); @@ -752,8 +800,8 @@ static void task_15_fn(void *pvParameters) { int output_c12 = (cond_41 | cond_18<<1 | cond_11<<2 || cond_11<<3); int output_c39 = (cond_41 | cond_11<<1 | cond_41<<2 || cond_11<<3); - xTaskNotifyIndexed(xTask_11_Handle,1,output_c12+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_14_Handle,0,output_c39+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_11_Handle,1,output_c12,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_14_Handle,0,output_c39,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -790,8 +838,10 @@ static void task_17_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c44 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c49 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); + uint32_t input_c44=0; + uint32_t input_c49=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c44,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c49,0); int32_t cond_44 = input_c44==2 && ! (input_c49>=(INPUT_CHAR_NEXT % 16 )); int32_t cond_49 = input_c49<=9 && ! (input_c49>=input_c44); @@ -806,8 +856,8 @@ static void task_17_fn(void *pvParameters) { int output_c44 = (cond_44 | cond_49<<1 | cond_49<<2 || cond_44<<3); int output_c49 = (cond_44 | cond_49<<1 | cond_49<<2 || cond_49<<3); - xTaskNotifyIndexed(xTask_25_Handle,2,output_c44+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_20_Handle,2,output_c49+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_25_Handle,2,output_c44,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_20_Handle,2,output_c49,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -821,9 +871,12 @@ static void task_18_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c9 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c30 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c49 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c9=0; + uint32_t input_c30=0; + uint32_t input_c49=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c9,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c30,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c49,0); int32_t cond_9 = input_c9!=7 && ! (input_c30>=input_c9) || ! (input_c49>=(INPUT_CHAR_NEXT % 16 )); int32_t cond_30 = input_c30<=7; @@ -840,9 +893,9 @@ static void task_18_fn(void *pvParameters) { int output_c22 = (cond_9 | cond_9<<1 | cond_49<<2 || cond_30<<3); int output_c30 = (cond_9 | cond_49<<1 | cond_30<<2 || cond_30<<3); int output_c49 = (cond_30 | cond_9<<1 | cond_30<<2 || cond_30<<3); - xTaskNotifyIndexed(xTask_24_Handle,1,output_c22+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_23_Handle,2,output_c30+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_17_Handle,1,output_c49+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_24_Handle,1,output_c22,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_23_Handle,2,output_c30,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_17_Handle,1,output_c49,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -856,8 +909,10 @@ static void task_19_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c35 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c42 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); + uint32_t input_c35=0; + uint32_t input_c42=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c35,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c42,0); int32_t cond_35 = input_c35>(INPUT_CHAR_NEXT % 16 ) && (input_c42==12); int32_t cond_42 = RNG_FROM(input_c42) % 16<(INPUT_CHAR_NEXT % 16 ) && (input_c35<=3); @@ -872,8 +927,8 @@ static void task_19_fn(void *pvParameters) { int output_c23 = (cond_35 | cond_35<<1 | cond_35<<2 || cond_42<<3); int output_c42 = (cond_35 | cond_35<<1 | cond_42<<2 || cond_35<<3); - xTaskNotifyIndexed(xTask_25_Handle,1,output_c23+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_2_Handle,4,output_c42+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_25_Handle,1,output_c23,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_2_Handle,4,output_c42,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -887,9 +942,12 @@ static void task_20_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c35 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c42 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c49 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c35=0; + uint32_t input_c42=0; + uint32_t input_c49=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c35,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c42,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c49,0); int32_t cond_35 = input_c35>6; int32_t cond_42 = input_c42>=(INPUT_CHAR_NEXT % 16 ) && (input_c35>input_c42); @@ -906,9 +964,9 @@ static void task_20_fn(void *pvParameters) { int output_c35 = (cond_49 | cond_42<<1 | cond_42<<2 || cond_42<<3); int output_c42 = (cond_49 | cond_49<<1 | cond_42<<2 || cond_49<<3); int output_c49 = (cond_49 | cond_35<<1 | cond_42<<2 || cond_35<<3); - xTaskNotifyIndexed(xTask_19_Handle,0,output_c35+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_6_Handle,3,output_c42+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_25_Handle,3,output_c49+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_19_Handle,0,output_c35,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_6_Handle,3,output_c42,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_25_Handle,3,output_c49,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -922,8 +980,10 @@ static void task_21_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c22 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); + uint32_t input_c22=0; + uint32_t input_c44=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c22,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c44,0); int32_t cond_22 = input_c22>5; int32_t cond_44 = input_c44<=5; @@ -937,7 +997,7 @@ static void task_21_fn(void *pvParameters) { WASTE_NSEC(tmp); int output_c44 = (cond_44 | cond_44<<1 | cond_22<<2 || cond_22<<3); - xTaskNotifyIndexed(xTask_13_Handle,1,output_c44+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_13_Handle,1,output_c44,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -951,9 +1011,12 @@ static void task_22_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c9 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c30 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c47 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c9=0; + uint32_t input_c30=0; + uint32_t input_c47=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c9,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c30,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c47,0); int32_t cond_9 = input_c9!=10 || ! (input_c47>=1) || ! (input_c47>=(INPUT_CHAR_NEXT % 16 )); int32_t cond_30 = input_c30>=(INPUT_CHAR_NEXT % 16 ); @@ -969,8 +1032,8 @@ static void task_22_fn(void *pvParameters) { int output_c9 = (cond_9 | cond_47<<1 | cond_9<<2 || cond_47<<3); int output_c26 = (cond_9 | cond_47<<1 | cond_9<<2 || cond_47<<3); - xTaskNotifyIndexed(xTask_18_Handle,0,output_c9+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_26_Handle,0,output_c26+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_18_Handle,0,output_c9,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_26_Handle,0,output_c26,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -984,9 +1047,12 @@ static void task_23_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c15 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c26 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c30 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); + uint32_t input_c15=0; + uint32_t input_c26=0; + uint32_t input_c30=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c15,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c26,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c30,0); int32_t cond_15 = input_c15!=input_c26 && (input_c15==input_c30); int32_t cond_26 = input_c26>(INPUT_CHAR_NEXT % 16 ) || (input_c15!=0) && (input_c26!=(INPUT_CHAR_NEXT % 16 )); @@ -1002,8 +1068,8 @@ static void task_23_fn(void *pvParameters) { int output_c15 = (cond_15 | cond_30<<1 | cond_26<<2 || cond_26<<3); int output_c30 = (cond_30 | cond_30<<1 | cond_15<<2 || cond_26<<3); - xTaskNotifyIndexed(xTask_10_Handle,0,output_c15+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_24_Handle,2,output_c30+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_10_Handle,0,output_c15,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_24_Handle,2,output_c30,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -1017,11 +1083,16 @@ static void task_24_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c15 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c22 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c30 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); - int input_c47 = ulTaskNotifyTakeIndexed(4,pdTRUE,0); + uint32_t input_c15=0; + uint32_t input_c22=0; + uint32_t input_c30=0; + uint32_t input_c44=0; + uint32_t input_c47=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c15,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c22,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c30,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c44,0); + xTaskNotifyWaitIndexed(4,0,ULONG_MAX,&input_c47,0); int32_t cond_15 = input_c15<(INPUT_CHAR_NEXT % 16 ) && (input_c15>=10) || ! (RNG_FROM(input_c22) % 16!=input_c44); int32_t cond_22 = input_c22>(INPUT_CHAR_NEXT % 16 ) && ! (RNG_FROM(input_c44) % 16==0) && (input_c44>=4) || ! (input_c47>(INPUT_CHAR_NEXT % 16 )); @@ -1043,12 +1114,12 @@ static void task_24_fn(void *pvParameters) { int output_c42 = (cond_22 | cond_47<<1 | cond_15<<2 || cond_30<<3); int output_c44 = (cond_44 | cond_30<<1 | cond_47<<2 || cond_22<<3); int output_c47 = (cond_44 | cond_47<<1 | cond_44<<2 || cond_47<<3); - xTaskNotifyIndexed(xTask_23_Handle,0,output_c15+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_25_Handle,0,output_c22+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_22_Handle,1,output_c30+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_20_Handle,1,output_c42+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_8_Handle,1,output_c44+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_22_Handle,2,output_c47+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_23_Handle,0,output_c15,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_25_Handle,0,output_c22,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_22_Handle,1,output_c30,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_20_Handle,1,output_c42,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_8_Handle,1,output_c44,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_22_Handle,2,output_c47,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -1062,10 +1133,14 @@ static void task_25_fn(void *pvParameters) { volatile int tmp=0; while(1) { RNG_RESET - int input_c22 = ulTaskNotifyTakeIndexed(0,pdTRUE,0); - int input_c23 = ulTaskNotifyTakeIndexed(1,pdTRUE,0); - int input_c44 = ulTaskNotifyTakeIndexed(2,pdTRUE,0); - int input_c49 = ulTaskNotifyTakeIndexed(3,pdTRUE,0); + uint32_t input_c22=0; + uint32_t input_c23=0; + uint32_t input_c44=0; + uint32_t input_c49=0; + xTaskNotifyWaitIndexed(0,0,ULONG_MAX,&input_c22,0); + xTaskNotifyWaitIndexed(1,0,ULONG_MAX,&input_c23,0); + xTaskNotifyWaitIndexed(2,0,ULONG_MAX,&input_c44,0); + xTaskNotifyWaitIndexed(3,0,ULONG_MAX,&input_c49,0); int32_t cond_22 = input_c22<4 && ! (input_c23>(INPUT_CHAR_NEXT % 16 )); int32_t cond_23 = input_c23!=3 || (RNG_FROM(input_c44) % 16!=(INPUT_CHAR_NEXT % 16 )) && (input_c23=16; @@ -1118,9 +1194,9 @@ static void task_26_fn(void *pvParameters) { int output_c26 = (cond_26 | cond_26<<1 | cond_26<<2 || cond_26<<3); int output_c44 = (cond_26 | cond_26<<1 | cond_26<<2 || cond_26<<3); int output_c49 = (cond_26 | cond_26<<1 | cond_26<<2 || cond_26<<3); - xTaskNotifyIndexed(xTask_23_Handle,1,output_c26+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_21_Handle,1,output_c44+1,eSetValueWithOverwrite); - xTaskNotifyIndexed(xTask_18_Handle,2,output_c49+1,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_23_Handle,1,output_c26,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_21_Handle,1,output_c44,eSetValueWithOverwrite); + xTaskNotifyIndexed(xTask_18_Handle,2,output_c49,eSetValueWithOverwrite); trigger_job_done(); xTaskDelayUntil(&xLastWakeTime, xFrequency ); } @@ -1130,28 +1206,28 @@ static void task_26_fn(void *pvParameters) { void ISR_0_Handler(void) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (xTask_0_Handle != NULL) { - xTaskNotifyFromISR(xTask_0_Handle, 9, eNoAction, &xHigherPriorityTaskWoken); + vTaskNotifyGiveIndexedFromISR(xTask_0_Handle, 9, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } void ISR_1_Handler(void) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (xTask_1_Handle != NULL) { - xTaskNotifyFromISR(xTask_1_Handle, 9, eNoAction, &xHigherPriorityTaskWoken); + vTaskNotifyGiveIndexedFromISR(xTask_1_Handle, 9, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } void ISR_2_Handler(void) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (xTask_2_Handle != NULL) { - xTaskNotifyFromISR(xTask_2_Handle, 9, eNoAction, &xHigherPriorityTaskWoken); + vTaskNotifyGiveIndexedFromISR(xTask_2_Handle, 9, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } void ISR_3_Handler(void) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (xTask_8_Handle != NULL) { - xTaskNotifyFromISR(xTask_8_Handle, 9, eNoAction, &xHigherPriorityTaskWoken); + vTaskNotifyGiveIndexedFromISR(xTask_8_Handle, 9, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } \ No newline at end of file diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/util_macros.h b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/util_macros.h index 35f3b350..0377b75d 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/util_macros.h +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/util_macros.h @@ -33,7 +33,7 @@ #define IF_ELSE(X,Y,Z) ((X) ? (Y) : (Z)) // Challanges ======= -#define CHANCE_1_IN_POWOF2(X,Y) (RNG_FROM(X)<(M>>Y)) // assume the type of x has more than y bits +#define CHANCE_1_IN_POWOF2(X,Y) (RNG_FROM(X)<(__UTIL_RNG_M>>Y)) // assume the type of x has more than y bits // branchless, takes a large hit on performance #ifdef BRANCHLESS_TERNARY