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

5
Last change on this file since e6df806 was e6df806, checked in by Chris Johns <chrisj@…>, on 11/08/17 at 02:27:25

tests: Use ld to map (wrap) printf, puts and putchar to tester functions.

  • Remove the macro defines and the need for tmacro.h by remapping the symbols using ld's wrap option.
  • Remove FLUSH_OUTPUT, it was empty.
  • Move rtems_test_exit to libmisc/testsupport as a function.

Update #3199.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include "system.h"
15
16rtems_timer_service_routine Signal_3_to_task_1(
17  rtems_id  id,
18  void     *pointer
19)
20{
21  rtems_status_code status;
22
23  status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 );
24  directive_failed_with_level( status, "rtems_signal_send of 3", 1 );
25
26  Timer_got_this_id  = id;
27  Timer_got_this_pointer = pointer;
28
29  Signals_sent = TRUE;
30}
31
32rtems_task Task_1(
33  rtems_task_argument argument
34)
35{
36  rtems_mode        previous_mode;
37  rtems_status_code status;
38
39  puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
40  status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
41  directive_failed( status, "rtems_signal_catch" );
42
43  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
44  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
45  directive_failed( status, "rtems_signal_send" );
46
47  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
48  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
49  directive_failed( status, "rtems_signal_send" );
50
51  puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
52  status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
53  directive_failed( status, "rtems_signal_catch" );
54
55  rtems_test_pause();
56
57  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
58  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
59  directive_failed( status, "rtems_signal_send" );
60
61  puts( "TA1 - rtems_task_mode - disable ASRs" );
62  status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
63  directive_failed( status, "rtems_task_mode" );
64
65  Timer_got_this_id = 0;
66  Timer_got_this_pointer = NULL;
67
68  puts( "TA1 - sending signal to RTEMS_SELF from timer" );
69  status = rtems_timer_fire_after(
70    Timer_id[ 1 ],
71    rtems_clock_get_ticks_per_second() / 2,
72    Signal_3_to_task_1,
73    (void *) Task_1
74  );
75  directive_failed( status, "rtems_timer_fire_after" );
76
77  puts( "TA1 - waiting for signal to arrive" );
78
79  Signals_sent = FALSE;
80  Asr_fired    = FALSE;
81
82  while ( Signals_sent == FALSE )
83    ;
84
85  if ( Timer_got_this_id == Timer_id[ 1 ] &&
86       Timer_got_this_pointer == Task_1 )
87    puts( "TA1 - timer routine got the correct arguments" );
88  else
89    printf(
90      "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%"
91        PRIxrtems_id ", %p)!!!!\n",
92      Timer_got_this_id,
93      Timer_got_this_pointer,
94      Timer_id[ 1 ],
95      Task_1
96    );
97
98  puts( "TA1 - rtems_task_mode - enable ASRs" );
99  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
100  directive_failed( status, "rtems_task_mode" );
101
102  status = rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second());
103  directive_failed( status, "rtems_task_wake_after" );
104
105  puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
106  status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
107  directive_failed( status, "rtems_signal_catch" );
108
109  puts( "TA1 - rtems_task_delete - delete self" );
110  status = rtems_task_delete( RTEMS_SELF );
111  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
112}
Note: See TracBrowser for help on using the repository browser.