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-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.rtems.com/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifdef HAVE_CONFIG_H |
---|
20 | #include "config.h" |
---|
21 | #endif |
---|
22 | |
---|
23 | #include "system.h" |
---|
24 | |
---|
25 | rtems_task Delayed_events_task( |
---|
26 | rtems_task_argument argument |
---|
27 | ) |
---|
28 | { |
---|
29 | uint32_t count; |
---|
30 | uint32_t previous_mode; |
---|
31 | rtems_status_code status; |
---|
32 | rtems_event_set events; |
---|
33 | rtems_id self; |
---|
34 | |
---|
35 | status = rtems_task_mode( |
---|
36 | RTEMS_PREEMPT | RTEMS_TIMESLICE, |
---|
37 | RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, |
---|
38 | &previous_mode |
---|
39 | ); |
---|
40 | directive_failed( status, "rtems_task_mode" ); |
---|
41 | |
---|
42 | status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); |
---|
43 | directive_failed( status, "rtems_timer_create" ); |
---|
44 | |
---|
45 | self = rtems_task_self(); |
---|
46 | |
---|
47 | while ( Stop_Test == false ) { |
---|
48 | for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == false && count; count-- ){ |
---|
49 | status = rtems_timer_fire_after( |
---|
50 | Timer_id[ 1 ], |
---|
51 | 1, |
---|
52 | Delayed_send_event, |
---|
53 | &self |
---|
54 | ); |
---|
55 | directive_failed( status, "rtems_timer_reset" ); |
---|
56 | |
---|
57 | status = rtems_event_receive( |
---|
58 | RTEMS_EVENT_16, |
---|
59 | RTEMS_DEFAULT_OPTIONS, |
---|
60 | RTEMS_NO_TIMEOUT, |
---|
61 | &events |
---|
62 | ); |
---|
63 | directive_failed( status, "rtems_event_receive" ); |
---|
64 | } |
---|
65 | put_dot('.'); |
---|
66 | } |
---|
67 | |
---|
68 | Exit_test(); |
---|
69 | } |
---|