Hi Dave
1) Yes the available edge-port IRQ lines on the Kirin3 are a little limited, however the FEC consumes only 2 of the 4 available lines (FEC_MDC shared with IRQ5 and FEC_MDIO shared with IRQ3). IRQ1 and IRQ7 should be available.
2) I am looking at adapting the demo and am wondering whether the following may be possible (I am assuming that you would like the IRQ to wake a task so that it can process something based on the event - possibly also doing some fast critical stuff in the routine itself). As already discussed, sending an interrupt event, or other message, is dangerous since it could cause queue corruption.
However I believe that it should be safe to use uTaskerStateChange(OWN_TASK, UTASKER_ACTIVATE) in order to cause the task to be scheduled (without using its queue). As long as no other user code is doing uTaskerStateChange(OWN_TASK, UTASKER_STOP) on the same task, I don't 'see' and risk.
By using a flag, the task can know that it was scheduled due to the IRQ and so behave the same way as when reacting to an interrupt event. One must still be careful with the flag since a second NMI could still try to set it again while the task is trying to clear it (for example), so the following may be a solution to safely using the NMI:
static unsigned long ulNMI_event_count = 0;
static unsigned long ulNMI_processed_count = 0;
NMI // interrupt routine
{
ulNMI_event_count++; // mark that new event has occurred
uTaskerStateChange(OWN_TASK, UTASKER_ACTIVATE); // safely schedule the task to handle the event
}
TASK // task which could have been scheduled due to the NMI (as well as other reasons)
{
while (ulNMI_event_count != ulNMI_processed_count) { // if there are open events
ulNMI_processed_count++; // this one processed
// process once for each NMI occurrence
}
}
Here the NMI and task have their own counters and so there is no risk involved as when the flag is shared.
If this could be a solution for you it may be an idea to adapt the demo to also use it to illustrate the precaution involved when using an NMI.
Regards
Mark