5
Last change
on this file since db20706 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
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.org/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 | */ |
---|
30 | struct taskSwitchLog taskSwitchLog[25]; |
---|
31 | int taskSwitchLogIndex; |
---|
32 | volatile int testsFinished; |
---|
33 | |
---|
34 | void 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.