__osSiCreateAccessQueue.c (683B)
1 #include "libultra_internal.h" 2 3 #include "macros.h" 4 5 #define SIAccessQueueSize 2 6 7 FORCE_BSS OSMesg osSiMesgBuff[SIAccessQueueSize]; 8 OSMesgQueue gOsSiMessageQueue; 9 u32 gOsSiAccessQueueCreated = 0; 10 11 void __osSiCreateAccessQueue() { 12 gOsSiAccessQueueCreated = 1; 13 osCreateMesgQueue(&gOsSiMessageQueue, &osSiMesgBuff[0], SIAccessQueueSize - 1); 14 osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); 15 } 16 17 void __osSiGetAccess(void) { 18 OSMesg sp1c; 19 if (!gOsSiAccessQueueCreated) { 20 __osSiCreateAccessQueue(); 21 } 22 osRecvMesg(&gOsSiMessageQueue, &sp1c, OS_MESG_BLOCK); 23 } 24 25 void __osSiRelAccess(void) { 26 osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); 27 }