Add SemWaitI() to FreeRTOS

This commit is contained in:
inmarket 2014-03-14 07:39:02 +10:00
parent 6f54bde79c
commit 58cf2d2b35
2 changed files with 15 additions and 0 deletions

View File

@ -107,6 +107,20 @@ bool_t gfxSemWait(gfxSem* psem, delaytime_t ms)
return FALSE;
}
bool_t gfxSemWaitI(gfxSem* psem)
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
psem->counter--;
if (xSemaphoreTakeFromISR(psem->sem,&xHigherPriorityTaskWoken) == pdTRUE)
return TRUE;
psem->counter++;
return FALSE;
}
void gfxSemSignal(gfxSem* psem)
{
taskENTER_CRITICAL();

View File

@ -94,6 +94,7 @@ void gfxSleepMicroseconds(delaytime_t ms);
void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit);
void gfxSemDestroy(gfxSem* psem);
bool_t gfxSemWait(gfxSem* psem, delaytime_t ms);
bool_t gfxSemWaitI(gfxSem* psem);
void gfxSemSignal(gfxSem* psem);
void gfxSemSignalI(gfxSem* psem);
#define gfxSemCounterI(psem) ((psem)->counter)