1 | /* Restart a task which is delaying |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 1989-2009. |
---|
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 | #include <tmacros.h> |
---|
14 | |
---|
15 | rtems_task Delay_task( |
---|
16 | rtems_task_argument ignored |
---|
17 | ) |
---|
18 | { |
---|
19 | rtems_status_code status; |
---|
20 | |
---|
21 | puts( "Delay - rtems_task_wake_after - OK" ); |
---|
22 | status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(2000) ); |
---|
23 | |
---|
24 | puts( "ERROR - delay task woke up!!" ); |
---|
25 | rtems_test_exit(0); |
---|
26 | } |
---|
27 | |
---|
28 | rtems_task Init( |
---|
29 | rtems_task_argument ignored |
---|
30 | ) |
---|
31 | { |
---|
32 | rtems_status_code status; |
---|
33 | rtems_id task_id; |
---|
34 | |
---|
35 | puts( "\n\n*** TEST 57 ***" ); |
---|
36 | |
---|
37 | puts( "Init - rtems_task_create - delay task - OK" ); |
---|
38 | status = rtems_task_create( |
---|
39 | rtems_build_name( 'T', 'A', '1', ' ' ), |
---|
40 | 1, |
---|
41 | RTEMS_MINIMUM_STACK_SIZE, |
---|
42 | RTEMS_DEFAULT_OPTIONS, |
---|
43 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
44 | &task_id |
---|
45 | ); |
---|
46 | directive_failed( status, "rtems_task_create" ); |
---|
47 | |
---|
48 | puts( "Init - rtems_task_start - delay task - OK" ); |
---|
49 | status = rtems_task_start( task_id, Delay_task, 0 ); |
---|
50 | directive_failed( status, "rtems_task_start" ); |
---|
51 | |
---|
52 | puts( "Init - rtems_task_wake_after - let delay task block - OK" ); |
---|
53 | status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); |
---|
54 | directive_failed( status, "rtems_task_wake_after" ); |
---|
55 | |
---|
56 | puts( "Init - rtems_task_restart - delay task - OK" ); |
---|
57 | status = rtems_task_restart( task_id, 0 ); |
---|
58 | directive_failed( status, "rtems_task_restart" ); |
---|
59 | |
---|
60 | puts( "*** END OF TEST 57 ***" ); |
---|
61 | rtems_test_exit(0); |
---|
62 | } |
---|
63 | |
---|
64 | /* configuration information */ |
---|
65 | |
---|
66 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
67 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
68 | |
---|
69 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
70 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
71 | |
---|
72 | #define CONFIGURE_INIT |
---|
73 | #include <rtems/confdefs.h> |
---|
74 | |
---|
75 | /* global variables */ |
---|