コード例 #1
0
ファイル: lab4b_app.c プロジェクト: camhart/ecen425_lab4b
void ATask(void)
{
    printString("Task A started!\n");

    printString("Creating low priority task B...\n");
    YKNewTask(BTask, (void *)&BStk[BSTACKSIZE], 7);

    printString("Creating task C...\n");
    YKNewTask(CTask, (void *)&CStk[CSTACKSIZE], 2);

    printString("Task A is still running! Oh no! Task A was supposed to stop.\n");
    exit(0);
}
コード例 #2
0
ファイル: lab8app.c プロジェクト: canada11/YAK-Kernel
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();
}
コード例 #3
0
ファイル: yakc.c プロジェクト: camhart/ecen425_lab4c
void YKInitialize(void){
	YKEnterMutex();
	//Create Idle task and add it to the ready queue
	//printString("YKInitialize\n");
	YKNewTask(&YKIdleTask, (void *)&idleStk[IDLE_STACK_SIZE], 100);
	//new task adds to queue for us
}
コード例 #4
0
ファイル: yakc.c プロジェクト: canada11/YAK-Kernel
//Initalizing code -----------------------------------------------------------------------------
void YKInitialize()
{
	//Initializes all required kernel data structures
	int i;
	YKEnterMutex();
	//Initalize the YKAvailTCBList queue
	YKAvailTCBList = &(YKTCBArray[0]);
    for (i = 0; i < MAXTASKS; i++)
	{
		if(i != 0)
		{
			YKTCBArray[i].prev = &(YKTCBArray[i-1]);
		}
		YKTCBArray[i].next = &(YKTCBArray[i+1]);
	}
	YKTCBArray[0].prev = NULL;
    YKTCBArray[MAXTASKS].next = NULL;
	if(MAXTASKS > 0)
	{
		YKTCBArray[MAXTASKS].prev = &(YKTCBArray[MAXTASKS - 1]);
	}
	YKReadyList = NULL;
	YKSuspList = NULL;
	nestedInterruptLevel = 0;
	curTask = NULL;
	YKNewTask(YKIdleTask, (void *)&IdleStk[IDLESTACKSIZE], 100);
}
コード例 #5
0
ファイル: yakc.c プロジェクト: davelindell/yak_kernel
void YKInitialize(void) {
    // Init Tasks
    void (*idle_task_p)(void);
    void *idle_task_stack_p; 
    int lowest_priority = 100;
    YKCtxSwCount = 0;
    YKTickNum = 0;
    YKIdleCount = 0;
    YKISRDepth = 0;
    YKRunFlag = 0;
	YKBlockList = 0;
    YKRdyList = NULL;    
    YKCurrTask = NULL;
    idle_task_p = YKIdleTask;
    idle_task_stack_p = YKIdleTaskStack + IDLE_STACK_SIZE - 1;
    lowest_priority = 100;
    YKErrorFlag = 0;
    
    // Init Semaphores
    YKAvailSEMList = YKSEMArray;
    // Init Queues
    YKQAvailQList = YKQArray;
	// Init Events
	YKAvailEventList = YKEventArray;

    // Finish
    YKAvailTCBList = YKTCBArray;
    YKNewTask(idle_task_p, idle_task_stack_p, lowest_priority);
}
コード例 #6
0
ファイル: yakc.c プロジェクト: YazanHalawa/ECEn-425
void YKInitialize(){
    int i;
    YKEnterMutex();
    YKIMRInit(0x00);
    running = 0;
    YKIdleCount = 0;
    YKCtxSwCount = 0;
    YKCurTask = NULL; 
    YKRdyList = NULL;
    YKSuspList = NULL;
    nestingLevel = 0;
    YKTickNum = 0;
    YKAvaiSems = MAXSEMS;
    
    // Initialize locations for TCB
    YKAvailTCBList = &(YKTCBArray[0]);
    for (i = 0; i < MAXTASKS; i++){
        YKTCBArray[i].next = &(YKTCBArray[i+1]);
        YKTCBArray[MAXTASKS].prev = NULL; 
    }
    YKTCBArray[MAXTASKS].next = NULL;
    YKTCBArray[MAXTASKS].prev = NULL;

    YKNewTask(YKIdleTask,(void *) &(idleStk[IDLE_STACK_SIZE]),100);  
}
コード例 #7
0
ファイル: lab4b_app.c プロジェクト: camhart/ecen425_lab4b
void main(void)
{
    YKInitialize();
    
    printString("Creating task A...\n");
    YKNewTask(ATask, (void *)&AStk[ASTACKSIZE], 5);
    
    printString("Starting kernel...\n");
    YKRun();
}
コード例 #8
0
ファイル: lab4c_app.c プロジェクト: YazanHalawa/ECEn-425
void main(void)
{
    YKInitialize();
    
    printString("Creating task...\n");
    YKNewTask(Task, (void *) &TaskStack[STACKSIZE], 0);

    printString("Starting kernel...\n");
    YKRun();
}
コード例 #9
0
ファイル: lab7app.c プロジェクト: davelindell/yak_kernel
void main(void)
{
    YKInitialize();

    charEvent = YKEventCreate(0);
    numEvent = YKEventCreate(0);
    YKNewTask(STask, (void *) &STaskStk[TASK_STACK_SIZE], 0);
    
    YKRun();
}
コード例 #10
0
ファイル: lab5app.c プロジェクト: PrgrmAtCeleritas/RTOS
void TaskStat(void)                /* a task to track statistics */
{
    unsigned max, switchCount, idleCount;
    int tmp;
        
    YKDelayTask(1);
    printString("Welcome to the YAK kernel\r\n");
    printString("Determining CPU capacity\r\n");
    YKDelayTask(1);
    YKIdleCount = 0;
    YKDelayTask(5);
    max = YKIdleCount / 25;
	
    YKIdleCount = 0;

    YKNewTask(TaskPrime, (void *) &TaskPRMStk[TASK_STACK_SIZE], 32);
    YKNewTask(TaskWord,  (void *) &TaskWStk[TASK_STACK_SIZE], 10);
    YKNewTask(TaskSpace, (void *) &TaskSStk[TASK_STACK_SIZE], 11);
    YKNewTask(TaskPunc,  (void *) &TaskPStk[TASK_STACK_SIZE], 12);
  
    while (1)
    {
        YKDelayTask(20);
        
        YKEnterMutex();
        switchCount = YKCtxSwCount;
        idleCount = YKIdleCount;
        YKExitMutex();
        
        printString ("<<<<< Context switches: ");
        printInt((int)switchCount);
        printString(", CPU usage: ");
        tmp = (int) (idleCount/max);
        printInt(100-tmp);
        printString("% >>>>>\r\n");
        
        YKEnterMutex();
        YKCtxSwCount = 0;
        YKIdleCount = 0;
        YKExitMutex();
    }
}   
コード例 #11
0
ファイル: lab7app.c プロジェクト: davelindell/yak_kernel
void STask(void)           /* tracks statistics */
{
    unsigned max, switchCount, idleCount;
    int tmp;

    YKDelayTask(1);
    printString("Welcome to the YAK kernel\r\n");
    printString("Determining CPU capacity\r\n");
    YKDelayTask(1);
    YKIdleCount = 0;
    YKDelayTask(5);
    max = YKIdleCount / 25;
    YKIdleCount = 0;

    YKNewTask(CharTask, (void *) &CharTaskStk[TASK_STACK_SIZE], 2);
    YKNewTask(AllNumsTask, (void *) &AllNumsTaskStk[TASK_STACK_SIZE], 1);
    YKNewTask(AllCharsTask, (void *) &AllCharsTaskStk[TASK_STACK_SIZE], 3);
    
    while (1)
    {
        YKDelayTask(20);
        
        YKEnterMutex();
        switchCount = YKCtxSwCount;
        idleCount = YKIdleCount;
        YKExitMutex();
        
        printString("<<<<< Context switches: ");
        printInt((int)switchCount);
        printString(", CPU usage: ");
        tmp = (int) (idleCount/max);
        printInt(100-tmp);
        printString("% >>>>>\r\n");
        
        YKEnterMutex();
        YKCtxSwCount = 0;
        YKIdleCount = 0;
        YKExitMutex();
    }
}   
コード例 #12
0
ファイル: lab8app.c プロジェクト: eaglewyng/YAK-RTOS
/*
 * tracks statistics
 */
void StatTask(void) {
    unsigned max, switchCount, idleCount;
    int tmp;
	
    YKDelayTask(1);
	
    printString("Welcome to the YAK kernel\r\n");
    printString("Determining CPU capacity\r\n");
    YKDelayTask(1);
    YKIdleCount = 0;
    YKDelayTask(5);
    max = YKIdleCount / 25;
    YKIdleCount = 0;
	
    YKNewTask(ArrivalTask, (void *) &ArrivalTaskStk[TASK_STACK_SIZE], 25);
    YKNewTask(CommunicationTask, (void *) &CommunicationTaskStk[TASK_STACK_SIZE], 20);
    
    while (1)
    {
        YKDelayTask(20);
        
        YKEnterMutex();
        switchCount = YKCtxSwCount;
        idleCount = YKIdleCount;
        YKExitMutex();
        
        printString("<CS: ");
        printInt((int)switchCount);
        printString(", CPU: ");
        tmp = (int) (idleCount/max);
        printInt(100-tmp);
        printString(">\r\n");
        
        YKEnterMutex();
        YKCtxSwCount = 0;
        YKIdleCount = 0;
        YKExitMutex();
    }
}
コード例 #13
0
ファイル: lab5app.c プロジェクト: PrgrmAtCeleritas/RTOS
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();
}
コード例 #14
0
ファイル: lab8app.c プロジェクト: eaglewyng/YAK-RTOS
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();
}
コード例 #15
0
ファイル: yakc.c プロジェクト: YazanHalawa/ECEn-425
void YKInitialize(void) {
	// Code to initialize global variables
	YKCtxSwCount = 0;
	YKIdleCount = 0;
	YKTickNum = 0;
	YKRun = 0;
	// Code to create doubly linked list
	YKAvailTCBList = &(YKTCBArray[0]);
    for (i = 1; i < MAX_TASKS; i++) {
		YKTCBArray[i].next = &(YKTCBArray[i+1]);
		YKTCBArray[i].prev = &(YKTCBArray[i-1]);
	}
	YKTCBArray[MAX_TASKS].next = NULL;
	YKTCBArray[0].prev = NULL;

	YKNewTask(YKIdleTask,  (void *)&YKIdleTask[IDLE_TASK_STACK_SIZE], MAX_TASKS);
}
コード例 #16
0
ファイル: yakc.c プロジェクト: nagneeve/ecen425
void YKInitialize(void) {

	YKEnterMutex();

	//Set up queues
	initializePriorityQueue(&readyQueue);
	initializeDelayQueue();

	//Set up Task Block
	taskBlock.nextFreeTCB == 0;
	//
		
	//Set up Idle Task
	YKNewTask(YKIdleTask, &idleTaskStack[IDLETASKSTACKSIZE], 100);
	//

	YKExitMutex();
	return;

}
コード例 #17
0
ファイル: yakc.c プロジェクト: fminor/minormoore
void YKInitialize() { /* Initializes all required kernel data structures */
	int i;
	TCBptr tempList;
//	printString("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
	activeTasks = 0;
	YKCtxSwCount = 0;
	YKIdleCount = 0;
	YKTickNum = 0;
	/* Set up TCB Lists */
	YKRdyList = NULL;
	YKSuspList = NULL;
	runningTask = NULL;
	YKAvailTCBList = YKTCBArray;
	YKTCBArray[0].prev = NULL;
	for(i = 0; i < MAXTASKS; i++){ /* put the YKTCBArray into the available TCB list */ // this doesn't work
		YKTCBArray[i].next = &YKTCBArray[i + 1];
		YKTCBArray[i + 1].prev = &YKTCBArray[i];
	}
	// Creates idle task
	YKNewTask(YKIdle, (void*)&IStk[ISTACKSIZE],255);

}