Fixing Mutex and Semaphores for CMSIS RTOS
This commit is contained in:
parent
96a912bbc0
commit
ccd83187fa
@ -32,14 +32,20 @@ void _gosDeinit(void)
|
||||
|
||||
void gfxMutexInit(gfxMutex* pmutex)
|
||||
{
|
||||
pmutex->id = osMutexCreate(&(pmutex->def));
|
||||
osMutexDef_t def;
|
||||
def.mutex = pmutex->mutex;
|
||||
|
||||
pmutex->id = osMutexCreate(&def);
|
||||
}
|
||||
|
||||
void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit)
|
||||
{
|
||||
psem->id = osSemaphoreCreate(&(psem->def), limit);
|
||||
while(val--)
|
||||
osSemaphoreRelease(psem->id);
|
||||
osSemaphoreDef_t def;
|
||||
def.semaphore = psem->semaphore;
|
||||
|
||||
(void)limit;
|
||||
|
||||
psem->id = osSemaphoreCreate(&def, val);
|
||||
}
|
||||
|
||||
void gfxSemDestroy(gfxSem* psem)
|
||||
|
@ -42,12 +42,12 @@ typedef osPriority threadpriority_t;
|
||||
#define HIGH_PRIORITY osPriorityHigh
|
||||
|
||||
typedef struct gfxSem {
|
||||
osSemaphoreDef_t def;
|
||||
uint32_t semaphore[2];
|
||||
osSemaphoreId id;
|
||||
} gfxSem;
|
||||
|
||||
typedef struct gfxMutex {
|
||||
osMutexDef_t def;
|
||||
uint32_t mutex[4];
|
||||
osMutexId id;
|
||||
} gfxMutex;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user