I'm currently porting some old ChibiOS 2.x code to 3.x with NIL to to uC flash size restrictions.
In nil.c, the standard event functions, most notably chEvtSignalI are defined for the NIL kernel.
However, there is no chThdCreateStatic() that returns a thread_t* in NIL as threads are handled via the thread table.
Therefore, my question is how to properly use chEventSignalI in NIL. My current code is:
Code: Select all
void uartTXend2Callback(UARTDriver *uartp) {
(void)uartp;
palClearPad(GPIOA, GPIOA_RS485_DE);
osalSysLockFromISR();
chEvtSignalI(&nil.threads[0], EVENT_UART_TX_FINISHED);
chSchRescheduleS(); //Maybe unneccessary
osalSysUnlockFromISR();
}
Before using uartSend in the thread code, I use
Code: Select all
chEvtWaitAnyTimeout(EVENT_UART_TX_FINISHED, TIME_INFINITE)
Using this method, the thread never wakes up. I am not sure if this is related to some other part of my source code, but directly using the thread table (I'm using only one thread besides main) via &nil.threads[0] seems somewhat strange to me.
Best regards, Uli