4.104.115
Last change
on this file since ac85d56 was
0d1e5fd,
checked in by Joel Sherrill <joel.sherrill@…>, on 09/26/09 at 15:46:34
|
2009-09-26 Joel Sherrill <joel.sherrill@…>
- cpuuse/tswitch.c: Eliminate use of deprecated rtems_extension.
|
-
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 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | #include "system.h" |
---|
24 | |
---|
25 | #if BSP_SMALL_MEMORY |
---|
26 | struct taskSwitchLog taskSwitchLog[100]; |
---|
27 | #else |
---|
28 | struct taskSwitchLog taskSwitchLog[1000]; |
---|
29 | #endif |
---|
30 | int taskSwitchLogIndex; |
---|
31 | volatile int testsFinished;; |
---|
32 | |
---|
33 | void 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 ); |
---|
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 | fatal_directive_status_with_level( status, RTEMS_SUCCESSFUL, |
---|
52 | "rtems_clock_get_tod", 1 ); |
---|
53 | |
---|
54 | if (taskSwitchLogIndex < |
---|
55 | (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) { |
---|
56 | taskSwitchLog[taskSwitchLogIndex].taskIndex = index; |
---|
57 | taskSwitchLog[taskSwitchLogIndex].when = time; |
---|
58 | taskSwitchLogIndex++; |
---|
59 | } |
---|
60 | if ( time.second >= 16 ) |
---|
61 | testsFinished = 1; |
---|
62 | |
---|
63 | break; |
---|
64 | |
---|
65 | case 0: |
---|
66 | default: |
---|
67 | break; |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
Note: See
TracBrowser
for help on using the repository browser.