joehinkle wrote on Friday, June 24, 2016:
Writing a zero-copy NIC driver for a Kinetis K64.
Your porting examples show a deferred “task” processing incoming messages but state performance woud be better if done within an ISR.
Currently, I’m attempting to do just that within the Receive ISR but the stack is locking up.
I call xSendEventStructToIPTask() with the network buffer attached.
Within xSendEventStructToIPTask … it calls:
xReturn = xQueueSendToBack( xNetworkEventQueue, pxEvent, xTimeout )
which attempts to place the buffer at the end of the queue.
First thing xQueueSendToBack does is call taskENTER_CRITICAL(); and then we’re locked.
void vPortEnterCritical( void )
{
portDISABLE_INTERRUPTS();
uxCriticalNesting++;
/* This is not the interrupt safe version of the enter critical function so
assert() if it is being called from an interrupt context. Only API
functions that end in "FromISR" can be used in an interrupt. Only assert if
the critical nesting count is 1 to protect against recursive calls if the
assert function also uses a critical section. */
if( uxCriticalNesting == 1 )
{
configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
}
}
The Assert locks us because we are in an ISR.
What is (if there is) the proper way to pass the network buffer back to the stack when an incoming message is received when processing within the ISR?
I’m hoping there is a way as deferring the incoming message to a task is slow.
Any help/comments appreciated.