Exemplo n.º 1
0
Arquivo: task.c Projeto: foliern/lpel
/**
 * Startup function for user specified task,
 * calls task function with proper signature
 *
 * @param data  the previously allocated lpel_task_t TCB
 */
void TaskStartup( void *data)
{
  lpel_task_t *t = (lpel_task_t *)data;

#if 0
  unsigned long z;

  z = x<<16;
  z <<= 16;
  z |= y;
  t = (lpel_task_t *)z;
#endif
  TaskStart( t);

  /* call the task function with inarg as parameter */
  t->outarg = t->func(t->inarg);

  /* if task function returns, exit properly */
  t->state = TASK_ZOMBIE;
  LpelWorkerSelfTaskExit(t);
  TaskStop( t);
  LpelWorkerDispatcher( t);
  /* execution never comes back here */
  assert(0);
}
Exemplo n.º 2
0
Arquivo: task.c Projeto: foliern/lpel
/**
 * Block a task by reading from/writing to a stream
 */
void LpelTaskBlockStream(lpel_task_t *t)
{
  /* a reference to it is held in the stream */
  t->state = TASK_BLOCKED;
  LpelWorkerTaskBlock(t);
  TaskStop( t);
  LpelWorkerDispatcher( t);
  TaskStart( t);
}
Exemplo n.º 3
0
Arquivo: task.c Projeto: foliern/lpel
/**
 * Yield execution back to scheduler voluntarily
 *
 * @pre This call must be made from within a LPEL task!
 */
void LpelTaskYield(void)
{
  lpel_task_t *ct = LpelTaskSelf();
  assert( ct->state == TASK_RUNNING );

  ct->state = TASK_READY;
  LpelWorkerSelfTaskYield(ct);
  TaskStop( ct);
  LpelWorkerDispatcher( ct);
  TaskStart( ct);
}
Exemplo n.º 4
0
Arquivo: task.c Projeto: foliern/lpel
/**
 * Exit the current task
 *
 * @param outarg  output argument of the task
 * @pre This call must be made within a LPEL task!
 */
void LpelTaskExit(void *outarg)
{
  lpel_task_t *ct = LpelTaskSelf();
  assert( ct->state == TASK_RUNNING );

  ct->outarg = outarg;

  /* context switch happens, this task is cleaned up then */
  ct->state = TASK_ZOMBIE;
  LpelWorkerSelfTaskExit(ct);
  TaskStop( ct);
  LpelWorkerDispatcher( ct);
  /* execution never comes back here */
  assert(0);
}
Exemplo n.º 5
0
static void mpc5200_fec_stop_dma(void)
{
  TaskStop(FEC_RECV_TASK_NO);
  TaskStop(FEC_XMIT_TASK_NO);
}