source:
rtems/testsuites/sptests/spobjgetnext/init.c
@
d5ae827
Last change on this file since d5ae827 was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/09 at 14:39:46 | |
---|---|
|
|
File size: 2.1 KB |
Rev | Line | |
---|---|---|
[c14c2f0] | 1 | /* |
2 | * Exercise SuperCore Object Get Next | |
3 | * | |
4 | * COPYRIGHT (c) 1989-2009. | |
5 | * On-Line Applications Research Corporation (OAR). | |
6 | * | |
7 | * The license and distribution terms for this file may be | |
8 | * found in the file LICENSE in this distribution or at | |
9 | * http://www.rtems.com/license/LICENSE. | |
10 | * | |
11 | * $Id$ | |
12 | */ | |
13 | ||
14 | #define CONFIGURE_INIT | |
15 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1 | |
16 | #include "system.h" | |
17 | ||
[b84f1fdc] | 18 | /* prototypes */ |
19 | int scan_objects( | |
20 | Objects_Information *information, | |
21 | Objects_Id start | |
22 | ); | |
23 | ||
[c14c2f0] | 24 | #define MAX_SCAN 10 |
[b84f1fdc] | 25 | |
[c14c2f0] | 26 | int scan_objects( |
27 | Objects_Information *information, | |
28 | Objects_Id start | |
29 | ) | |
30 | { | |
31 | Objects_Control *o[MAX_SCAN]; | |
32 | int i; | |
33 | Objects_Locations location; | |
34 | Objects_Id id; | |
35 | ||
36 | memset( o, 1, sizeof(o) ); | |
37 | ||
38 | id = start; | |
39 | for (i=0 ; i<MAX_SCAN ; i++ ) { | |
40 | o[i] = _Objects_Get_next( | |
41 | information, | |
42 | id, | |
43 | &location, | |
44 | &id | |
45 | ); | |
46 | if ( !o[i] ) | |
47 | break; | |
48 | if ( location == OBJECTS_ERROR ) | |
49 | break; | |
50 | /* XXX check dispatch level with macros */ | |
51 | ||
52 | _Thread_Enable_dispatch(); | |
53 | ||
54 | /* XXX should be able to check that next Id is not one we have seen */ | |
55 | } | |
56 | return i; | |
57 | } | |
58 | ||
59 | rtems_task Init( | |
60 | rtems_task_argument argument | |
61 | ) | |
62 | { | |
63 | rtems_status_code status; | |
64 | rtems_id main_task; | |
65 | int count; | |
66 | ||
67 | puts( "\n\n*** TEST OBJECT GET NEXT ***" ); | |
68 | ||
69 | main_task = rtems_task_self(); | |
70 | ||
71 | /* XXX push the three NULL error cases */ | |
72 | ||
73 | /* simple case of only all tasks in the system, starting at initial */ | |
74 | count = scan_objects( &_RTEMS_tasks_Information, OBJECTS_ID_INITIAL_INDEX ); | |
75 | printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") ); | |
76 | assert( count == 1 ); | |
77 | ||
78 | /* simple case of only 1 task in the system, starting at that task */ | |
79 | count = scan_objects( &_RTEMS_tasks_Information, main_task ); | |
80 | printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") ); | |
81 | assert( count == 1 ); | |
82 | ||
83 | /* XXX create >= 1 task and make sure the counts are correct when */ | |
84 | /* XXX you start the search at initial, first id, arbitrary id */ | |
85 | ||
86 | /* XXX try with a manager with no objects created */ | |
87 | ||
88 | puts( "*** END OF TEST OBJECT GET NEXT ***" ); | |
89 | rtems_test_exit( 0 ); | |
90 | } |
Note: See TracBrowser
for help on using the repository browser.