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 09/26/09 at 15:47:16

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
RevLine 
[ac7d5ef0]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 *
[b84f1fdc]13 *  COPYRIGHT (c) 1989-2009.
[ac7d5ef0]14 *  On-Line Applications Research Corporation (OAR).
15 *
[98e4ebf5]16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
[d2b93bfd]18 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]19 *
[3235ad9]20 *  $Id$
[ac7d5ef0]21 */
22
23#include "system.h"
24
[a1c219b]25#if BSP_SMALL_MEMORY
26struct taskSwitchLog taskSwitchLog[100];
27#else
[9b413ea]28struct taskSwitchLog taskSwitchLog[1000];
[a1c219b]29#endif
[b84f1fdc]30unsigned int taskSwitchLogIndex;
[df49c60]31volatile int testsFinished;
[9b413ea]32
[ac85d56]33void Task_switch(
[ac7d5ef0]34  rtems_tcb *unused,
35  rtems_tcb *heir
36)
37{
[c87608f]38  uint32_t    index;
[ac7d5ef0]39  rtems_time_of_day time;
40  rtems_status_code status;
41
[fabacfe]42  index = task_number( heir->Object.id ) - task_number( Task_id[1] ) + 1;
[ac7d5ef0]43
44  switch( index ) {
45    case 1:
46    case 2:
47    case 3:
48      Run_count[ index ] += 1;
49
[bcf16c0]50      status = rtems_clock_get_tod( &time );
51      directive_failed_with_level( status, "rtems_clock_get_tod", 1 );
[ac7d5ef0]52
[9b413ea]53      if (taskSwitchLogIndex < (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
54        taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
55        taskSwitchLog[taskSwitchLogIndex].when = time;
56        taskSwitchLogIndex++;
[ac7d5ef0]57      }
[9b413ea]58      if ( time.second >= 16 )
59        testsFinished = 1;
[ac7d5ef0]60      break;
61
62    case 0:
63    default:
64      break;
65  }
66}
Note: See TracBrowser for help on using the repository browser.