1 | /* Init |
---|
2 | * |
---|
3 | * This routine is the XXX. |
---|
4 | * |
---|
5 | * Input parameters: |
---|
6 | * argument - task argument |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifdef HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #define CONFIGURE_INIT |
---|
23 | #include "system.h" |
---|
24 | |
---|
25 | #include <rtems/score/watchdogimpl.h> |
---|
26 | |
---|
27 | const char rtems_test_name[] = "SPWATCHDOG"; |
---|
28 | |
---|
29 | static void test_watchdog_routine( Objects_Id id, void *arg ) |
---|
30 | { |
---|
31 | (void) id; |
---|
32 | (void) arg; |
---|
33 | |
---|
34 | rtems_test_assert( 0 ); |
---|
35 | } |
---|
36 | |
---|
37 | static void test_watchdog_static_init( void ) |
---|
38 | { |
---|
39 | #if defined(RTEMS_USE_16_BIT_OBJECT) |
---|
40 | #define JUNK_ID 0x1234 |
---|
41 | #else |
---|
42 | #define JUNK_ID 0x12345678 |
---|
43 | #endif |
---|
44 | |
---|
45 | static Watchdog_Control a = WATCHDOG_INITIALIZER( |
---|
46 | test_watchdog_routine, |
---|
47 | JUNK_ID, |
---|
48 | (void *) 0xdeadbeef |
---|
49 | ); |
---|
50 | Watchdog_Control b; |
---|
51 | |
---|
52 | memset( &b, 0, sizeof( b ) ); |
---|
53 | _Watchdog_Initialize( |
---|
54 | &b, |
---|
55 | test_watchdog_routine, |
---|
56 | JUNK_ID, |
---|
57 | (void *) 0xdeadbeef |
---|
58 | ); |
---|
59 | |
---|
60 | rtems_test_assert( memcmp( &a, &b, sizeof( a ) ) == 0 ); |
---|
61 | } |
---|
62 | |
---|
63 | rtems_task Init( |
---|
64 | rtems_task_argument argument |
---|
65 | ) |
---|
66 | { |
---|
67 | rtems_time_of_day time; |
---|
68 | rtems_status_code status; |
---|
69 | |
---|
70 | TEST_BEGIN(); |
---|
71 | |
---|
72 | test_watchdog_static_init(); |
---|
73 | |
---|
74 | build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); |
---|
75 | |
---|
76 | status = rtems_clock_set( &time ); |
---|
77 | directive_failed( status, "rtems_clock_set" ); |
---|
78 | |
---|
79 | Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
---|
80 | Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); |
---|
81 | |
---|
82 | status = rtems_task_create( |
---|
83 | Task_name[ 1 ], |
---|
84 | 1, |
---|
85 | RTEMS_MINIMUM_STACK_SIZE * 2, |
---|
86 | RTEMS_DEFAULT_MODES, |
---|
87 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
88 | &Task_id[ 1 ] |
---|
89 | ); |
---|
90 | directive_failed( status, "rtems_task_create of TA1" ); |
---|
91 | |
---|
92 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
93 | directive_failed( status, "rtems_task_start of TA1" ); |
---|
94 | |
---|
95 | puts( "INIT - rtems_timer_create - creating timer 1" ); |
---|
96 | status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); |
---|
97 | directive_failed( status, "rtems_timer_create" ); |
---|
98 | |
---|
99 | printf( "INIT - timer 1 has id (0x%" PRIxrtems_id ")\n", Timer_id[ 1 ] ); |
---|
100 | |
---|
101 | status = rtems_task_delete( RTEMS_SELF ); |
---|
102 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
103 | |
---|
104 | |
---|
105 | rtems_test_exit( 0 ); |
---|
106 | } |
---|