void main(void) { YKInitialize(); /* create all semaphores, at least one user task, etc. */ PSemPtr = YKSemCreate(1); SSemPtr = YKSemCreate(0); WSemPtr = YKSemCreate(0); NSemPtr = YKSemCreate(0); YKNewTask(TaskStat, (void *) &TaskStatStk[TASK_STACK_SIZE], 30); YKRun(); }
void main(void) { YKInitialize(); newPieceSEM = YKSemCreate(0); receivedSEM = YKSemCreate(1); YKNewTask(STask, (void *) &STaskStk[TASK_STACK_SIZE], 0); YKNewTask(handleNewPieceTask, (void *) &NewPieceHandlerTaskStk[TASK_STACK_SIZE], 1); YKNewTask(handleSendMovementTask, (void *) &SendMovementHandlerTaskStk[TASK_STACK_SIZE], 2); MsgQPtr = YKQCreate(MsgQ, MSGQSIZE); YKRun(); }
void main(void) { scmdarrIdx = 0; PieceArrayIndex = 0; YKInitialize(); YKNewTask(StatTask, (void *) &StatTaskStk[TASK_STACK_SIZE], 10); commandReceivedSem = YKSemCreate(0); touchdownSem = YKSemCreate(1); CmdQPtr = YKQCreate(CmdQ, CMDQSIZE); NewPieceQPtr = YKQCreate(NewPieceQ, PIECEQSIZE); YKRun(); }
YKQ* YKQCreate(void **start, unsigned size){ static int index = 0; YKQ *queue; if(index == MAXMESSAGEQUEUES) printString("IDIOTS: update max message queues\n"); //find next entry in QStack queue = &QStack[index++]; //initialize variables queue->queue = start; queue->head = -1; queue->tail = 0; queue->length = size; queue->sem = YKSemCreate(0); return queue; }