1 | /* Restart a task which is delaying |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 1989-2011. |
---|
4 | * On-Line Applications Research Corporation (OAR). |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifdef HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <tmacros.h> |
---|
18 | |
---|
19 | rtems_task Delay_task( |
---|
20 | rtems_task_argument ignored |
---|
21 | ) |
---|
22 | { |
---|
23 | rtems_status_code status; |
---|
24 | |
---|
25 | puts( "Delay - rtems_task_wake_after - OK" ); |
---|
26 | status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(2000) ); |
---|
27 | directive_failed( status, "wake after" ); |
---|
28 | |
---|
29 | puts( "ERROR - delay task woke up!!" ); |
---|
30 | rtems_test_exit(0); |
---|
31 | } |
---|
32 | |
---|
33 | rtems_task Init( |
---|
34 | rtems_task_argument ignored |
---|
35 | ) |
---|
36 | { |
---|
37 | rtems_status_code status; |
---|
38 | rtems_id task_id; |
---|
39 | |
---|
40 | puts( "\n\n*** TEST 57 ***" ); |
---|
41 | |
---|
42 | puts( "Init - rtems_task_create - delay task - OK" ); |
---|
43 | status = rtems_task_create( |
---|
44 | rtems_build_name( 'T', 'A', '1', ' ' ), |
---|
45 | 1, |
---|
46 | RTEMS_MINIMUM_STACK_SIZE, |
---|
47 | RTEMS_DEFAULT_OPTIONS, |
---|
48 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
49 | &task_id |
---|
50 | ); |
---|
51 | directive_failed( status, "rtems_task_create" ); |
---|
52 | |
---|
53 | puts( "Init - rtems_task_start - delay task - OK" ); |
---|
54 | status = rtems_task_start( task_id, Delay_task, 0 ); |
---|
55 | directive_failed( status, "rtems_task_start" ); |
---|
56 | |
---|
57 | puts( "Init - rtems_task_wake_after - let delay task block - OK" ); |
---|
58 | status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); |
---|
59 | directive_failed( status, "rtems_task_wake_after" ); |
---|
60 | |
---|
61 | puts( "Init - rtems_task_restart - delay task - OK" ); |
---|
62 | status = rtems_task_restart( task_id, 0 ); |
---|
63 | directive_failed( status, "rtems_task_restart" ); |
---|
64 | |
---|
65 | puts( "*** END OF TEST 57 ***" ); |
---|
66 | rtems_test_exit(0); |
---|
67 | } |
---|
68 | |
---|
69 | /* configuration information */ |
---|
70 | |
---|
71 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
72 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
73 | |
---|
74 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
75 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
76 | |
---|
77 | #define CONFIGURE_INIT |
---|
78 | #include <rtems/confdefs.h> |
---|
79 | |
---|
80 | /* global variables */ |
---|