From 6789bf2af667c869515f79d9474ba2ba057a33de Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Wed, 1 Mar 2023 08:53:01 +0100 Subject: [PATCH] fix interrupt handler --- .../CORTEX_M3_MPS2_QEMU_GCC/main_micro_int.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_micro_int.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_micro_int.c index b7448c9e..0784d466 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_micro_int.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_micro_int.c @@ -127,12 +127,12 @@ void main_micro_int( void ) mainREPLICA_C_TASK_PRIORITY, /* The priority assigned to the task. */ &xReplC ); /* The task handle is not required, so NULL is passed. */ - xTaskCreate( prvSpor, /* The function that implements the task. */ - "Spor", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainREPLICA_SPOR_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + // xTaskCreate( prvSpor, /* The function that implements the task. */ + // "Spor", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ + // configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + // NULL, /* The parameter passed to the task - not used in this case. */ + // mainREPLICA_SPOR_TASK_PRIORITY, /* The priority assigned to the task. */ + // NULL ); /* The task handle is not required, so NULL is passed. */ /* Start the tasks and timer running. */ vTaskStartScheduler(); @@ -186,22 +186,24 @@ static void prvReplicaC( void * pvParameters ) } static void prvSpor( void * pvParameters ) { + uint32_t x = fuzz_char_next(); TickType_t xLastWakeTime = xTaskGetTickCount(); - const TickType_t xFrequency = 7 / portTICK_PERIOD_MS; + TickType_t xFrequency = x / portTICK_PERIOD_MS; vTaskDelayUntil( &xLastWakeTime, xFrequency ); while (1) { puts("Fire"); xTaskNotifyGive(xReplB); - vTaskDelayUntil( &xLastWakeTime, xFrequency * 10000 ); + ulTaskNotifyTake(pdTRUE,portMAX_DELAY); } } void isr_starter( void ) { - puts("Fire"); - xTaskNotifyGive(xReplB); + if (xReplB) { + vTaskNotifyGiveFromISR(xReplB, NULL); + } } /*-----------------------------------------------------------*/