source: rtems/testsuites/libtests/cpuuse/tswitch.c @ 721fe34

4.11
Last change on this file since 721fe34 was 721fe34, checked in by Joel Sherrill <joel.sherrill@…>, on May 31, 2012 at 8:34:36 PM

Fix C files which had two semi-colons at EOL

  • Property mode set to 100644
File size: 1.6 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
21#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include "system.h"
26
27/*
28 *  Only require 8 task switches on sis/gdb.  --joel 2 Feb 2011
29 */
30struct taskSwitchLog taskSwitchLog[25];
31int taskSwitchLogIndex;
32volatile int testsFinished;
33
34void Task_switch(
35  rtems_tcb *unused,
36  rtems_tcb *heir
37)
38{
39  uint32_t    index;
40  rtems_time_of_day time;
41  rtems_status_code status;
42
43  index = task_number( heir->Object.id );
44
45  switch( index ) {
46    case 1:
47    case 2:
48    case 3:
49      Run_count[ index ] += 1;
50
51      status = rtems_clock_get_tod( &time );
52      fatal_directive_status_with_level( status, RTEMS_SUCCESSFUL,
53                                         "rtems_clock_get_tod", 1 );
54
55      if (taskSwitchLogIndex <
56          (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
57        taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
58        taskSwitchLog[taskSwitchLogIndex].when = time;
59        taskSwitchLogIndex++;
60      }
61      if ( time.second >= 16 )
62        testsFinished = 1;
63
64      break;
65
66    case 0:
67    default:
68      break;
69  }
70}
71
Note: See TracBrowser for help on using the repository browser.