source: rtems/testsuites/sptests/sp04/tswitch.c @ 9b413ea

4.104.114.84.95
Last change on this file since 9b413ea was 9b413ea, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/98 at 20:55:21

Patch from Eric Norum to avoid printing from context switch user extension.

The array is too long and needs to be shortened.

  • 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-1998.
14 *  On-Line Applications Research Corporation (OAR).
15 *  Copyright assigned to U.S. Government, 1994.
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.OARcorp.com/rtems/license.html.
20 *
21 *  $Id$
22 */
23
24#include "system.h"
25
26struct taskSwitchLog taskSwitchLog[1000];
27int taskSwitchLogIndex;
28volatile int testsFinished;;
29
30rtems_extension Task_switch(
31  rtems_tcb *unused,
32  rtems_tcb *heir
33)
34{
35  rtems_unsigned32  index;
36  rtems_time_of_day time;
37  rtems_status_code status;
38
39  index = task_number( heir->Object.id );
40
41  switch( index ) {
42    case 1:
43    case 2:
44    case 3:
45      Run_count[ index ] += 1;
46
47      status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
48      directive_failed( status, "rtems_clock_get" );
49
50      if (taskSwitchLogIndex < (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
51        taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
52        taskSwitchLog[taskSwitchLogIndex].when = time;
53        taskSwitchLogIndex++;
54      }
55      if ( time.second >= 16 )
56        testsFinished = 1;
57      break;
58
59    case 0:
60    default:
61      break;
62  }
63}
Note: See TracBrowser for help on using the repository browser.