mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-15 14:05:06 -05:00
27 lines
578 B
C
27 lines
578 B
C
|
#include "global.h"
|
||
|
|
||
|
u32 __osPiAccessQueueEnabled = 0;
|
||
|
|
||
|
OSMesg piAccessBuf;
|
||
|
OSMesgQueue __osPiAccessQueue;
|
||
|
|
||
|
void __osPiCreateAccessQueue(void) {
|
||
|
__osPiAccessQueueEnabled = 1;
|
||
|
osCreateMesgQueue(&__osPiAccessQueue, &piAccessBuf, 1);
|
||
|
osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK);
|
||
|
}
|
||
|
|
||
|
void __osPiGetAccess(void) {
|
||
|
OSMesg mesg;
|
||
|
|
||
|
if (!__osPiAccessQueueEnabled) {
|
||
|
__osPiCreateAccessQueue();
|
||
|
}
|
||
|
|
||
|
osRecvMesg(&__osPiAccessQueue, &mesg, OS_MESG_BLOCK);
|
||
|
}
|
||
|
|
||
|
void __osPiRelAccess(void) {
|
||
|
osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK);
|
||
|
}
|