source: rtems/c/src/tests/libtests/rtems++/Task1.cc @ 0074691a

4.104.114.84.95
Last change on this file since 0074691a was 0074691a, checked in by Joel Sherrill <joel.sherrill@…>, on 07/31/97 at 22:13:29

Merged very large and much appreciated patch from Chris Johns
<cjohns@…>. This patch includes the ods68302 bsp,
the RTEMS++ class library, and the rtems++ test.

  • Property mode set to 100644
File size: 20.9 KB
Line 
1/*  Task1
2 *
3 *  This task is the main line for the test. It creates other
4 *  tasks which can create
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1997
12 *  Objective Design Systems Ltd Pty (ODS)
13 *  All rights reserved (R) Objective Design Systems Ltd Pty
14 *
15 *  COPYRIGHT (c) 1989-1997.
16 *  On-Line Applications Research Corporation (OAR).
17 *  Copyright assigned to U.S. Government, 1994.
18 *
19 *  The license and distribution terms for this file may in
20 *  the file LICENSE in this distribution or at
21 *  http://www.OARcorp.com/rtems/license.html.
22 *
23 *  $Id$
24 */
25
26#include <string.h>
27#include "System.h"
28
29void Task1::body(rtems_task_argument argument)
30{
31  rtems_test_pause_and_screen_number(1);
32 
33  printf(" * START Task Class test *\n");
34 
35  printf("%s - test argument - ", name_string());
36  if (argument != 0xDEADDEAD)
37    printf("argument is not 0xDEADDEAD\n");
38  else
39    printf("argument matched\n");
40 
41  screen1();
42  rtems_test_pause_and_screen_number(2);
43
44  screen2();
45  rtems_test_pause_and_screen_number(3);
46 
47  screen3();
48  rtems_test_pause_and_screen_number(4);
49 
50  screen4();
51  rtems_test_pause_and_screen_number(5);
52 
53  screen5();
54  rtems_test_pause_and_screen_number(6);
55 
56  screen6();
57  rtems_test_pause_and_screen_number(7);
58
59  // causes init to delete me and itself
60  end_init.send(RTEMS_SIGNAL_0);
61}
62
63void Task1::screen1(void)
64{
65  // create two local task objects to connect to this task
66  rtemsTask local_task_1 = *this;
67  rtemsTask local_task_2;
68
69  local_task_2 = *this;
70 
71  // check the copy constructor works
72  printf("%s - copy constructor - ", name_string());
73  if (local_task_1.id_is() == id_is())
74    printf("local and this id's match\n");
75  else
76    printf("local and this id's do not match\n");
77
78  printf("%s - copy constructor - ", name_string());
79  if (local_task_1.name_is() == name_is())
80    printf("local and this name's match\n");
81  else
82    printf("local and this name's do not match\n");
83
84  // check the copy operator works
85  printf("%s - copy operator - ", name_string());
86  if (local_task_2.id_is() == id_is())
87    printf("local and this id's match\n");
88  else
89    printf("local and this id's do not match\n");
90  printf("%s - copy operator - ", name_string());
91  if (local_task_2.name_is() == name_is())
92    printf("local and this name's match\n");
93  else
94    printf("local and this name's do not match\n");
95 
96  // check that the owner of the id cannot delete this task
97  printf("%s - not owner destroy's task - ", local_task_1.name_string());
98  local_task_1.destroy();
99  printf("%s\n", local_task_1.last_status_string());
100 
101  // connect to a valid task
102  printf("%s - connect to a local valid task name - ", local_task_2.name_string());
103  local_task_2.connect("TA1 ", RTEMS_SEARCH_ALL_NODES);
104  printf("%s\n", local_task_2.last_status_string());
105 
106  // connect to an invalid task
107  printf("%s - connect to an invalid task name - ", local_task_2.name_string());
108  local_task_2.connect("BADT", RTEMS_SEARCH_ALL_NODES);
109  printf("%s\n", local_task_2.last_status_string());
110 
111  // connect to a task an invalid node
112  printf("%s - connect to a task on an invalid node - ", local_task_2.name_string());
113  local_task_2.connect("BADT", 10);
114  printf("%s\n", local_task_2.last_status_string());
115 
116  // restart this task
117  printf("%s - restart from a non-owner - ", name_string());
118  local_task_1.restart(0);
119  printf("%s\n", local_task_1.last_status_string());
120}
121
122void Task1::screen2(void)
123{
124  // wake after using this object
125 
126  printf("%s - wake after 0 secs - ", name_string());
127  wake_after(0);
128  printf("%s\n", last_status_string());
129 
130  printf("%s - wake after 500 msecs - ", name_string());
131  wake_after(500000);
132  printf("%s\n", last_status_string());
133 
134  printf("%s - wake after 5 secs - ", name_string());
135  wake_after(5000000);
136  printf("%s\n", last_status_string());
137
138  printf("%s - wake when - to do\n", name_string());
139
140  rtemsTask task_1 = *this;
141 
142  // wake after using a connected object
143 
144  printf("%s - connected object wake after 0 secs - ", task_1.name_string());
145  task_1.wake_after(0);
146  printf("%s\n", task_1.last_status_string());
147 
148  printf("%s - connected object wake after 500 msecs - ", task_1.name_string());
149  task_1.wake_after(500000);
150  printf("%s\n", task_1.last_status_string());
151 
152  printf("%s - connected object wake after 5 secs - ", task_1.name_string());
153  task_1.wake_after(5000000);
154  printf("%s\n", task_1.last_status_string());
155
156  printf("%s - connected object wake when - to do\n", task_1.name_string());
157
158  rtemsTask task_2;
159 
160  // wake after using a self object
161 
162  printf("%s - self object wake after 0 secs - ", task_2.name_string());
163  task_2.wake_after(0);
164  printf("%s\n", task_2.last_status_string());
165 
166  printf("%s - self object wake after 500 msecs - ", task_2.name_string());
167  task_2.wake_after(500000);
168  printf("%s\n", task_2.last_status_string());
169 
170  printf("%s - self object wake after 5 secs - ", task_2.name_string());
171  task_2.wake_after(5000000);
172  printf("%s\n", task_2.last_status_string());
173
174  printf("%s - self object wake when - to do\n", task_2.name_string());
175
176  rtems_task_priority current_priority;
177  rtems_task_priority priority;
178
179  // priorities with this object
180 
181  printf("%s - get priority - ", name_string());
182  get_priority(current_priority);
183  printf("%s, priority is %i\n", last_status_string(), current_priority);
184
185  printf("%s - set priority to 512 - ", name_string());
186  set_priority(512);
187  printf("%s\n", last_status_string());
188
189  printf("%s - set priority to 25 - ", name_string());
190  set_priority(25);
191  printf("%s\n", last_status_string());
192
193  printf("%s - set priority to original - ", name_string());
194  set_priority(current_priority, priority);
195  printf("%s, priority was %i\n", last_status_string(), priority);
196
197  // priorities with connected object
198   
199  printf("%s - connected object get priority - ", task_1.name_string());
200  task_1.get_priority(current_priority);
201  printf("%s, priority is %i\n", task_1.last_status_string(), current_priority);
202
203  printf("%s - connected object set priority to 512 - ", task_1.name_string());
204  task_1.set_priority(512);
205  printf("%s\n", task_1.last_status_string());
206
207  printf("%s - connected object set priority to 25 - ", task_1.name_string());
208  task_1.set_priority(25);
209  printf("%s\n", task_1.last_status_string());
210
211  printf("%s - connected object set priority to original - ", task_1.name_string());
212  task_1.set_priority(current_priority, priority);
213  printf("%s, priority was %i\n", task_1.last_status_string(), priority); 
214
215  // priorities with self object
216   
217  printf("%s - self object get priority - ", task_2.name_string());
218  task_2.get_priority(current_priority);
219  printf("%s, priority is %i\n", task_2.last_status_string(), current_priority);
220
221  printf("%s - self object set priority to 512 - ", task_2.name_string());
222  task_2.set_priority(512);
223  printf("%s\n", task_2.last_status_string());
224
225  printf("%s - self object set priority to 25 - ", task_2.name_string());
226  task_2.set_priority(25);
227  printf("%s\n", task_2.last_status_string());
228
229  printf("%s - self object set priority to original - ", task_2.name_string());
230  task_2.set_priority(current_priority, priority);
231  printf("%s, priority was %i\n", task_2.last_status_string(), priority);
232
233  rtems_unsigned32 current_note;
234  rtems_unsigned32 note;
235 
236  // notepad registers for this object
237
238  printf("%s - get note - ", name_string());
239  get_note(0, current_note);
240  printf("%s, note is %i\n", last_status_string(), current_note);
241
242  printf("%s - get with bad notepad number - ", name_string());
243  get_note(100, current_note);
244  printf("%s, note is %i\n", last_status_string(), current_note);
245
246  printf("%s - set note to 0xDEADBEEF - ", name_string());
247  set_note(0, 0xDEADBEEF);
248  printf("%s\n", last_status_string());
249
250  printf("%s - get note - ", name_string());
251  get_note(0, note);
252  printf("%s, note is 0x%08X\n", last_status_string(), note);
253
254  printf("%s - set note to original value - ", name_string());
255  set_note(0, current_note);
256  printf("%s\n", last_status_string());
257
258  // notepad registers for connected object
259
260  printf("%s - connected object get note - ", task_1.name_string());
261  task_1.get_note(0, current_note);
262  printf("%s, notepad is %i\n", task_1.last_status_string(), current_note);
263
264  printf("%s - connected object get with bad notepad number - ", task_1.name_string());
265  task_1.get_note(100, current_note);
266  printf("%s, note is %i\n", task_1.last_status_string(), current_note);
267
268  printf("%s - connected object set note to 0xDEADBEEF - ", task_1.name_string());
269  task_1.set_note(0, 0xDEADBEEF);
270  printf("%s\n", task_1.last_status_string());
271
272  printf("%s - connected object get note - ", task_1.name_string());
273  task_1.get_note(0, note);
274  printf("%s, note is 0x%08X\n", task_1.last_status_string(), note);
275
276  printf("%s - connected object set note to original value - ", task_1.name_string());
277  task_1.set_note(0, current_note);
278  printf("%s\n", task_1.last_status_string());
279
280  // notepad registers for self object
281
282  printf("%s - self object get note - ", task_2.name_string());
283  task_2.get_note(0, current_note);
284  printf("%s, note is %i\n", task_2.last_status_string(), current_note);
285
286  printf("%s - self object get with bad notepad number - ", task_2.name_string());
287  task_2.get_note(100, current_note);
288  printf("%s, note is %i\n", task_2.last_status_string(), current_note);
289
290  printf("%s - self object set note to 0xDEADBEEF - ", task_2.name_string());
291  task_2.set_note(0, 0xDEADBEEF);
292  printf("%s\n", task_2.last_status_string());
293
294  printf("%s - self object get note - ", task_2.name_string());
295  task_2.get_note(0, note);
296  printf("%s, notepad is 0x%08X\n", task_2.last_status_string(), note);
297
298  printf("%s - self object set note to original value - ", task_2.name_string());
299  task_2.set_note(0, current_note);
300  printf("%s\n", task_2.last_status_string());
301
302  printf(" * END Task Class test *\n");
303}
304
305#define RTEMS_ALL_MODES (RTEMS_PREEMPT_MASK | \
306                         RTEMS_TIMESLICE_MASK | \
307                         RTEMS_ASR_MASK | \
308                         RTEMS_INTERRUPT_MASK)
309
310void Task1::screen3(void)
311{
312  printf(" * START TaskMode Class test *\n");
313
314  rtemsTask self;
315  rtemsTaskMode task_mode;
316  rtems_mode current_mode;
317  rtems_mode mode;
318
319  printf("%s - get mode - ", self.name_string());
320  task_mode.get_mode(current_mode);
321  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), current_mode);
322  print_mode(current_mode, RTEMS_ALL_MODES);
323  printf("\n");
324
325  // PREEMPTION mode control
326 
327  printf("%s - get preemption state - ", self.name_string());
328  task_mode.get_preemption_state(mode);
329  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
330  print_mode(mode, RTEMS_PREEMPT_MASK);
331  printf("\n");
332 
333  printf("%s - set preemption state to RTEMS_PREEMPT - ", self.name_string());
334  task_mode.set_preemption_state(RTEMS_PREEMPT);
335  task_mode.get_mode(mode);
336  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
337  print_mode(mode, RTEMS_ALL_MODES);
338  printf("\n");
339 
340  printf("%s - set preemption state to RTEMS_NO_PREEMPT - ", self.name_string());
341  task_mode.set_preemption_state(RTEMS_NO_PREEMPT);
342  task_mode.get_mode(mode);
343  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
344  print_mode(mode, RTEMS_ALL_MODES);
345  printf("\n");
346
347  // TIMESLICE mode control
348 
349  printf("%s - get timeslice state - ", self.name_string());
350  task_mode.get_timeslice_state(mode);
351  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
352  print_mode(mode, RTEMS_TIMESLICE_MASK);
353  printf("\n");
354 
355  printf("%s - set timeslice state to RTEMS_TIMESLICE - ", self.name_string());
356  task_mode.set_timeslice_state(RTEMS_TIMESLICE);
357  task_mode.get_mode(mode);
358  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
359  print_mode(mode, RTEMS_ALL_MODES);
360  printf("\n");
361 
362  printf("%s - set timeslice state to RTEMS_NO_TIMESLICE - ", self.name_string());
363  task_mode.set_timeslice_state(RTEMS_NO_TIMESLICE);
364  task_mode.get_mode(mode);
365  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
366  print_mode(mode, RTEMS_ALL_MODES);
367  printf("\n");
368
369  // ASR mode control
370 
371  printf("%s - get asr state - ", self.name_string());
372  task_mode.get_asr_state(mode);
373  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
374  print_mode(mode, RTEMS_ASR_MASK);
375  printf("\n");
376 
377  printf("%s - set asr state to RTEMS_ASR - ", self.name_string());
378  task_mode.set_asr_state(RTEMS_ASR);
379  task_mode.get_mode(mode);
380  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
381  print_mode(mode, RTEMS_ALL_MODES);
382  printf("\n");
383 
384  printf("%s - set asr state to RTEMS_NO_ASR - ", self.name_string());
385  task_mode.set_asr_state(RTEMS_NO_ASR);
386  task_mode.get_mode(mode);
387  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
388  print_mode(mode, RTEMS_ALL_MODES);
389  printf("\n");
390
391  // interrupt level control
392 
393  rtems_interrupt_level current_level;
394  rtems_interrupt_level level;
395
396  printf("%s - get current interrupt level - ", self.name_string());
397  task_mode.get_interrupt_level(current_level);
398  printf("%s, level is %i\n", task_mode.last_status_string(), current_level);
399
400  printf("%s - set interrupt level to 102 - ", self.name_string());
401  task_mode.set_interrupt_level(102);
402  printf("%s\n", task_mode.last_status_string());
403 
404  printf("%s - set interrupt level to original level - ", self.name_string());
405  task_mode.set_interrupt_level(current_level, level);
406  printf("%s, level was %i\n", task_mode.last_status_string(), level);
407
408  printf("%s - set mode to original mode - ", self.name_string());
409  task_mode.set_mode(current_mode,
410                     RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK |
411                     RTEMS_ASR_MASK | RTEMS_INTERRUPT_MASK);
412  task_mode.get_mode(mode);
413  printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
414  print_mode(mode, RTEMS_ALL_MODES);
415  printf("\n");
416 
417  printf(" * END TaskMode Class test *\n"); 
418}
419
420void Task1::screen4(void)
421{
422  printf(" * START Event Class test *\n");
423
424  printf("%s - create task 2 - ", name_string());
425  Task2 task_2("TA2", (rtems_task_priority) 9, RTEMS_MINIMUM_STACK_SIZE * 6);
426  printf("%s\n", task_2.last_status_string());
427
428  printf("%s - start task 2 - ", name_string());
429  task_2.start(0);
430  printf("%s\n", task_2.last_status_string());
431 
432  printf("%s - construct event connecting to task 2 - ", name_string());
433  rtemsEvent event_2("TA2 ");
434  printf("%s\n", event_2.last_status_string());
435
436  // wait for task 2 to complete its timeout tests
437  wake_after(7000000);
438
439  printf("%s - send event signal 0 using the task id - ", name_string());
440  event_2.send(task_2.id_is(), RTEMS_SIGNAL_0);
441  printf("%s\n", event_2.last_status_string());
442 
443  wake_after(1000000);
444
445  printf("%s - send event signal 0 using the task object reference - ", name_string());
446  event_2.send(task_2, RTEMS_SIGNAL_0);
447  printf("%s\n", event_2.last_status_string());
448 
449  wake_after(1000000);
450
451  printf("%s - send event signal 31 using connected id - ", name_string());
452  event_2.send(RTEMS_SIGNAL_31);
453  printf("%s\n", event_2.last_status_string());
454 
455  wake_after(1000000);
456
457  rtemsEvent event_2_2;
458
459  event_2_2.connect("TA2");
460 
461  printf("%s - send event signal 0 and 31 - ", name_string());
462  event_2_2.send(task_2, RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31);
463  printf("%s\n", event_2_2.last_status_string());
464 
465  printf("%s - waiting 5 secs for TA2 to finish\n", name_string());
466  wake_after(500000);
467 
468  printf(" * END Event Class test *\n"); 
469}
470
471void Task1::screen5(void)
472{
473  printf(" * START Interrupt Class test *\n");
474
475  printf(" do not know a portable BSP type interrupt test\n");
476
477  printf(" * END Interrupt Class test *\n"); 
478}
479
480void Task1::screen6(void)
481{
482  printf(" * START MessageQueue Class test *\n");
483
484  printf("%s - construct message queue 1 with no memory error - ", name_string());
485  rtemsMessageQueue mq_1("MQ1", 1000000, 1000);
486  printf("%s\n", mq_1.last_status_string());
487
488  printf("%s - construct/create message queue 2 - ", name_string());
489  rtemsMessageQueue mq_2("MQ2", 4, 50);
490  printf("%s\n", mq_2.last_status_string());
491
492  char *u1 = "normal send";
493  char *u2 = "urgent send";
494  char in[100];
495  rtems_unsigned32 size;
496 
497  printf("%s - send u1 to mq_2 - ", name_string());
498  mq_2.send(u1, strlen(u1) + 1);
499  printf("%s\n", mq_2.last_status_string());
500 
501  printf("%s - urgent send u2 to mq_2 - ", name_string());
502  mq_2.urgent(u2, strlen(u2) + 1);
503  printf("%s\n", mq_2.last_status_string());
504 
505  printf("%s - create task 3_1 - ", name_string());
506  Task3 task_3_1("TA31", 9, RTEMS_MINIMUM_STACK_SIZE * 6);
507  printf("%s\n", task_3_1.last_status_string());
508
509  printf("%s - start task 3_1 - ", name_string());
510  task_3_1.start(0);
511  printf("%s\n", task_3_1.last_status_string());
512 
513  printf("%s - create task 3_2 - ", name_string());
514  Task3 task_3_2("TA32", 9, RTEMS_MINIMUM_STACK_SIZE * 6);
515  printf("%s\n", task_3_2.last_status_string());
516
517  printf("%s - start task 3_2 - ", name_string());
518  task_3_2.start(0);
519  printf("%s\n", task_3_1.last_status_string());
520 
521  wake_after(1000000);
522 
523  printf("%s - receive u2 on mq_2 ...\n", name_string()); fflush(stdout);
524  mq_2.receive(in, size, 5000000);
525  printf("%s - %s\n", name_string(), mq_2.last_status_string());
526
527  if (size == (strlen(u2) + 5))
528  {
529    if ((strncmp(in, task_3_1.name_string(), 4) == 0) &&
530        (strcmp(in + 4, u2) == 0))
531    {
532      printf("%s - message u2 received correctly\n", name_string());
533    }
534    else
535    {
536      printf("%s - message u2 received incorrectly, message='%s', size=%i\n",
537             name_string(), in, size);
538    }
539  }
540  else
541    printf("%s - message u2 size incorrect, size=%i\n", name_string(), size);
542
543  printf("%s - receive u1 on mq_2 ...\n", name_string()); fflush(stdout);
544  mq_2.receive(in, size, 5000000);
545  printf("%s - %s\n", name_string(), mq_2.last_status_string());
546
547  if (size == (strlen(u1) + 5))
548  {
549    if ((strncmp(in, task_3_2.name_string(), 4) == 0) &&
550        (strcmp(in + 4, u1) == 0))
551    {
552      printf("%s - message u1 received correctly\n", name_string());
553    }
554    else
555    {
556      printf("%s - message u1 received incorrectly, message='%s', size=%i\n",
557             name_string(), in, size);
558    }
559  }
560  else
561    printf("%s - message u1 size incorrect, size=%i\n", name_string(), size);
562
563  wake_after(3000000);
564 
565  char *b1 = "broadcast message";
566  rtems_unsigned32 count;
567 
568  printf("%s - broadcast send b1 ...\n", name_string());
569  mq_2.broadcast(b1, strlen(b1) + 1, count);
570  printf("%s - mq_2 broadcast send - %s, count=%i\n",
571         name_string(), mq_2.last_status_string(), count);
572
573  wake_after(1000000);
574 
575  printf("%s - receive message b1 on mq_2 from %s...\n",
576         name_string(), task_3_1.name_string()); fflush(stdout);
577  mq_2.receive(in, size, 5000000);
578  printf("%s - %s\n", name_string(), mq_2.last_status_string());
579
580  if (size == (strlen(b1) + 5))
581  {
582    if ((strncmp(in, task_3_1.name_string(), 4) == 0) &&
583        (strcmp(in + 4, b1) == 0))
584    {
585      printf("%s - message b1 received correctly\n", name_string());
586    }
587    else
588    {
589      printf("%s - message b1 received incorrectly, message='%s'\n",
590             name_string(), in);
591    }
592  }
593  else
594    printf("%s - message b1 size incorrect, size=%i\n", name_string(), size);
595
596  printf("%s - receive message b1 on mq_2 from %s...\n",
597         name_string(), task_3_1.name_string()); fflush(stdout);
598  mq_2.receive(in, size, 5000000);
599  printf("%s - %s\n", name_string(), mq_2.last_status_string());
600
601  if (size == (strlen(b1) + 5))
602  {
603    if ((strncmp(in, task_3_2.name_string(), 4) == 0) &&
604        (strcmp(in + 4, b1) == 0))
605    {
606      printf("%s - message b1 received correctly\n", name_string());
607    }
608    else
609    {
610      printf("%s - message b1 received incorrectly, message='%s', size=%i\n",
611             name_string(), in, size);
612    }
613  }
614  else
615    printf("%s - message b1 size incorrect, size=%i\n", name_string(), size);
616
617  // wait for task 3_1, and 3_2 to complete their timeout tests, will start these after
618  // getting the broadcast message
619  wake_after(7000000); 
620
621  char *f1 = "flush message";
622 
623  printf("%s - send f1 to mq_2 - ", name_string());
624  mq_2.send(f1, strlen(f1) + 1);
625  printf("%s\n", mq_2.last_status_string());
626 
627  printf("%s - send f1 to mq_2 - ", name_string());
628  mq_2.send(f1, strlen(f1) + 1);
629  printf("%s\n", mq_2.last_status_string());
630 
631  printf("%s - send f1 to mq_2 - ", name_string());
632  mq_2.send(f1, strlen(f1) + 1);
633  printf("%s\n", mq_2.last_status_string());
634
635  printf("%s - flush mq_2 - ", name_string());
636  mq_2.flush(size);
637  printf("%s, flushed=%i\n", mq_2.last_status_string(), size);
638 
639  printf(" * END MessageQueue Class test *\n"); 
640}
641
642void Task1::print_mode(rtems_mode mode, rtems_mode mask)
643{
644  rtemsTaskMode task_mode;
645  if (mask & RTEMS_PREEMPT_MASK)
646    printf("RTEMS_%sPREEMPT ",
647           task_mode.preemption_set(mode) ? "" : "NO_");
648  if (mask & RTEMS_TIMESLICE_MASK)
649    printf("RTEMS_%sTIMESLICE ",
650           task_mode.preemption_set(mode) ? "" : "NO_");
651  if (mask & RTEMS_ASR_MASK)
652    printf("RTEMS_%sASR ",
653           task_mode.asr_set(mode) ? "" : "NO_");
654  if (mask & RTEMS_INTERRUPT_MASK)
655    printf("INTMASK=%i",
656           mode & RTEMS_INTERRUPT_MASK);
657}
Note: See TracBrowser for help on using the repository browser.