Hi,
I am using uPP to capture data from A/D converter, when buffer is filled, EOW interrupt is fired which executes ISR to disable the interrupt and post a semaphore to TASK which process the buffer and fills new buffer as well. In my application, time to capture the data using uPP is faster than processing it so I thought semaphore can be best use to synchronize the capturing and post-processing. Is it corect approach to deal with this kind of problem ?
How can I check if SEM_post and SEM_pend are working properly ? I mean making sure that it is not posting another semaphore untill previous processing is done? I tried ROV option, semaphore pends only once after that it never pend, I wonder if they are being used correctly ?
Following are the code snippet which shows SEM_post and SEM_pend:
void isrUPP(void)
{
UPISR_t interrupt_status;
interrupt_status.value = UPP->UPIER;
while (interrupt_status.value != 0)
{
if (interrupt_status.bits.EOWI)
{
UPP->UPIER |= ~(0x08);
// Handle EOWI
SEM_post (&ProcBuf);
}
interrupt_status.value = UPP->UPIER;
}
}
void TSK_process(void)
{
while(1)
{
SEM_pend(&ProcBuf, SYS_FOREVER);
further processing...
}
}
Thanks for your help.
BAS