Esempio n. 1
0
void nrk_create_taskset ()
{


    RX_TASK.task = rx_task;
    nrk_task_set_stk (&RX_TASK, rx_task_stack, NRK_APP_STACKSIZE);
    RX_TASK.prio = 2;
    RX_TASK.FirstActivation = TRUE;
    RX_TASK.Type = BASIC_TASK;
    RX_TASK.SchType = PREEMPTIVE;
    RX_TASK.period.secs = 1;
    RX_TASK.period.nano_secs = 0;
    RX_TASK.cpu_reserve.secs = 1;
    RX_TASK.cpu_reserve.nano_secs = 0;
    RX_TASK.offset.secs = 0;
    RX_TASK.offset.nano_secs = 0;
    nrk_activate_task (&RX_TASK);

    TX_TASK.task = tx_task;
    nrk_task_set_stk (&TX_TASK, tx_task_stack, NRK_APP_STACKSIZE);
    TX_TASK.prio = 3;
    TX_TASK.FirstActivation = TRUE;
    TX_TASK.Type = BASIC_TASK;
    TX_TASK.SchType = PREEMPTIVE;
    TX_TASK.period.secs = 1;
    TX_TASK.period.nano_secs = 0;
    TX_TASK.cpu_reserve.secs = 1;
    TX_TASK.cpu_reserve.nano_secs = 0;
    TX_TASK.offset.secs = 0;
    TX_TASK.offset.nano_secs = 0;
    nrk_activate_task (&TX_TASK);

}
Esempio n. 2
0
void nrk_create_taskset ()
{
  //priority of all 4 tasks was initially (1-4): 
  //GridEye, GPS, Task 1, Task 3
  TaskOne.task = Task1;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 2;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 0;
  TaskOne.period.nano_secs = 10 * NANOS_PER_MS;//changed from 5 to 150
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs = 0 * NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs = 0;
  nrk_activate_task (&TaskOne);

  TASK_GPS.task = TaskGPS;
  nrk_task_set_stk( &TASK_GPS, StackGPS, NRK_APP_STACKSIZE);
  TASK_GPS.prio = 3;
  TASK_GPS.FirstActivation = TRUE;
  TASK_GPS.Type = BASIC_TASK;
  TASK_GPS.SchType = PREEMPTIVE;
  TASK_GPS.period.secs = 0;
  TASK_GPS.period.nano_secs = 10 * NANOS_PER_MS; //change from 50 to 150
  TASK_GPS.cpu_reserve.secs = 0;
  TASK_GPS.cpu_reserve.nano_secs = 0;
  TASK_GPS.offset.secs = 0;
  TASK_GPS.offset.nano_secs = 0;
  nrk_activate_task (&TASK_GPS);

  TaskThree.task = Task3;
  nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
  TaskThree.prio = 2;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 0;
  TaskThree.period.nano_secs = 10 * NANOS_PER_MS;//changed from 250 to 150
  TaskThree.cpu_reserve.secs = 1;
  TaskThree.cpu_reserve.nano_secs = 0;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs = 0;
  nrk_activate_task (&TaskThree);

 TASK_GRIDEYE.task = TaskGridEYE;
  nrk_task_set_stk( &TASK_GRIDEYE, StackGridEYE, NRK_APP_STACKSIZE);
  TASK_GRIDEYE.prio = 1;
  TASK_GRIDEYE.FirstActivation = TRUE;
  TASK_GRIDEYE.Type = BASIC_TASK;
  TASK_GRIDEYE.SchType = PREEMPTIVE;
  TASK_GRIDEYE.period.secs = 0;
  TASK_GRIDEYE.period.nano_secs = 150*NANOS_PER_MS; //*NANOS_PER_MS; //changed 50 to 150
  TASK_GRIDEYE.cpu_reserve.secs = 0;
  TASK_GRIDEYE.cpu_reserve.nano_secs =  0;//200*NANOS_PER_MS;
  TASK_GRIDEYE.offset.secs = 0;
  TASK_GRIDEYE.offset.nano_secs= 0;
  nrk_activate_task (&TASK_GRIDEYE);
}
Esempio n. 3
0
void
nrk_create_taskset()
{
  TaskOne.task = rx_task;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 10;
  TaskOne.period.nano_secs = 250*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs =  50*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  TaskTwo.task = tx_task;
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 0;
  TaskTwo.period.nano_secs = 500*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);


}
Esempio n. 4
0
void
nrk_create_taskset()
{
  TaskOne.task = print_sensor_readings;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 2;
  TaskOne.period.nano_secs = 0;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs = 0;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  nrk_task_set_entry_function( &TaskTwo, collect_Audio_Data);
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 2;
  TaskTwo.period.nano_secs = 0;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 0;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);
}
Esempio n. 5
0
File: main.c Progetto: nycdarren/mrk
void nrk_create_taskset ()
{
    nrk_task_set_entry_function (&rx_task_info, rx_task);
    nrk_task_set_stk (&rx_task_info, rx_task_stack, NRK_APP_STACKSIZE);
    rx_task_info.prio = 1;
    rx_task_info.FirstActivation = TRUE;
    rx_task_info.Type = BASIC_TASK;
    rx_task_info.SchType = PREEMPTIVE;
    rx_task_info.period.secs = 0;
    rx_task_info.period.nano_secs = 250 * NANOS_PER_MS;
    rx_task_info.cpu_reserve.secs = 0;
    rx_task_info.cpu_reserve.nano_secs = 100 * NANOS_PER_MS;
    rx_task_info.offset.secs = 0;
    rx_task_info.offset.nano_secs = 0;
    nrk_activate_task (&rx_task_info);

    nrk_task_set_entry_function (&tx_task_info, tx_task);
    nrk_task_set_stk (&tx_task_info, tx_task_stack, NRK_APP_STACKSIZE);
    tx_task_info.prio = 1;
    tx_task_info.FirstActivation = TRUE;
    tx_task_info.Type = BASIC_TASK;
    tx_task_info.SchType = PREEMPTIVE;
    tx_task_info.period.secs = 0;
    tx_task_info.period.nano_secs = 250 * NANOS_PER_MS;
    tx_task_info.cpu_reserve.secs = 0;
    tx_task_info.cpu_reserve.nano_secs = 100 * NANOS_PER_MS;
    tx_task_info.offset.secs = 0;
    tx_task_info.offset.nano_secs = 0;
    nrk_activate_task (&tx_task_info);

    tdma_task_config ();

}
Esempio n. 6
0
void nrk_create_taskset()
{
  type_task_snd.task = task_snd;
  nrk_task_set_stk( &type_task_snd, stack_task_snd, NRK_APP_STACKSIZE);
  type_task_snd.prio = SND_TASK_PRIO;
  type_task_snd.FirstActivation = TRUE;
  type_task_snd.Type = BASIC_TASK;
  type_task_snd.SchType = PREEMPTIVE;
  type_task_snd.period.secs = 0;
  type_task_snd.period.nano_secs = SND_TASK_PERIOD_ms*NANOS_PER_MS;
  type_task_snd.cpu_reserve.secs = 0;
  type_task_snd.cpu_reserve.nano_secs = 0; //SND_TASK_RESERVE_ms*NANOS_PER_MS;
  type_task_snd.offset.secs = 0;
  type_task_snd.offset.nano_secs= 0;
  nrk_activate_task (&type_task_snd);

  type_task_rcv.task = task_rcv;
  nrk_task_set_stk( &type_task_rcv, stack_task_rcv, NRK_APP_STACKSIZE);
  type_task_rcv.prio = RCV_TASK_PRIO;
  type_task_rcv.FirstActivation = TRUE;
  type_task_rcv.Type = BASIC_TASK;
  type_task_rcv.SchType = PREEMPTIVE;
  type_task_rcv.period.secs = 0;
  type_task_rcv.period.nano_secs = RCV_TASK_PERIOD_ms*NANOS_PER_MS;
  type_task_rcv.cpu_reserve.secs = 0;
  type_task_rcv.cpu_reserve.nano_secs = 0; //RCV_TASK_RESERVE_ms*NANOS_PER_MS;
  type_task_rcv.offset.secs = 0;
  type_task_rcv.offset.nano_secs= 0;
  nrk_activate_task (&type_task_rcv);
}
Esempio n. 7
0
File: main.c Progetto: vishnudh/RTOS
void
nrk_create_taskset()
{
  nrk_task_set_entry_function( &TaskOne, Task1);
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
#ifdef NRK_EDF
  TaskOne.SchType = EDF;
#else
TaskOne.SchType = PREEMPTIVE;
#endif
  TaskOne.period.secs = 6;
  TaskOne.period.nano_secs = 0*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 6;
  TaskOne.cpu_reserve.nano_secs = 0*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  nrk_task_set_entry_function( &TaskTwo, Task2);
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
#ifdef NRK_EDF
  TaskOne.SchType = EDF;
#else
TaskOne.SchType = PREEMPTIVE;
#endif

TaskTwo.period.secs = 12;
  TaskTwo.period.nano_secs = 0*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 12;
  TaskTwo.cpu_reserve.nano_secs = 0*NANOS_PER_MS;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);

  nrk_task_set_entry_function( &TaskThree, Task3);
  nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
  TaskThree.prio = 3;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
#ifdef NRK_EDF
  TaskOne.SchType = EDF;
#else
TaskOne.SchType = PREEMPTIVE;
#endif
  TaskThree.period.secs = 9;
  TaskThree.period.nano_secs = 0;
  TaskThree.cpu_reserve.secs = 8;
  TaskThree.cpu_reserve.nano_secs = 0*NANOS_PER_MS;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs= 0;
  nrk_activate_task (&TaskThree);
  return;
}
Esempio n. 8
0
void nrk_create_taskset ()
{
  TaskOne.task = Task1;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 1;
  TaskOne.period.nano_secs = 500 * NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs = 0;
  nrk_activate_task (&TaskOne);

  TaskTwo.task = Task2;
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 0;
  TaskTwo.period.nano_secs = 250 * NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 0;
  //TaskTwo.cpu_reserve.nano_secs = 100 * NANOS_PER_MS;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs = 0;
  nrk_activate_task (&TaskTwo);

  TaskThree.task = Task3;
  TaskThree.Ptos = (void *) &Stack3[NRK_APP_STACKSIZE - 1];
  TaskThree.Pbos = (void *) &Stack3[0];
  TaskThree.prio = 3;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 0;
  TaskThree.period.nano_secs = 250 * NANOS_PER_MS;
  TaskThree.cpu_reserve.secs = 0;
  TaskThree.cpu_reserve.nano_secs = 200 * NANOS_PER_MS;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs = 0;
  nrk_activate_task (&TaskThree);



}
Esempio n. 9
0
void nrk_create_taskset ()
{


  RX_TASK.task = rx_task;
  nrk_task_set_stk( &RX_TASK, rx_task_stack, NRK_APP_STACKSIZE);
  RX_TASK.prio = 3;
  RX_TASK.FirstActivation = TRUE;
  RX_TASK.Type = BASIC_TASK;
  RX_TASK.SchType = PREEMPTIVE;
  RX_TASK.period.secs = 0;
  RX_TASK.period.nano_secs = 500 *NANOS_PER_MS;
  RX_TASK.cpu_reserve.secs = 1;
  RX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
  RX_TASK.offset.secs = 0;
  RX_TASK.offset.nano_secs = 0;
  nrk_activate_task (&RX_TASK);

  TX_TASK.task = tx_task;
  nrk_task_set_stk( &TX_TASK, tx_task_stack, NRK_APP_STACKSIZE);
  TX_TASK.prio = 2;
  TX_TASK.FirstActivation = TRUE;
  TX_TASK.Type = BASIC_TASK;
  TX_TASK.SchType = PREEMPTIVE;
  TX_TASK.period.secs = 1;
  TX_TASK.period.nano_secs = 0;
  TX_TASK.cpu_reserve.secs = 1;
  TX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
  TX_TASK.offset.secs = 0;
  TX_TASK.offset.nano_secs = 0;
  nrk_activate_task (&TX_TASK);
  /*
  INTER_TX_TASK.task = inter_tx_task;
  nrk_task_set_stk( &INTER_TX_TASK, inter_tx_task_stack, NRK_APP_STACKSIZE);
  INTER_TX_TASK.prio = 2;
  INTER_TX_TASK.FirstActivation = TRUE;
  INTER_TX_TASK.Type = BASIC_TASK;
  INTER_TX_TASK.SchType = PREEMPTIVE;
  INTER_TX_TASK.period.secs = 1;
  INTER_TX_TASK.period.nano_secs = 0;
  INTER_TX_TASK.cpu_reserve.secs = 1;
  INTER_TX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
  INTER_TX_TASK.offset.secs = 0;
  INTER_TX_TASK.offset.nano_secs = 0;
  nrk_activate_task (&INTER_TX_TASK);
*/
  printf ("Create done\r\n");
}
Esempio n. 10
0
void nrk_create_taskset ()
{


  RX_TASK.task = rx_task;
  nrk_task_set_stk (&RX_TASK, rx_task_stack, NRK_APP_STACKSIZE);
  RX_TASK.prio = 2;
  RX_TASK.FirstActivation = TRUE;
  RX_TASK.Type = BASIC_TASK;
  RX_TASK.SchType = PREEMPTIVE;
  RX_TASK.period.secs = 0;
  RX_TASK.period.nano_secs = 100 * NANOS_PER_MS;
  RX_TASK.cpu_reserve.secs = 0;
  RX_TASK.cpu_reserve.nano_secs = 0;
  RX_TASK.offset.secs = 0;
  RX_TASK.offset.nano_secs = 0;
  nrk_activate_task (&RX_TASK);

  TX_TASK.task = tx_task;
  nrk_task_set_stk (&TX_TASK, tx_task_stack, NRK_APP_STACKSIZE);
  TX_TASK.prio = 2;
  TX_TASK.FirstActivation = TRUE;
  TX_TASK.Type = BASIC_TASK;
  TX_TASK.SchType = PREEMPTIVE;
  TX_TASK.period.secs = 1;
  TX_TASK.period.nano_secs = 0;
  TX_TASK.cpu_reserve.secs = 0;
  TX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
  TX_TASK.offset.secs = 0;
  TX_TASK.offset.nano_secs = 0;
  nrk_activate_task (&TX_TASK);

  nrk_task_set_entry_function( &SYNT_TASK_T, synt_task);
  nrk_task_set_stk( &SYNT_TASK_T, synt_task_stack, NRK_APP_STACKSIZE);
  SYNT_TASK_T.prio = 1;
  SYNT_TASK_T.FirstActivation = TRUE;
  SYNT_TASK_T.Type = BASIC_TASK;
  SYNT_TASK_T.SchType = PREEMPTIVE;
  SYNT_TASK_T.period.secs = 0;
  SYNT_TASK_T.period.nano_secs = 500*NANOS_PER_MS;
  SYNT_TASK_T.cpu_reserve.secs = 0;
  SYNT_TASK_T.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  SYNT_TASK_T.offset.secs = 0;
  SYNT_TASK_T.offset.nano_secs= 0;
  nrk_activate_task (&SYNT_TASK_T);


}
Esempio n. 11
0
void
nrk_create_taskset()
{
  nrk_task_set_entry_function( &TaskOne, Task_Accelorometer);
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 0;
  TaskOne.period.nano_secs = 250*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs = 250*NANOS_PER_MS;
  TaskOne.offset.secs = 1;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  nrk_task_set_entry_function( &TaskTwo, Task_Gyro);
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 0;
  TaskTwo.period.nano_secs = 250*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 250*NANOS_PER_MS;
  TaskTwo.offset.secs = 1;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);

  nrk_task_set_entry_function( &TaskThree, Task_Magneto);
  nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
  TaskThree.prio = 3;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 0;
  TaskThree.period.nano_secs = 250*NANOS_PER_MS;
  TaskThree.cpu_reserve.secs = 0;
  TaskThree.cpu_reserve.nano_secs = 0*NANOS_PER_MS;
  TaskThree.offset.secs = 1;
  TaskThree.offset.nano_secs= 0;
  nrk_activate_task (&TaskThree);
}
Esempio n. 12
0
File: main.c Progetto: nycdarren/mrk
void nrk_create_taskset ()
{
    TX_TASK.task = tx_task;
    nrk_task_set_stk (&TX_TASK, tx_task_stack, NRK_APP_STACKSIZE);
    TX_TASK.prio = 2;
    TX_TASK.FirstActivation = TRUE;
    TX_TASK.Type = BASIC_TASK;
    TX_TASK.SchType = PREEMPTIVE;
    TX_TASK.period.secs = 10;
    TX_TASK.period.nano_secs = 0;
    TX_TASK.cpu_reserve.secs = 1;
    TX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
    TX_TASK.offset.secs = 0;
    TX_TASK.offset.nano_secs = 0;
    nrk_activate_task (&TX_TASK);

    RX_TASK.task = rx_task;
    nrk_task_set_stk (&RX_TASK, rx_task_stack, NRK_APP_STACKSIZE);
    RX_TASK.prio = 3;
    RX_TASK.FirstActivation = TRUE;
    RX_TASK.Type = BASIC_TASK;
    RX_TASK.SchType = PREEMPTIVE;
    RX_TASK.period.secs = 10;
    RX_TASK.period.nano_secs = 0;
    RX_TASK.cpu_reserve.secs = 1;
    RX_TASK.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
    RX_TASK.offset.secs = 0;
    RX_TASK.offset.nano_secs = 0;
    nrk_activate_task (&RX_TASK);

    CYCLING_TASK.task = cycling_task;
    nrk_task_set_stk(&CYCLING_TASK, cycling_task_stack, NRK_APP_STACKSIZE);
    CYCLING_TASK.prio = 1;
    CYCLING_TASK.FirstActivation = TRUE;
    CYCLING_TASK.Type = BASIC_TASK;
    CYCLING_TASK.SchType = PREEMPTIVE;
    CYCLING_TASK.period.secs = 0;
    CYCLING_TASK.period.nano_secs = 100 * NANOS_PER_MS;
    CYCLING_TASK.cpu_reserve.secs = 1;
    CYCLING_TASK.cpu_reserve.nano_secs = 50 * NANOS_PER_MS;
    CYCLING_TASK.offset.secs = 0;
    CYCLING_TASK.offset.nano_secs = 0;
    nrk_activate_task(&CYCLING_TASK);
}
Esempio n. 13
0
void
nrk_create_taskset()
{
    nrk_task_set_entry_function( &TaskOne, Task1);
    nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
    TaskOne.prio = 1;
    TaskOne.FirstActivation = TRUE;
    TaskOne.Type = BASIC_TASK;
    TaskOne.SchType = PREEMPTIVE;
    TaskOne.period.secs = 5;
    TaskOne.period.nano_secs = 250*NANOS_PER_MS;
    TaskOne.cpu_reserve.secs = 1;
    TaskOne.cpu_reserve.nano_secs = 50*NANOS_PER_MS;
    TaskOne.offset.secs = 0;
    TaskOne.offset.nano_secs= 0;
    nrk_activate_task (&TaskOne);
}
Esempio n. 14
0
void nrk_create_taskset ()
{
  MOBILE_TASK.task = tx_task;
  nrk_task_set_stk (&MOBILE_TASK, mobile_task_stack, NRK_APP_STACKSIZE);
  MOBILE_TASK.prio = 2;
  MOBILE_TASK.FirstActivation = TRUE;
  MOBILE_TASK.Type = BASIC_TASK;
  MOBILE_TASK.SchType = PREEMPTIVE;
  MOBILE_TASK.period.secs = 0;
  MOBILE_TASK.period.nano_secs = 200 * NANOS_PER_MS;
  MOBILE_TASK.cpu_reserve.secs = 0;
  MOBILE_TASK.cpu_reserve.nano_secs = 200 * NANOS_PER_MS;
  MOBILE_TASK.offset.secs = 0;
  MOBILE_TASK.offset.nano_secs = 0;
  nrk_activate_task (&MOBILE_TASK);

}
Esempio n. 15
0
void nrk_create_taskset ()
{
  WHACKY_TASK.task = whacky_task;
  nrk_task_set_stk( &WHACKY_TASK, whacky_task_stack, NRK_APP_STACKSIZE);
  WHACKY_TASK.prio = 2;
  WHACKY_TASK.FirstActivation = TRUE;
  WHACKY_TASK.Type = BASIC_TASK;
  WHACKY_TASK.SchType = PREEMPTIVE;
  WHACKY_TASK.period.secs = 2;
  WHACKY_TASK.period.nano_secs = 0;
  WHACKY_TASK.cpu_reserve.secs = 2;
  WHACKY_TASK.cpu_reserve.nano_secs = 0;
  WHACKY_TASK.offset.secs = 0;
  WHACKY_TASK.offset.nano_secs = 0;
  nrk_activate_task (&WHACKY_TASK);

  printf ("Create done\r\n");
}
Esempio n. 16
0
void
nrk_create_taskset()
{
  TaskOne.task = Task1;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 0;
  TaskOne.period.nano_secs = 5*NANOS_PER_MS;
  // Disable reserve
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs =  0;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

}
Esempio n. 17
0
void bmac_task_config ()
{
    nrk_task_set_entry_function( &bmac_task, bmac_nw_task);
    nrk_task_set_stk( &bmac_task, bmac_task_stack, BMAC_STACKSIZE);
    bmac_task.prio = BMAC_TASK_PRIORITY;
    bmac_task.FirstActivation = TRUE;
    bmac_task.Type = BASIC_TASK;
    bmac_task.SchType = PREEMPTIVE;
    bmac_task.period.secs = 0;
    bmac_task.period.nano_secs = BMAC_MIN_CHECK_RATE_MS * NANOS_PER_MS;
    bmac_task.cpu_reserve.secs = 5;      // bmac reserve , 0 to disable
    bmac_task.cpu_reserve.nano_secs = 0;
    bmac_task.offset.secs = 0;
    bmac_task.offset.nano_secs = 0;
#ifdef DEBUG
    printf( "bmac activate\r\n" );
#endif
    nrk_activate_task (&bmac_task);
}
Esempio n. 18
0
//Create all the tasks
void nrk_create_taskset ()
{


    RX_TASK.task = rx_task;
    nrk_task_set_stk( &RX_TASK, rx_task_stack, NRK_APP_STACKSIZE);
    RX_TASK.prio = 10;
    RX_TASK.FirstActivation = TRUE;
    RX_TASK.Type = BASIC_TASK;
    RX_TASK.SchType = PREEMPTIVE;
    RX_TASK.period.secs = 1;
    RX_TASK.period.nano_secs =0;
    RX_TASK.cpu_reserve.secs = 0;
    RX_TASK.cpu_reserve.nano_secs = 200 * NANOS_PER_MS;
    RX_TASK.offset.secs = 0;
    RX_TASK.offset.nano_secs = 0;
    

    TX_TASK.task = tx_task;
    nrk_task_set_stk( &TX_TASK, tx_task_stack, NRK_APP_STACKSIZE);
    TX_TASK.prio = 10;
    TX_TASK.FirstActivation = TRUE;
    TX_TASK.Type = BASIC_TASK;
    TX_TASK.SchType = PREEMPTIVE;
    TX_TASK.period.secs = 1;
    TX_TASK.period.nano_secs = 0;
    TX_TASK.cpu_reserve.secs = 0;
    TX_TASK.cpu_reserve.nano_secs = 200 * NANOS_PER_MS;
    TX_TASK.offset.secs = 0;
    TX_TASK.offset.nano_secs = 0;
    

    RE_TX_TASK.task = re_tx_task;
    nrk_task_set_stk( &RE_TX_TASK, re_tx_task_stack, NRK_APP_STACKSIZE);
    RE_TX_TASK.prio = 1;
    RE_TX_TASK.FirstActivation = TRUE;
    RE_TX_TASK.Type = BASIC_TASK;
    RE_TX_TASK.SchType = PREEMPTIVE;
    RE_TX_TASK.period.secs = 2;
    RE_TX_TASK.period.nano_secs = 0;
    RE_TX_TASK.cpu_reserve.secs = 0;
    RE_TX_TASK.cpu_reserve.nano_secs = 100 * NANOS_PER_MS;
    RE_TX_TASK.offset.secs = 0;
    RE_TX_TASK.offset.nano_secs = 0;
    


    ACK_TX_TASK.task = ack_tx_task;
    nrk_task_set_stk( &ACK_TX_TASK, ack_tx_task_stack, NRK_APP_STACKSIZE);
    ACK_TX_TASK.prio = 1;
    ACK_TX_TASK.FirstActivation = TRUE;
    ACK_TX_TASK.Type = BASIC_TASK;
    ACK_TX_TASK.SchType = PREEMPTIVE;
    ACK_TX_TASK.period.secs = 1;
    ACK_TX_TASK.period.nano_secs = 0;
    ACK_TX_TASK.cpu_reserve.secs = 0;
    ACK_TX_TASK.cpu_reserve.nano_secs = 100 * NANOS_PER_MS;
    ACK_TX_TASK.offset.secs = 0;
    ACK_TX_TASK.offset.nano_secs = 0;


    nrk_activate_task (&RX_TASK);
    nrk_activate_task (&TX_TASK);
    nrk_activate_task (&RE_TX_TASK);
    nrk_activate_task (&ACK_TX_TASK);



    printf ("Create done\r\n");
}
Esempio n. 19
0
void
nrk_create_taskset()
{
int8_t val;

  nrk_task_set_entry_function( &TaskOne, Task1);
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 1;
  TaskOne.period.nano_secs = 0*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs =  50*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  nrk_task_set_entry_function( &TaskTwo, Task2);
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 10;
  TaskTwo.period.nano_secs = 500*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 10;
  TaskTwo.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);


  nrk_task_set_entry_function( &TaskThree, Task3);
  nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
  TaskThree.prio = 2;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 10;
  TaskThree.period.nano_secs = 0;
  TaskThree.cpu_reserve.secs = 0;
  TaskThree.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs= 0;
  nrk_activate_task (&TaskThree);


  nrk_task_set_entry_function( &TaskFour, Task4);
  nrk_task_set_stk( &TaskFour, Stack4, NRK_APP_STACKSIZE);
  TaskFour.prio = 2;
  TaskFour.FirstActivation = TRUE;
  TaskFour.Type = BASIC_TASK;
  TaskFour.SchType = PREEMPTIVE;
  TaskFour.period.secs = 2;
  TaskFour.period.nano_secs = 0;
  TaskFour.cpu_reserve.secs = 1;
  TaskFour.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskFour.offset.secs = 0;
  TaskFour.offset.nano_secs= 0;
  nrk_activate_task (&TaskFour);

  val=nrk_register_driver( &dev_manager_ff_sensors,FIREFLY_SENSOR_BASIC);
  if(val==NRK_ERROR) nrk_kprintf( PSTR("Failed to load my ADC driver\r\n") );

}
Esempio n. 20
0
void nrk_init()
{
	
    uint8_t i;	
//    unsigned char *stkc;
	
   nrk_task_type IdleTask;
   nrk_wakeup_signal = nrk_signal_create();
   if(nrk_wakeup_signal==NRK_ERROR) nrk_kernel_error_add(NRK_SIGNAL_CREATE_ERROR,0);
	
   //if((volatile)TCCR1B!=0) nrk_kernel_error_add(NRK_STACK_OVERFLOW,0); 
   /*
   if(_nrk_startup_ok()==0) nrk_kernel_error_add(NRK_BAD_STARTUP,0); 
   #ifdef NRK_STARTUP_VOLTAGE_CHECK
   	if(nrk_voltage_status()==0) nrk_kernel_error_add(NRK_LOW_VOLTAGE,0);
   #endif

   #ifdef NRK_REBOOT_ON_ERROR
   #ifndef NRK_WATCHDOG
   while(1)
   {
     nrk_kprintf( PSTR("KERNEL CONFIG CONFLICT:  NRK_REBOOT_ON_ERROR needs watchdog!\r\n") );
     for (i = 0; i < 100; i++)
       nrk_spin_wait_us (1000);
   }
   #endif
   #endif

    #ifdef NRK_WATCHDOG
    if(nrk_watchdog_check()==NRK_ERROR) 
	{
    	nrk_watchdog_disable();
	nrk_kernel_error_add(NRK_WATCHDOG_ERROR,0);
	}
    nrk_watchdog_enable();
    #endif
  
  // nrk_stack_pointer_init(); 

    */
    nrk_cur_task_prio = 0;
    nrk_cur_task_TCB = NULL;
    
    nrk_high_ready_TCB = NULL;
    nrk_high_ready_prio = 0;
    /* 

    #ifdef NRK_MAX_RESERVES 
    // Setup the reserve structures
    _nrk_reserve_init();
    #endif
      */
    _nrk_resource_cnt=0; //NRK_MAX_RESOURCE_CNT;
    
    //PAJA: CHECK THIS
    for(i=0;i<NRK_MAX_RESOURCE_CNT;i++)
    {
      nrk_sem_list[i].count=-1;
      nrk_sem_list[i].value=-1;
      nrk_sem_list[i].resource_ceiling=-1;
      //nrk_resource_count[i]=-1;
      //nrk_resource_value[i]=-1;
      //nrk_resource_ceiling[i]=-1;
      
    }  
//////    //PAJA: CHECK THIS
//////    for (i= 0; i<NRK_MAX_TASKS_TCB; i++)
//////    {
//////      nrk_task_TCB[i].task_prio = TCB_EMPTY_PRIO;
//////      nrk_task_TCB[i].task_ID = -1;
//////      nrk_task_TCB[i].Next = NULL;        //PAJA:check this
//////      nrk_task_TCB[i].Prev = NULL;
//////    }
//////    
//////    _headTCB = &nrk_task_TCB[0];
//////    _tailTCB = _headTCB;
    tasksNumber = 1;        //idle tasks
    nrk_task_init_cnt = 1;
    
    nrk_task_TCB.task_prio = TCB_EMPTY_PRIO;
    nrk_task_TCB.task_ID = -1;
    nrk_task_TCB.Next = NULL;        //PAJA:check this
    nrk_task_TCB.Prev = NULL;
    
    _headTCB = &nrk_task_TCB;
    _tailTCB = _headTCB;
    
    
    // Setup a double linked list of Ready Tasks 
    for (i=0;i<NRK_MAX_TASKS;i++)
    {
      _nrk_readyQ[i].Next	=	&_nrk_readyQ[i+1];
      _nrk_readyQ[i+1].Prev	=	&_nrk_readyQ[i];
    }
    
    _nrk_readyQ[0].Prev	=	      NULL; 
    _nrk_readyQ[NRK_MAX_TASKS].Next = NULL;
    _head_node = NULL;
    _free_node = &_nrk_readyQ[0];
	
    
    
    nrk_task_set_entry_function( &IdleTask, (uint32_t)nrk_idle_task);
    nrk_task_set_stk( &IdleTask, nrk_idle_task_stk, NRK_TASK_IDLE_STK_SIZE);
    nrk_idle_task_stk[0]=STK_CANARY_VAL;	
    //IdleTask.task_ID = NRK_IDLE_TASK_ID;
    IdleTask.prio = 0;
    IdleTask.offset.secs = 0;
    IdleTask.offset.nano_secs = 0;
    IdleTask.FirstActivation = TRUE;
    IdleTask.Type = IDLE_TASK;
    IdleTask.SchType = PREEMPTIVE;
    nrk_activate_task(&IdleTask);
    
}
Esempio n. 21
0
/**
 *  nrk_init();
 * *  - Init TCBlist - linked list of empty TCBs
 *  - Init global variables
 *  - Init event list
 *  - Create idle task
 */
void nrk_init()
{
	
    uint8_t i;	
//    unsigned char *stkc;
	
   nrk_task_type IdleTask;
   nrk_wakeup_signal = nrk_signal_create();
   if(nrk_wakeup_signal==NRK_ERROR) nrk_kernel_error_add(NRK_SIGNAL_CREATE_ERROR,0);
   //if((volatile)TCCR1B!=0) nrk_kernel_error_add(NRK_STACK_OVERFLOW,0); 
#ifndef NRK_SOFT_REBOOT_ON_ERROR
   i=_nrk_startup_error();
   if((i&0x1)!=0) nrk_kernel_error_add(NRK_BAD_STARTUP,0);
#ifndef IGNORE_EXT_RST_ERROR
   if((i&0x2)!=0) nrk_kernel_error_add(NRK_EXT_RST_ERROR,0);
#endif
#ifndef IGNORE_BROWN_OUT_ERROR
   if((i&0x4)!=0) nrk_kernel_error_add(NRK_BOD_ERROR,0);
#endif
   //if((i&0x8)!=0) nrk_kernel_error_add(NRK_BAD_STARTUP,0);

   //if(_nrk_startup_ok()==0) nrk_kernel_error_add(NRK_BAD_STARTUP,0); 
#endif

   #ifdef NRK_STARTUP_VOLTAGE_CHECK
   	if(nrk_voltage_status()==0) nrk_kernel_error_add(NRK_LOW_VOLTAGE,0);
   #endif




   #ifdef NRK_REBOOT_ON_ERROR
   #ifndef NRK_WATCHDOG
   while(1)
	   {
		nrk_kprintf( PSTR("KERNEL CONFIG CONFLICT:  NRK_REBOOT_ON_ERROR needs watchdog!\r\n") );
    		for (i = 0; i < 100; i++)
      			nrk_spin_wait_us (1000);
	   }
   #endif
   #endif

   #ifdef NRK_WATCHDOG
    if(nrk_watchdog_check()==NRK_ERROR) 
	{
    	nrk_watchdog_disable();
	nrk_kernel_error_add(NRK_WATCHDOG_ERROR,0);
	}
    nrk_watchdog_enable();
    #endif
  
  // nrk_stack_pointer_init(); 
/* 
    #ifdef KERNEL_STK_ARRAY
	stkc = (uint16_t*)&nrk_kernel_stk[NRK_KERNEL_STACKSIZE-1];
	nrk_kernel_stk[0]=STK_CANARY_VAL;
    	nrk_kernel_stk_ptr = &nrk_kernel_stk[NRK_KERNEL_STACKSIZE-1];
    #else
    	stkc = NRK_KERNEL_STK_TOP-NRK_KERNEL_STACKSIZE;
    	*stkc = STK_CANARY_VAL;
    	stkc = NRK_KERNEL_STK_TOP;
	nrk_kernel_stk_ptr = NRK_KERNEL_STK_TOP;
    #endif
    *stkc++ = (uint16_t)((uint16_t)_nrk_timer_tick>>8);
    *stkc = (uint16_t)((uint16_t)_nrk_timer_tick&0xFF); 
*/	
 
   // printf( "Init kernel_entry= %d %d\n",kernel_entry[1], kernel_entry[0] );

    
    nrk_cur_task_prio = 0;
    nrk_cur_task_TCB = NULL;
    
    nrk_high_ready_TCB = NULL;
    nrk_high_ready_prio = 0; 

   #ifdef NRK_STATS_TRACKER
	nrk_stats_reset();
   #endif

    #ifdef NRK_MAX_RESERVES 
    // Setup the reserve structures
    _nrk_reserve_init();
    #endif

    _nrk_resource_cnt=0; //NRK_MAX_RESOURCE_CNT;

for(i=0;i<NRK_MAX_RESOURCE_CNT;i++)
{
    nrk_sem_list[i].count=-1;
    nrk_sem_list[i].value=-1;
    nrk_sem_list[i].resource_ceiling=-1;
    //nrk_resource_count[i]=-1;
    //nrk_resource_value[i]=-1;
    //nrk_resource_ceiling[i]=-1;
    
}        
    for (i= 0; i<NRK_MAX_TASKS; i++)
	{
        nrk_task_TCB[i].task_prio = TCB_EMPTY_PRIO;
        nrk_task_TCB[i].task_ID = -1; 
        }
  
       
    // Setup a double linked list of Ready Tasks 
    for (i=0;i<NRK_MAX_TASKS;i++)
	{
		_nrk_readyQ[i].Next	=	&_nrk_readyQ[i+1];
		_nrk_readyQ[i+1].Prev	=	&_nrk_readyQ[i];
	}
	
	_nrk_readyQ[0].Prev	=	NULL;
	_nrk_readyQ[NRK_MAX_TASKS].Next	=	NULL;
	_head_node = NULL;
	_free_node = &_nrk_readyQ[0];
	
	
	

	nrk_task_set_entry_function( &IdleTask, nrk_idle_task);
	nrk_task_set_stk( &IdleTask, nrk_idle_task_stk, NRK_TASK_IDLE_STK_SIZE);
	nrk_idle_task_stk[0]=STK_CANARY_VAL;	
	//IdleTask.task_ID = NRK_IDLE_TASK_ID;
	IdleTask.prio = 0;
	IdleTask.period.secs = 0;
	IdleTask.period.nano_secs = 0;
	IdleTask.cpu_reserve.secs = 0;
	IdleTask.cpu_reserve.nano_secs = 0;
	IdleTask.offset.secs = 0;
	IdleTask.offset.nano_secs = 0;
	IdleTask.FirstActivation = TRUE;
	IdleTask.Type = IDLE_TASK;
	IdleTask.SchType = PREEMPTIVE;
	nrk_activate_task(&IdleTask);
	
}
Esempio n. 22
0
void nrk_create_taskset()
{
  
  TaskOne.task = uart_task;
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 3;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 0;
  TaskOne.period.nano_secs = 400*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs = 60*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);
	
  TaskTwo.task = discover_task;
  nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE);
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 4;
  TaskTwo.period.nano_secs = 0*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
	// this had an offset for mac address
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  nrk_activate_task (&TaskTwo);

  TaskThree.task = rx_task;
  nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
  TaskThree.prio = 4;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 0;
  TaskThree.period.nano_secs = 800*NANOS_PER_MS;
  TaskThree.cpu_reserve.secs = 0;
  TaskThree.cpu_reserve.nano_secs = 400*NANOS_PER_MS;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs= 0;
  nrk_activate_task (&TaskThree);

  TaskFour.task = retrans_task;
  nrk_task_set_stk( &TaskFour, Stack4, NRK_APP_STACKSIZE);
  TaskFour.prio = 1;
  TaskFour.FirstActivation = TRUE;
  TaskFour.Type = BASIC_TASK;
  TaskFour.SchType = PREEMPTIVE;
  TaskFour.period.secs = 4;
  TaskFour.period.nano_secs = 0*NANOS_PER_MS;
  TaskFour.cpu_reserve.secs = 0;
  TaskFour.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskFour.offset.secs = 0;
  TaskFour.offset.nano_secs= 0;
  nrk_activate_task (&TaskFour);

  TaskFive.task = act_recog;
  nrk_task_set_stk( &TaskFive, Stack5, NRK_APP_STACKSIZE);
  TaskFive.prio = 1;
  TaskFive.FirstActivation = TRUE;
  TaskFive.Type = BASIC_TASK;
  TaskFive.SchType = PREEMPTIVE;
  TaskFive.period.secs = 0;
  TaskFive.period.nano_secs = 100*NANOS_PER_MS;
  TaskFive.cpu_reserve.secs = 0;
  TaskFive.cpu_reserve.nano_secs = 8*NANOS_PER_MS;
  TaskFive.offset.secs = 0;
  TaskFive.offset.nano_secs= 0;
  nrk_activate_task (&TaskFive);
}
Esempio n. 23
0
void
nrk_create_taskset()
{
  nrk_task_set_entry_function( &TaskOne, Task1);
  nrk_task_set_stk( &TaskOne, Stack1, NRK_APP_STACKSIZE);
  TaskOne.prio = 1;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 2;
  TaskOne.period.nano_secs = 500*NANOS_PER_MS;
  TaskOne.prelevel=1;
  TaskOne.cpu_reserve.secs = 1;
  TaskOne.cpu_reserve.nano_secs = 500*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

   // nrk_task_set_entry_function( &TaskTwo, Task2); 
   // nrk_task_set_stk( &TaskTwo, Stack2, NRK_APP_STACKSIZE); 
   // TaskTwo.prio = 2; 
   // TaskTwo.FirstActivation = TRUE; 
   // TaskTwo.Type = BASIC_TASK; 
   // TaskTwo.SchType = PREEMPTIVE; 
   // TaskTwo.period.secs = 0; 
   // TaskTwo.period.nano_secs = 250*NANOS_PER_MS; 
   // TaskTwo.PreemptionLevel=1;
   // TaskTwo.cpu_reserve.secs = 0; 
   // TaskTwo.cpu_reserve.nano_secs = 100*NANOS_PER_MS; 
   // TaskTwo.offset.secs = 0;
   // TaskTwo.offset.nano_secs= 0; 
   // nrk_activate_task (&TaskTwo); 
  
  //sets enrty function for task3
  nrk_task_set_entry_function( &TaskThree, Task3); 
   nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE); 
   TaskThree.prio = 3; 
   TaskThree.FirstActivation = TRUE; 
   TaskThree.Type = BASIC_TASK; 
   TaskThree.SchType = PREEMPTIVE; 
   TaskThree.period.secs = 1; 
   TaskThree.period.nano_secs = 100*NANOS_PER_MS;
   TaskThree.prelevel=2;
   TaskThree.cpu_reserve.secs = 0; 
   TaskThree.cpu_reserve.nano_secs = 100*NANOS_PER_MS; 
   TaskThree.offset.secs = 0; 
   TaskThree.offset.nano_secs= 0; 
   //activate task3
   nrk_activate_task (&TaskThree); 
   //sets entry function for task3
   nrk_task_set_entry_function( &TaskFour, Task4); 
   nrk_task_set_stk( &TaskFour, Stack4, NRK_APP_STACKSIZE); 
   TaskFour.prio = 4; 
   TaskFour.FirstActivation = TRUE; 
   TaskFour.Type = BASIC_TASK; 
   TaskFour.SchType = PREEMPTIVE; 
   TaskFour.period.secs = 1; 
   TaskFour.period.nano_secs = 0; 
   TaskFour.prelevel=4;
   TaskFour.cpu_reserve.secs = 0; 
   TaskFour.cpu_reserve.nano_secs = 100*NANOS_PER_MS; 
   TaskFour.offset.secs = 0; 
   TaskFour.offset.nano_secs= 0; 
   //  nrk_activate_task (&TaskFour); 
}
Esempio n. 24
0
void nrk_create_taskset_2() {
	nrk_task_set_entry_function(&TaskOne, Task1);
	nrk_task_set_stk(&TaskOne, Stack1, NRK_APP_STACKSIZE);
	TaskOne.prio = 1;
	TaskOne.FirstActivation = TRUE;
	TaskOne.Type = BASIC_TASK;
	TaskOne.SchType = PREEMPTIVE;
	TaskOne.period.secs = 2;
	TaskOne.period.nano_secs = 0;
	TaskOne.cpu_reserve.secs = 2;
	TaskOne.cpu_reserve.nano_secs = 0;
	TaskOne.offset.secs = 0;
	TaskOne.offset.nano_secs = 0;
	printf("Activating Task 1\r\n");
	nrk_activate_task(&TaskOne);

	nrk_task_set_entry_function(&TaskTwo, Task2);
	nrk_task_set_stk(&TaskTwo, Stack2, NRK_APP_STACKSIZE);
	TaskTwo.prio = 2;
	TaskTwo.FirstActivation = TRUE;
	TaskTwo.Type = BASIC_TASK;
	TaskTwo.SchType = PREEMPTIVE;
	TaskTwo.period.secs = 1;
	TaskTwo.period.nano_secs = 0;
	TaskTwo.cpu_reserve.secs = 1;
	TaskTwo.cpu_reserve.nano_secs = 0;
	TaskTwo.offset.secs = 0;
	TaskTwo.offset.nano_secs = 0;
	printf("Activating Task 2\r\n");
	nrk_activate_task(&TaskTwo);

	 nrk_task_set_entry_function( &TaskThree, Task3);
	 nrk_task_set_stk( &TaskThree, Stack3, NRK_APP_STACKSIZE);
	 TaskThree.prio = 3;
	 TaskThree.FirstActivation = TRUE;
	 TaskThree.Type = BASIC_TASK;
	 TaskThree.SchType = PREEMPTIVE;
	 TaskThree.period.secs = 0;
	 TaskThree.period.nano_secs = 250 * NANOS_PER_MS;
	 TaskThree.cpu_reserve.secs = 0;
	 TaskThree.cpu_reserve.nano_secs = 250 * NANOS_PER_MS;
	 TaskThree.offset.secs = 0;
	 TaskThree.offset.nano_secs= 0;
	 printf("Activating Task 3\r\n");
	 nrk_activate_task (&TaskThree);


	 nrk_task_set_entry_function( &TaskFour, Task4);
	 nrk_task_set_stk( &TaskFour, Stack4, NRK_APP_STACKSIZE);
	 TaskFour.prio = 4;
	 TaskFour.FirstActivation = TRUE;
	 TaskFour.Type = BASIC_TASK;
	 TaskFour.SchType = PREEMPTIVE;
	 TaskFour.period.secs = 0;
	 TaskFour.period.nano_secs = 500 * NANOS_PER_MS;
	 TaskFour.cpu_reserve.secs = 0;
	 TaskFour.cpu_reserve.nano_secs = 500 * NANOS_PER_MS;
	 TaskFour.offset.secs = 0;
	 TaskFour.offset.nano_secs= 0;
	 printf("Activating Task 4\r\n");
	 nrk_activate_task (&TaskFour);
}
Esempio n. 25
0
void
nrk_create_taskset()
{
  TaskOne.task = Task1;
  TaskOne.Ptos = (void *) &Stack1[NRK_APP_STACKSIZE];
  TaskOne.Pbos = (void *) &Stack1[0];
  TaskOne.prio = 2;
  TaskOne.FirstActivation = TRUE;
  TaskOne.Type = BASIC_TASK;
  TaskOne.SchType = PREEMPTIVE;
  TaskOne.period.secs = 0;
  TaskOne.period.nano_secs = 250*NANOS_PER_MS;
  TaskOne.cpu_reserve.secs = 0;
  TaskOne.cpu_reserve.nano_secs =  50*NANOS_PER_MS;
  TaskOne.offset.secs = 0;
  TaskOne.offset.nano_secs= 0;
  nrk_activate_task (&TaskOne);

  TaskTwo.task = Task2;
  TaskTwo.Ptos = (void *) &Stack2[NRK_APP_STACKSIZE];
  TaskTwo.Pbos = (void *) &Stack2[0];
  TaskTwo.prio = 2;
  TaskTwo.FirstActivation = TRUE;
  TaskTwo.Type = BASIC_TASK;
  TaskTwo.SchType = PREEMPTIVE;
  TaskTwo.period.secs = 0;
  TaskTwo.period.nano_secs = 500*NANOS_PER_MS;
  TaskTwo.cpu_reserve.secs = 0;
  TaskTwo.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskTwo.offset.secs = 0;
  TaskTwo.offset.nano_secs= 0;
  //nrk_activate_task (&TaskTwo);


  TaskThree.task = Task3;
  TaskThree.Ptos = (void *) &Stack3[NRK_APP_STACKSIZE];
  TaskThree.Pbos = (void *) &Stack3[0];
  TaskThree.prio = 3;
  TaskThree.FirstActivation = TRUE;
  TaskThree.Type = BASIC_TASK;
  TaskThree.SchType = PREEMPTIVE;
  TaskThree.period.secs = 0;
  TaskThree.period.nano_secs = 500*NANOS_PER_MS;
  TaskThree.cpu_reserve.secs = 0;
  TaskThree.cpu_reserve.nano_secs = 100*NANOS_PER_MS;
  TaskThree.offset.secs = 0;
  TaskThree.offset.nano_secs= 0;
	nrk_activate_task (&TaskThree);


  TaskFour.task = Task4;
  nrk_task_set_stk( &TaskFour, Stack4, NRK_APP_STACKSIZE);
//  TaskFour.Ptos = (void *) &Stack3[NRK_APP_STACKSIZE];
//  TaskFour.Pbos = (void *) &Stack3[0];
  TaskFour.prio = 4;
  TaskFour.FirstActivation = TRUE;
  TaskFour.Type = BASIC_TASK;
  TaskFour.SchType = PREEMPTIVE;
  TaskFour.period.secs = 0;
  TaskFour.period.nano_secs = 20*NANOS_PER_MS;
  TaskFour.cpu_reserve.secs = 0;
  TaskFour.cpu_reserve.nano_secs = 50*NANOS_PER_MS;
  TaskFour.offset.secs = 0;
  TaskFour.offset.nano_secs= 0;
  nrk_activate_task (&TaskFour);

  TaskFive.task = Task5;
//  nrk_task_set_stk( &TaskFive, Stack5, NRK_APP_STACKSIZE);
  TaskFive.Ptos = (void *) &Stack5[NRK_APP_STACKSIZE];
  TaskFive.Pbos = (void *) &Stack5[0];
  TaskFive.prio = 1;
  TaskFive.FirstActivation = TRUE;
  TaskFive.Type = BASIC_TASK;
  TaskFive.SchType = PREEMPTIVE;
  TaskFive.period.secs = 5;
  TaskFive.period.nano_secs = 100*NANOS_PER_MS;
  TaskFive.cpu_reserve.secs = 3;
  TaskFive.cpu_reserve.nano_secs = 0*NANOS_PER_MS;
  TaskFive.offset.secs = 0;
  TaskFive.offset.nano_secs= 0;
  nrk_activate_task (&TaskFive);
}