Exemplo n.º 1
0
Arquivo: TEST.C Projeto: yylea/UCOS2
void  main (void)
{
    PC_DispClrScr(DISP_BGND_BLACK);                        /* Clear the screen                         */

    OSInit();                                              /* Initialize uC/OS-II                      */

    PC_DOSSaveReturn();                                    /* Save environment to return to DOS        */

    PC_VectSet(uCOS, OSCtxSw);                             /* Install uC/OS-II's context switch vector */

    //Initialized elapsed time measurement function that is used to
    //measure the execution time of OSTaskStkChk()
    PC_ElapsedInit();                                      /* Initialized elapsed time measurement     */

    strcpy(TaskUserData[TASK_START_ID].TaskName, "StartTask");
    OSTaskCreateExt(TaskStart,                             //pointer to task's function
                    (void *)0,                             //the parameter to the task's function
                    &TaskStartStk[TASK_STK_SIZE - 1],      //top of the stack
                    TASK_START_PRIO,                       //priority
                    TASK_START_ID,                         //task ID
                    &TaskStartStk[0],                      //bottom of the stack
                    TASK_STK_SIZE,                         //stack size
                    &TaskUserData[TASK_START_ID],          //Task Control Block TCB can store a pointer to a user-provided data structure
                                                           //this allows to extend the functionality of UCOSII
                    0);                                    //a set of additional options
    OSStart();                                             /* Start multitasking                       */
}
/*
 * Application
 */
void  main (void) {

    PC_DispClrScr(DISP_FGND_WHITE + DISP_BGND_BLACK);      	/* Clear the screen                         */

    OSInit();                                              	/* Initialize uC/OS-II                      */

    PC_DOSSaveReturn();                                    	/* Save environment to return to DOS        */
    PC_VectSet(uCOS, OSCtxSw);                             	/* Install uC/OS-II's context switch vector */
	PC_ElapsedInit();
	
	CarMbox = OSMboxCreate((void *)0);					   	/* Create an empty mailbox for communication between car lane sensors and the controller*/
	PedMbox = OSMboxCreate((void *)0);					   	/* Create an empty mailbox for communication between pedestrian lane sensors and the controller*/
	Car1ToCar2Mbox = OSMboxCreate((void *)0);				/* Create an empty mailbox for communication from car1 to car2*/
	Car2ToCar3Mbox = OSMboxCreate((void *)0);				/* Create an empty mailbox for communication from car2 to car3*/

    OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], 0);
    OSStart();                                             	/* Start multitasking                       */
}
Exemplo n.º 3
0
Arquivo: test.c Projeto: palmerc/lab
int main (void)
{
    PC_DispClrScr(DISP_BGND_BLACK);                        /* Clear the screen                         */

    OSInit();                                              /* Initialize uC/OS-II                      */

    PC_ElapsedInit();                                      /* Initialized elapsed time measurement     */

    strcpy(TaskUserData[TASK_START_ID].TaskName, "StartTask");
    OSTaskCreateExt(TaskStart,
                    (void *)0,
                    &TaskStartStk[TASK_STK_SIZE - 1],
                    TASK_START_PRIO,
                    TASK_START_ID,
                    &TaskStartStk[0],
                    TASK_STK_SIZE,
                    &TaskUserData[TASK_START_ID],
                    0);
    OSStart();                                             /* Start multitasking                       */

    return 0;
}
Exemplo n.º 4
0
Arquivo: TEST.C Projeto: AaronXCh/code
void  main (void)
{
    PC_DispClrScr(DISP_BGND_BLACK);                        /* Clear the screen                         */

    OSInit();                                              /* Initialize uC/OS-II                      */

    PC_DOSSaveReturn();                                    /* Save environment to return to DOS        */

    PC_VectSet(uCOS, OSCtxSw);                             /* Install uC/OS-II's context switch vector */

    PC_ElapsedInit();                                      /* Initialized elapsed time measurement     */

    strcpy(TaskUserData[TASK_START_ID].TaskName, "StartTask");
    OSTaskCreateExt(TaskStart,
                    (void *)0,
                    &TaskStartStk[TASK_STK_SIZE - 1],
                    TASK_START_PRIO,
                    TASK_START_ID,
                    &TaskStartStk[0],
                    TASK_STK_SIZE,
                    &TaskUserData[TASK_START_ID],
                    0);
    OSStart();                                             /* Start multitasking                       */
}