simulating interrupts in Window FrreeRTOS port

Hello everyone, I am a newbie to FreeRtos and currently working on the windows port. The provided example is working fine and I also could use the interface to generate interrupts. But I do have a conceptional question about all that. I created a simple demo code ~~~

include <stdio.h>

include <windows.h>

/* Kernel includes. */

include “FreeRTOS.h”

include “task.h”

static HANDLE gThread;

define INTERRUPT_ID 0x11

TaskHandle_t gFreeRtosTaksHandler; uint32_t myISR(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;

/* Unblock the handling task so the task can perform any processing
necessitated by the interrupt.  xHandlingTask is the task's handle, which was
obtained when the task was created.  vTaskNotifyGiveFromISR() also increments
the receiving task's notification value. */
vTaskNotifyGiveFromISR(gFreeRtosTaksHandler, &xHigherPriorityTaskWoken);

} DWORD WINAPI someThread(void* data) { DWORD dwError; if (!SetThreadPriority(GetCurrentThread(), THREADPRIORITYTIMECRITICAL)) { dwError = GetLastError(); printf(“error (%d)n”, dwError); return -1; } Sleep(1000); while (1) { myISR(); // a direct call of the myISR does not lead to an task notification //vPortGenerateSimulatedInterrupt(INTERRUPTID); // this is working Sleep(1000); } return 0; } void freeRtosTask(void *pvParameters) {
const TickType_t xBlockTime = 5000000; uint32_t ulNotifiedValue;
for (;; )

    ulNotifiedValue = ulTaskNotifyTake(pdTRUE,

    // HERE's the problem: I am NOT receiving any notification when myISR is directly called

} int main(void) { gThread = CreateThread(NULL, 0, someThread, NULL, 0, NULL); xTaskCreate(freeRtosTask, /* The function that implements the task. / “foo”, / 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 simple case. / tskIDLE_PRIORITY + 5,/ The priority assigned to the task. / &gFreeRtosTaksHandler); / The task handle is not required, so NULL is passed. */
vPortSetInterruptHandler(INTERRUPT_ID, myISR);

for (;; );
} ~~~ When I am using in the “someThread” function the vPortGenerateSimulatedInterrupt call, the notification is received. But when I do a direct call of my ISR in the “someThread” function the notification is not received. I did not yet dive in the debugging but I’d like to have some feedback about this concept from the community. IMHO the direct call is closer to the real use case when working on an microcontroller but I am not sure about that nor do I know if my code can work. Any hints and comments are very appreciated. Thanks Matthias

simulating interrupts in Window FrreeRTOS port

Please use the port in the way it is intended, which is the way the example code uses it. You should not be creating Windows threads directly. Only threads created using the FreeRTOS API will be part of the FreeRTOS application, and threads that are not part of the FreeRTOS application (any other Windows thread) cannot communicate with threads that are.

simulating interrupts in Window FrreeRTOS port

Ok I understand that. But what about ISR, an ISR is not a FreeRTOS thread and on a uC target platform an ISR can notify a FreeRtos thread. In my oppinion that should also be working on windows: the (high priortity) Window thread is the equivalent of an uC ISR. Can you help me understand if (resp. why) this analogy is not true?