OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp08/] [task1.c] - Blame information for rev 484

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

Line No. Rev Author Line
1 30 unneback
/*  Task_1
2
 *
3
 *  This routine serves as a test task.  It verifies all combinations of
4
 *  task mode changes.
5
 *
6
 *  Input parameters:
7
 *    argument - task argument
8
 *
9
 *  Output parameters:  NONE
10
 *
11
 *  COPYRIGHT (c) 1989-1999.
12
 *  On-Line Applications Research Corporation (OAR).
13
 *
14
 *  The license and distribution terms for this file may be
15
 *  found in the file LICENSE in this distribution or at
16
 *  http://www.OARcorp.com/rtems/license.html.
17
 *
18
 *  $Id: task1.c,v 1.2 2001-09-27 12:02:31 chris Exp $
19
 */
20
 
21
#include "system.h"
22
 
23
rtems_task Task_1(
24
  rtems_task_argument argument
25
)
26
{
27
  rtems_mode        previous_mode;
28
  rtems_status_code status;
29
 
30
/* BEGINNING OF RTEMS_ASR */
31
 
32
  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
33
  directive_failed( status, "rtems_task_mode" );
34
  put_mode(
35
    "TA1 - rtems_task_mode - RTEMS_ASR                  - previous mode: ",
36
    previous_mode
37
  );
38
 
39
  status = rtems_task_mode(
40
    RTEMS_NO_ASR,
41
    RTEMS_ASR_MASK,
42
    &previous_mode
43
  );
44
  directive_failed( status, "rtems_task_mode" );
45
  put_mode(
46
    "TA1 - rtems_task_mode - RTEMS_NO_ASR               - previous mode: ",
47
    previous_mode
48
  );
49
 
50
  status = rtems_task_mode(
51
    RTEMS_NO_ASR,
52
    RTEMS_ASR_MASK,
53
    &previous_mode
54
  );
55
  directive_failed( status, "rtems_task_mode" );
56
  put_mode(
57
    "TA1 - rtems_task_mode - RTEMS_NO_ASR               - previous mode: ",
58
    previous_mode
59
  );
60
 
61
  status = rtems_task_mode(
62
    RTEMS_ASR,
63
    RTEMS_ASR_MASK,
64
    &previous_mode
65
  );
66
  directive_failed( status, "rtems_task_mode" );
67
  put_mode(
68
    "TA1 - rtems_task_mode - RTEMS_ASR                  - previous mode: ",
69
    previous_mode
70
  );
71
 
72
/* END OF RTEMS_ASR */
73
 
74
/* BEGINNING OF RTEMS_TIMESLICE */
75
 
76
  status = rtems_task_mode(
77
    RTEMS_NO_TIMESLICE,
78
    RTEMS_TIMESLICE_MASK,
79
    &previous_mode
80
  );
81
  directive_failed( status, "rtems_task_mode" );
82
  put_mode(
83
    "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE         - previous mode: ",
84
    previous_mode
85
  );
86
 
87
  status = rtems_task_mode(
88
    RTEMS_TIMESLICE,
89
    RTEMS_TIMESLICE_MASK,
90
    &previous_mode
91
  );
92
  directive_failed( status, "rtems_task_mode" );
93
  put_mode(
94
    "TA1 - rtems_task_mode - RTEMS_TIMESLICE            - previous mode: ",
95
    previous_mode
96
  );
97
 
98
  status = rtems_task_mode(
99
    RTEMS_TIMESLICE,
100
    RTEMS_TIMESLICE_MASK,
101
    &previous_mode
102
  );
103
  directive_failed( status, "rtems_task_mode" );
104
  put_mode(
105
    "TA1 - rtems_task_mode - RTEMS_TIMESLICE            - previous mode: ",
106
    previous_mode
107
  );
108
 
109
  status = rtems_task_mode(
110
    RTEMS_NO_TIMESLICE,
111
    RTEMS_TIMESLICE_MASK,
112
    &previous_mode
113
  );
114
  directive_failed( status, "rtems_task_mode" );
115
  put_mode(
116
    "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE         - previous mode: ",
117
    previous_mode
118
  );
119
 
120
/* END OF RTEMS_TIMESLICE */
121
 
122
/* BEGINNING OF RTEMS_PREEMPT */
123
 
124
  status = rtems_task_mode(
125
    RTEMS_PREEMPT,
126
    RTEMS_PREEMPT_MASK,
127
    &previous_mode
128
  );
129
  directive_failed( status, "rtems_task_mode" );
130
  put_mode(
131
    "TA1 - rtems_task_mode - RTEMS_PREEMPT              - previous mode: ",
132
    previous_mode
133
  );
134
 
135
  status = rtems_task_mode(
136
    RTEMS_NO_PREEMPT,
137
    RTEMS_PREEMPT_MASK,
138
    &previous_mode
139
  );
140
  directive_failed( status, "rtems_task_mode" );
141
  put_mode(
142
    "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT           - previous mode: ",
143
    previous_mode
144
  );
145
 
146
  status = rtems_task_mode(
147
    RTEMS_NO_PREEMPT,
148
    RTEMS_PREEMPT_MASK,
149
    &previous_mode
150
  );
151
  directive_failed( status, "rtems_task_mode" );
152
  put_mode(
153
    "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT           - previous mode: ",
154
    previous_mode
155
  );
156
 
157
  status = rtems_task_mode(
158
    RTEMS_PREEMPT,
159
    RTEMS_PREEMPT_MASK,
160
    &previous_mode
161
  );
162
  directive_failed( status, "rtems_task_mode" );
163
  put_mode(
164
    "TA1 - rtems_task_mode - RTEMS_PREEMPT              - previous mode: ",
165
    previous_mode
166
  );
167
 
168
/* END OF RTEMS_PREEMPT */
169
 
170
/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */
171
 
172
  status = rtems_task_mode(
173
    RTEMS_INTERRUPT_LEVEL(3),
174
    RTEMS_INTERRUPT_MASK,
175
    &previous_mode
176
  );
177
  directive_failed( status, "rtems_task_mode" );
178
  put_mode(
179
    "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ",
180
    previous_mode
181
  );
182
 
183
  status = rtems_task_mode(
184
    RTEMS_INTERRUPT_LEVEL(5),
185
    RTEMS_INTERRUPT_MASK,
186
    &previous_mode
187
  );
188
  directive_failed( status, "rtems_task_mode" );
189
  put_mode(
190
    "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ",
191
    previous_mode
192
  );
193
 
194
/* END OF RTEMS_INTERRUPT_LEVEL */
195
 
196
/* BEGINNING OF COMBINATIONS */
197
 
198
  status = rtems_task_mode(
199
    RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
200
      RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
201
    RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
202
      RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
203
    &previous_mode
204
  );
205
  directive_failed( status, "rtems_task_mode" );
206
  put_mode(
207
    "TA1 - rtems_task_mode - set all modes        - previous mode: ",
208
    previous_mode
209
  );
210
 
211
  status = rtems_task_mode(
212
    RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
213
      RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
214
    RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
215
      RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
216
    &previous_mode
217
  );
218
  directive_failed( status, "rtems_task_mode" );
219
  put_mode(
220
    "TA1 - rtems_task_mode - set all modes        - previous mode: ",
221
    previous_mode
222
  );
223
 
224
  status = rtems_task_mode(
225
    RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT,
226
    RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
227
    RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
228
    &previous_mode
229
  );
230
  directive_failed( status, "rtems_task_mode" );
231
  put_mode(
232
    "TA1 - rtems_task_mode - clear all modes      - previous mode: ",
233
    previous_mode
234
  );
235
 
236
/* END OF COMBINATIONS */
237
 
238
/* BEGINNING OF CURRENT MODE */
239
 
240
  status = rtems_task_mode(
241
    RTEMS_CURRENT_MODE,
242
    RTEMS_CURRENT_MODE,
243
    &previous_mode
244
  );
245
  directive_failed( status, "rtems_task_mode" );
246
  put_mode(
247
    "TA1 - rtems_task_mode - get current mode     - previous mode: ",
248
    previous_mode
249
  );
250
 
251
/* END OF CURRENT MODE */
252
 
253
  puts( "*** END OF TEST 8 ***" );
254
  exit( 0 );
255
}

powered by: WebSVN 2.1.0

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