OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [tmtests/] [tm19/] [task1.c] - Blame information for rev 227

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *
3
 *  COPYRIGHT (c) 1989-1999.
4
 *  On-Line Applications Research Corporation (OAR).
5
 *
6
 *  The license and distribution terms for this file may be
7
 *  found in the file LICENSE in this distribution or at
8
 *  http://www.OARcorp.com/rtems/license.html.
9
 *
10
 *  $Id: task1.c,v 1.2 2001-09-27 12:02:43 chris Exp $
11
 */
12
 
13
#define TEST_INIT
14
#include "system.h"
15
 
16
rtems_asr Process_asr_for_pass_1(
17
  rtems_signal_set signals
18
);
19
 
20
rtems_asr Process_asr_for_pass_2(
21
  rtems_signal_set signals
22
);
23
 
24
rtems_task Task_1(
25
  rtems_task_argument argument
26
);
27
 
28
rtems_task Task_2(
29
  rtems_task_argument argument
30
);
31
 
32
rtems_task Task_3(
33
  rtems_task_argument argument
34
);
35
 
36
rtems_task Init(
37
  rtems_task_argument argument
38
)
39
{
40
  rtems_status_code status;
41
 
42
  Print_Warning();
43
 
44
  puts( "\n\n*** TIME TEST 19 ***" );
45
 
46
  status = rtems_task_create(
47
    rtems_build_name( 'T', 'I', 'M', 'E' ),
48
    128,
49
    RTEMS_MINIMUM_STACK_SIZE,
50
    RTEMS_DEFAULT_MODES,
51
    RTEMS_DEFAULT_ATTRIBUTES,
52
    &Task_id[ 1 ]
53
  );
54
  directive_failed( status, "rtems_task_create of TASK1" );
55
 
56
  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
57
  directive_failed( status, "rtems_task_start of TASK1" );
58
 
59
  status = rtems_task_create(
60
    rtems_build_name( 'T', 'I', 'M', 'E' ),
61
    127,
62
    RTEMS_MINIMUM_STACK_SIZE,
63
    RTEMS_DEFAULT_MODES,
64
    RTEMS_DEFAULT_ATTRIBUTES,
65
    &Task_id[ 2 ]
66
  );
67
  directive_failed( status, "rtems_task_create of TASK2" );
68
 
69
  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
70
  directive_failed( status, "rtems_task_start of TASK2" );
71
 
72
  status = rtems_task_create(
73
    rtems_build_name( 'T', 'I', 'M', 'E' ),
74
    126,
75
    RTEMS_MINIMUM_STACK_SIZE,
76
    RTEMS_DEFAULT_MODES,
77
    RTEMS_DEFAULT_ATTRIBUTES,
78
    &Task_id[ 3 ]
79
  );
80
  directive_failed( status, "rtems_task_create of TASK3" );
81
 
82
  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
83
  directive_failed( status, "rtems_task_start of TASK3" );
84
 
85
  status = rtems_task_delete( RTEMS_SELF );
86
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
87
}
88
 
89
rtems_asr Process_asr_for_pass_1(
90
  rtems_signal_set signals
91
)
92
{
93
  end_time = Read_timer();
94
 
95
  put_time(
96
    "rtems_signal_send: signal to self",
97
    end_time,
98
    1,
99
    0,
100
    CALLING_OVERHEAD_SIGNAL_SEND
101
  );
102
 
103
  Timer_initialize();
104
}
105
 
106
rtems_asr Process_asr_for_pass_2(
107
  rtems_signal_set signals
108
)
109
{
110
  rtems_status_code status;
111
 
112
  status = rtems_task_resume( Task_id[ 3 ] );
113
  directive_failed( status, "rtems_task_resume" );
114
 
115
  Timer_initialize();
116
}
117
 
118
rtems_task Task_1(
119
  rtems_task_argument argument
120
)
121
{
122
  rtems_status_code status;
123
 
124
  Timer_initialize();
125
    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
126
  end_time = Read_timer();
127
 
128
  put_time(
129
    "rtems_signal_catch",
130
    end_time,
131
    1,
132
    0,
133
    CALLING_OVERHEAD_SIGNAL_CATCH
134
  );
135
 
136
  Timer_initialize();
137
    rtems_signal_send( Task_id[ 2 ], 1 );
138
  end_time = Read_timer();
139
 
140
  put_time(
141
    "rtems_signal_send: returns to caller",
142
    end_time,
143
    1,
144
    0,
145
    CALLING_OVERHEAD_SIGNAL_SEND
146
  );
147
 
148
  Timer_initialize();
149
    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
150
 
151
  /* end time is done is RTEMS_ASR */
152
 
153
  end_time = Read_timer();
154
 
155
  put_time(
156
    "exit ASR overhead: returns to calling task",
157
    end_time,
158
    1,
159
    0,
160
 
161
  );
162
 
163
  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
164
  directive_failed( status, "rtems_signal_catch" );
165
 
166
  Timer_initialize();
167
    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
168
}
169
 
170
rtems_asr Process_asr_for_task_2(
171
  rtems_signal_set signals
172
)
173
{
174
  ;
175
}
176
 
177
rtems_task Task_2(
178
  rtems_task_argument argument
179
)
180
{
181
  rtems_status_code status;
182
 
183
  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
184
  directive_failed( status, "rtems_signal_catch" );
185
 
186
  (void) rtems_task_suspend( RTEMS_SELF );
187
}
188
 
189
rtems_task Task_3(
190
  rtems_task_argument argument
191
)
192
{
193
  (void) rtems_task_suspend( RTEMS_SELF );
194
 
195
  end_time = Read_timer();
196
 
197
  put_time(
198
    "exit ASR overhead: returns to preempting task",
199
    end_time,
200
    1,
201
    0,
202
 
203
  );
204
 
205
  puts( "*** END OF TEST 19 ***" );
206
  exit( 0 );
207
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.