source: rtems/testsuites/sptests/sp04/tswitch.c @ ac85d56

4.104.115
Last change on this file since ac85d56 was ac85d56, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 26, 2009 at 3:47:16 PM

2009-09-26 Joel Sherrill <joel.sherrill@…>

  • sp04/tswitch.c, sp07/system.h, sp07/taskexit.c, sp07/tdelete.c, sp07/tstart.c, spfatal_support/init.c, spfatal_support/system.h: Eliminate use of deprecated rtems_extension.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*  Task_switch
2 *
3 *  This routine is the tswitch user extension.  It determines which
4 *  task is being switched to and displays a message indicating the
5 *  time and date that it gained control.
6 *
7 *  Input parameters:
8 *    unused  - pointer to currently running TCB
9 *    heir    - pointer to heir TCB
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-2009.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#include "system.h"
24
25#if BSP_SMALL_MEMORY
26struct taskSwitchLog taskSwitchLog[100];
27#else
28struct taskSwitchLog taskSwitchLog[1000];
29#endif
30unsigned int taskSwitchLogIndex;
31volatile int testsFinished;
32
33void Task_switch(
34  rtems_tcb *unused,
35  rtems_tcb *heir
36)
37{
38  uint32_t    index;
39  rtems_time_of_day time;
40  rtems_status_code status;
41
42  index = task_number( heir->Object.id ) - task_number( Task_id[1] ) + 1;
43
44  switch( index ) {
45    case 1:
46    case 2:
47    case 3:
48      Run_count[ index ] += 1;
49
50      status = rtems_clock_get_tod( &time );
51      directive_failed_with_level( status, "rtems_clock_get_tod", 1 );
52
53      if (taskSwitchLogIndex < (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
54        taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
55        taskSwitchLog[taskSwitchLogIndex].when = time;
56        taskSwitchLogIndex++;
57      }
58      if ( time.second >= 16 )
59        testsFinished = 1;
60      break;
61
62    case 0:
63    default:
64      break;
65  }
66}
Note: See TracBrowser for help on using the repository browser.