/*---------------------------------------------------------------------------*/ void dbg_ps (usys *stack) { usys *tmp = NULL, i ; tcb_t *task ; task = (tcb_t *) task_id_get() ; printf ("Task id is 0x%x\n", task->id) ; tmp = stack ; tmp += 20 ; printf ("Stack PTR = 0x%x\n", (usys) stack) ; for (i=0; i < 23; i++) { printf ("[0x%x] 0x%x\n", (usys) tmp, *tmp) ; tmp-- ; } printf ("\n") ; #if 0 while (1) ; #endif } /* End of function dbg_ps() */
static uint8_t TaskMsgQGet( taskproctype taskproc, MsgQ_t *queue ) { uint8_t taskId; /* Find the queue belonging to this task */ taskId = task_id_get( taskproc ); if ( taskId == NO_TID ) { return MSG_QUEUE_UNDEF; } *queue = os_task_msgQ_get( taskId ); if ( *queue == NO_QUEUE ) { return MSG_QUEUE_UNDEF; } return MSG_QUEUE_DEF; }
void pipe_test(void) { uint32_t putsize; int getsize; uint32_t puttime[3]; int putcount; int pipe; kpriority_t TaskPrio; int prio; GetInfo getinfo; task_sem_reset(SEM0); task_sem_give(STARTRCV); /* action: */ /* non-buffered operation, matching (ALL_N) */ PRINT_STRING(dashline, output_file); PRINT_STRING("| " "P I P E M E A S U R E M E N T S" " |\n", output_file); PRINT_STRING(dashline, output_file); PRINT_STRING("| Send data into a pipe towards a " "receiving high priority task and wait |\n", output_file); PRINT_STRING(dashline, output_file); PRINT_STRING("| " "matching sizes (_ALL_N)" " |\n", output_file); PRINT_STRING(dashline, output_file); PRINT_ALL_TO_N_HEADER_UNIT(); PRINT_STRING(dashline, output_file); PRINT_STRING("| put | get | no buf | small buf| big buf |" " no buf | small buf| big buf |\n", output_file); PRINT_STRING(dashline, output_file); for (putsize = 8; putsize <= MESSAGE_SIZE_PIPE; putsize <<= 1) { for (pipe = 0; pipe < 3; pipe++) { putcount = NR_OF_PIPE_RUNS; pipeput(TestPipes[pipe], _ALL_N, putsize, putcount, &puttime[pipe]); task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */ } PRINT_ALL_TO_N(); } PRINT_STRING(dashline, output_file); /* Test with two different sender priorities */ for (prio = 0; prio < 2; prio++) { /* non-buffered operation, non-matching (1_TO_N) */ if (prio == 0) { PRINT_STRING("| " "non-matching sizes (1_TO_N) to higher priority" " |\n", output_file); TaskPrio = task_priority_get(); } if (prio == 1) { PRINT_STRING("| " "non-matching sizes (1_TO_N) to lower priority" " |\n", output_file); task_priority_set(task_id_get(), TaskPrio - 2); } PRINT_STRING(dashline, output_file); PRINT_1_TO_N_HEADER(); PRINT_STRING("| put | get | no buf | small buf| big buf | " "no buf | small buf| big buf |\n", output_file); PRINT_STRING(dashline, output_file); for (putsize = 8; putsize <= (MESSAGE_SIZE_PIPE); putsize <<= 1) { putcount = MESSAGE_SIZE_PIPE / putsize; for (pipe = 0; pipe < 3; pipe++) { pipeput(TestPipes[pipe], _1_TO_N, putsize, putcount, &puttime[pipe]); /* size*count == MESSAGE_SIZE_PIPE */ task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */ getsize = getinfo.size; } PRINT_1_TO_N(); } PRINT_STRING(dashline, output_file); task_priority_set(task_id_get(), TaskPrio); } }
void task_kill( taskproctype taskproc ) { os_task_kill( task_id_get( taskproc ) ); }
TaskState_t task_state_get( taskproctype taskproc ) { uint8_t tid = task_id_get( taskproc ); os_assert( tid != NO_TID ); return task_list[ tid ].state; }