1 | /* |
---|
2 | * COPYRIGHT (c) 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.com/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <tmacros.h> |
---|
15 | |
---|
16 | rtems_task Test_task( |
---|
17 | rtems_task_argument index |
---|
18 | ) |
---|
19 | { |
---|
20 | rtems_status_code status; |
---|
21 | rtems_name name; |
---|
22 | |
---|
23 | status = rtems_object_get_classic_name( rtems_task_self(), &name ); |
---|
24 | directive_failed( status, "rtems_object_get_classic_name" ); |
---|
25 | |
---|
26 | put_name( name, FALSE ); |
---|
27 | puts( " - Successfully yielded it to higher priority task" ); |
---|
28 | |
---|
29 | puts( "*** END OF SP76 TEST ***" ); |
---|
30 | rtems_test_exit( 0 ); |
---|
31 | } |
---|
32 | |
---|
33 | rtems_task Init( |
---|
34 | rtems_task_argument argument |
---|
35 | ) |
---|
36 | { |
---|
37 | rtems_status_code status; |
---|
38 | rtems_id id; |
---|
39 | rtems_task_priority old; |
---|
40 | |
---|
41 | puts( "\n\n*** SP76 (YIELD) TEST ***" ); |
---|
42 | |
---|
43 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id ); |
---|
44 | directive_failed( status, "task ident" ); |
---|
45 | |
---|
46 | /* to make sure it is equal to TA2 */ |
---|
47 | puts( "Set Init task priority = 2" ); |
---|
48 | status = rtems_task_set_priority( id, 2, &old ); |
---|
49 | directive_failed( status, "task priority" ); |
---|
50 | |
---|
51 | puts( "Create TA1 at higher priority task" ); |
---|
52 | status = rtems_task_create( |
---|
53 | rtems_build_name( 'T', 'A', '1', ' ' ), |
---|
54 | 1, |
---|
55 | RTEMS_MINIMUM_STACK_SIZE, |
---|
56 | RTEMS_DEFAULT_MODES, |
---|
57 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
58 | &id |
---|
59 | ); |
---|
60 | directive_failed( status, "create 1" ); |
---|
61 | |
---|
62 | status = rtems_task_start( id, Test_task, 1 ); |
---|
63 | directive_failed( status, "start 1" ); |
---|
64 | |
---|
65 | puts( "Create TA2 at equal priority task" ); |
---|
66 | status = rtems_task_create( |
---|
67 | rtems_build_name( 'T', 'A', '2', ' ' ), |
---|
68 | 2, |
---|
69 | RTEMS_MINIMUM_STACK_SIZE, |
---|
70 | RTEMS_DEFAULT_MODES, |
---|
71 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
72 | &id |
---|
73 | ); |
---|
74 | directive_failed( status, "create 2" ); |
---|
75 | |
---|
76 | status = rtems_task_start( id, Test_task, 1 ); |
---|
77 | directive_failed( status, "start 2" ); |
---|
78 | |
---|
79 | puts( "Yield to TA1" ); |
---|
80 | status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); |
---|
81 | directive_failed( status, "yield" ); |
---|
82 | |
---|
83 | puts( "*** should now get here ***" ); |
---|
84 | } |
---|
85 | |
---|
86 | /* configuration information */ |
---|
87 | #include <bsp.h> /* for device driver prototypes */ |
---|
88 | |
---|
89 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
90 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
91 | |
---|
92 | #define CONFIGURE_MAXIMUM_TASKS 3 |
---|
93 | #define CONFIGURE_INIT_TASK_PRIORITY 2 |
---|
94 | |
---|
95 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
96 | |
---|
97 | #define CONFIGURE_INIT |
---|
98 | #include <rtems/confdefs.h> |
---|
99 | /* end of file */ |
---|