Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void taskSELECT_HIGHEST_PRIORITY_TASK(){
- UBaseType_t EDFPriority = 1;
- TCB_t *tempTCB, *minTCB;
- int testCounter = 0;
- int length = listCURRENT_LIST_LENGTH(&(pxReadyTasksLists[EDFPriority]));
- int minToEnd = -1;
- for(int i=0; i<length; i++) {
- listGET_OWNER_OF_NEXT_ENTRY(tempTCB, &(pxReadyTasksLists[EDFPriority]));
- int tickPassed = xTickCount - tempTCB->start_time;
- if (tickPassed >= 0 && tickPassed % tempTCB->period == 0){
- tempTCB->pxTopOfStack = pxPortInitialiseStack( tempTCB->myStackVar, theFunc, tempTCB->pvParameter);
- tempTCB->run_time = 0;
- }
- if (tickPassed >= 0 && tempTCB->run_time < tempTCB->work_time) {
- int untilEnd = tempTCB->period - tickPassed % tempTCB->period;
- if (minToEnd == -1 || untilEnd < minToEnd) {
- minToEnd = untilEnd;
- minTCB = tempTCB;
- }
- }
- }
- if (minToEnd == -1) {
- pxCurrentTCB = listGET_OWNER_OF_HEAD_ENTRY(&( pxReadyTasksLists[0]));
- } else {
- minTCB->run_time++;
- pxCurrentTCB = minTCB;
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement