I am trying to figure the best way to create a “sequential” solution which sends and receives messages on UART:
// Simple view of Upload Code – which uploads code to the uC connected to UART
UploadCode()
{
for(i=0; i < Sectors; i++){
for(j=0; j < BlocksPerSector; j++) {
for(k=0; k <LinesPerBlock> 0){
ProcessMessage();
}
}
}
}
}
bool handlerDataReceive(u16 DataSize, u8 * Data )
{
AddDataToBuffer();
// Wake up code interested in this data
adl_semProduce(MsgSemaphore);
}
I was expecting that adl_semConsume will block and give back control to the OS and when data on UART is received handlerDataReceive will be invoked which will produce a semaphore and unblock the Upload code.
However the Upload code gets blocked and handlerDataReceive is not invoked.
Any ideas on a good way to solve this issue?