1 | /* Delayed_events_task |
---|
2 | * |
---|
3 | * This task continuously sends itself events at one tick |
---|
4 | * intervals. |
---|
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 | |
---|
24 | rtems_task Delayed_events_task( |
---|
25 | rtems_task_argument argument |
---|
26 | ) |
---|
27 | { |
---|
28 | rtems_unsigned32 count; |
---|
29 | rtems_unsigned32 previous_mode; |
---|
30 | rtems_status_code status; |
---|
31 | rtems_event_set events; |
---|
32 | |
---|
33 | status = rtems_task_mode( |
---|
34 | RTEMS_PREEMPT | RTEMS_TIMESLICE, |
---|
35 | RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, |
---|
36 | &previous_mode |
---|
37 | ); |
---|
38 | directive_failed( status, "rtems_task_mode" ); |
---|
39 | |
---|
40 | status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); |
---|
41 | directive_failed( status, "rtems_timer_create" ); |
---|
42 | |
---|
43 | while ( Stop_Test == FALSE ) { |
---|
44 | for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == FALSE && count; count-- ){ |
---|
45 | status = rtems_timer_fire_after( |
---|
46 | Timer_id[ 1 ], |
---|
47 | 1, |
---|
48 | Delayed_send_event, |
---|
49 | NULL |
---|
50 | ); |
---|
51 | directive_failed( status, "rtems_timer_reset" ); |
---|
52 | |
---|
53 | status = rtems_event_receive( |
---|
54 | RTEMS_EVENT_16, |
---|
55 | RTEMS_DEFAULT_OPTIONS, |
---|
56 | RTEMS_NO_TIMEOUT, |
---|
57 | &events |
---|
58 | ); |
---|
59 | directive_failed( status, "rtems_event_receive" ); |
---|
60 | } |
---|
61 | put_dot('.'); |
---|
62 | } |
---|
63 | |
---|
64 | Exit_test(); |
---|
65 | } |
---|