source: rtems/testsuites/sptests/sp14/task1.c @ 8fbdf07

4.104.114.84.9
Last change on this file since 8fbdf07 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 17, 1999 at 5:51:34 PM

Updated copyright notice.

  • Property mode set to 100644
File size: 3.3 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-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$
19 */
20
21#include "system.h"
22
23rtems_timer_service_routine Signal_3_to_task_1(
24  rtems_id  id,
25  void     *pointer
26)
27{
28  rtems_status_code status;
29
30  status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 );
31  directive_failed_with_level( status, "rtems_signal_send of 3", 1 );
32
33  Timer_got_this_id  = id;
34  Timer_got_this_pointer = pointer;
35
36  Signals_sent = TRUE;
37}
38
39rtems_task Task_1(
40  rtems_task_argument argument
41)
42{
43  rtems_mode        previous_mode;
44  rtems_status_code status;
45
46  puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
47  status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
48  directive_failed( status, "rtems_signal_catch" );
49
50  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
51  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
52  directive_failed( status, "rtems_signal_send" );
53
54  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
55  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
56  directive_failed( status, "rtems_signal_send" );
57
58  puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
59  status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
60  directive_failed( status, "rtems_signal_catch" );
61
62rtems_test_pause();
63
64  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
65  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
66  directive_failed( status, "rtems_signal_send" );
67
68  puts( "TA1 - rtems_task_mode - disable ASRs" );
69  status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
70  directive_failed( status, "rtems_task_mode" );
71
72  Timer_got_this_id = 0;
73  Timer_got_this_pointer = NULL;
74
75  puts( "TA1 - sending signal to RTEMS_SELF from timer" );
76  status = rtems_timer_fire_after(
77    Timer_id[ 1 ],
78    TICKS_PER_SECOND / 2,
79    Signal_3_to_task_1,
80    (void *) Task_1
81  );
82  directive_failed( status, "rtems_timer_fire_after" );
83
84  puts( "TA1 - waiting for signal to arrive" );
85
86  Signals_sent = FALSE;
87  Asr_fired    = FALSE;
88
89  while ( Signals_sent == FALSE )
90    ;
91
92  if ( Timer_got_this_id == Timer_id[ 1 ] &&
93       Timer_got_this_pointer == Task_1 )
94    puts( "TA1 - timer routine got the correct arguments" );
95  else
96    printf(
97      "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n",
98      Timer_got_this_id,
99      Timer_got_this_pointer,
100      Timer_id[ 1 ],
101      Task_1
102    );
103
104  puts( "TA1 - rtems_task_mode - enable ASRs" );
105  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
106  directive_failed( status, "rtems_task_mode" );
107
108  puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
109  status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
110  directive_failed( status, "rtems_signal_catch" );
111
112  puts( "TA1 - rtems_task_delete - delete self" );
113  status = rtems_task_delete( RTEMS_SELF );
114  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
115}
Note: See TracBrowser for help on using the repository browser.