source: rtems/testsuites/sptests/sp14/task1.c @ ba39113

4.104.114.84.95
Last change on this file since ba39113 was ba39113, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 22, 1996 at 8:14:36 PM

The name of the test support routine pause was changed to rtems_test_pause
to avoid conflict with the standard POSIX routine pause(2).

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*  Task_1
2 *
3 *  This routine serves as a test task.  It establishes an RTEMS_ASR and
4 *  sends signal to itself to determine if the RTEMS_ASR gets to execute.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24rtems_timer_service_routine Signal_3_to_task_1(
25  rtems_id  id,
26  void     *pointer
27)
28{
29  rtems_status_code status;
30
31  status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 );
32  directive_failed( status, "rtems_signal_send of 3" );
33
34  Timer_got_this_id  = id;
35  Timer_got_this_pointer = pointer;
36
37  Signals_sent = TRUE;
38}
39
40rtems_task Task_1(
41  rtems_task_argument argument
42)
43{
44  rtems_mode        previous_mode;
45  rtems_status_code status;
46
47  puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
48  status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
49  directive_failed( status, "rtems_signal_catch" );
50
51  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
52  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
53  directive_failed( status, "rtems_signal_send" );
54
55  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
56  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
57  directive_failed( status, "rtems_signal_send" );
58
59  puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
60  status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
61  directive_failed( status, "rtems_signal_catch" );
62
63rtems_test_pause();
64
65  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
66  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
67  directive_failed( status, "rtems_signal_send" );
68
69  puts( "TA1 - rtems_task_mode - disable ASRs" );
70  status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
71  directive_failed( status, "rtems_task_mode" );
72
73  Timer_got_this_id = 0;
74  Timer_got_this_pointer = NULL;
75
76  puts( "TA1 - sending signal to RTEMS_SELF from timer" );
77  status = rtems_timer_fire_after(
78    Timer_id[ 1 ],
79    TICKS_PER_SECOND / 2,
80    Signal_3_to_task_1,
81    Task_1
82  );
83  directive_failed( status, "rtems_timer_fire_after" );
84
85  puts( "TA1 - waiting for signal to arrive" );
86
87  Signals_sent = FALSE;
88  Asr_fired    = FALSE;
89
90  while ( Signals_sent == FALSE )
91    ;
92
93  if ( Timer_got_this_id == Timer_id[ 1 ] &&
94       Timer_got_this_pointer == Task_1 )
95    puts( "TA1 - timer routine got the correct arguments" );
96  else
97    printf(
98      "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n",
99      Timer_got_this_id,
100      Timer_got_this_pointer,
101      Timer_id[ 1 ],
102      Task_1
103    );
104
105  puts( "TA1 - rtems_task_mode - enable ASRs" );
106  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
107  directive_failed( status, "rtems_task_mode" );
108
109  puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
110  status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
111  directive_failed( status, "rtems_signal_catch" );
112
113  puts( "TA1 - rtems_task_delete - delete self" );
114  status = rtems_task_delete( RTEMS_SELF );
115  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
116}
Note: See TracBrowser for help on using the repository browser.