1 | /* |
---|
2 | * Exercise Classic API Workspace Wrappers |
---|
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 | #include <tmacros.h> |
---|
15 | |
---|
16 | |
---|
17 | rtems_task Init( |
---|
18 | rtems_task_argument argument |
---|
19 | ) |
---|
20 | { |
---|
21 | void *p1; |
---|
22 | bool retbool; |
---|
23 | Heap_Information_block info; |
---|
24 | |
---|
25 | puts( "\n\n*** TEST WORKSPACE CLASSIC API ***" ); |
---|
26 | |
---|
27 | puts( "rtems_workspace_get_information - null pointer" ); |
---|
28 | retbool = rtems_workspace_get_information( NULL ); |
---|
29 | assert( retbool == false ); |
---|
30 | |
---|
31 | puts( "rtems_workspace_get_information - OK" ); |
---|
32 | retbool = rtems_workspace_get_information( &info ); |
---|
33 | assert( retbool == true ); |
---|
34 | |
---|
35 | puts( "rtems_workspace_allocate - null pointer" ); |
---|
36 | retbool = rtems_workspace_allocate( 42, NULL ); |
---|
37 | assert( retbool == false ); |
---|
38 | |
---|
39 | puts( "rtems_workspace_allocate - 0 bytes" ); |
---|
40 | retbool = rtems_workspace_allocate( 0, &p1 ); |
---|
41 | assert( retbool == false ); |
---|
42 | |
---|
43 | puts( "rtems_workspace_allocate - too many bytes" ); |
---|
44 | retbool = rtems_workspace_allocate( info.Free.largest * 2, &p1 ); |
---|
45 | assert( retbool == false ); |
---|
46 | |
---|
47 | puts( "rtems_workspace_allocate - 42 bytes" ); |
---|
48 | retbool = rtems_workspace_allocate( 42, &p1 ); |
---|
49 | assert( retbool == true ); |
---|
50 | assert( p1 != NULL ); |
---|
51 | |
---|
52 | puts( "rtems_workspace_free - NULL" ); |
---|
53 | retbool = rtems_workspace_free( NULL ); |
---|
54 | assert( retbool == false ); |
---|
55 | |
---|
56 | puts( "rtems_workspace_free - previous pointer to 42 bytes" ); |
---|
57 | retbool = rtems_workspace_free( p1 ); |
---|
58 | assert( retbool == true ); |
---|
59 | |
---|
60 | puts( "*** END OF TEST WORKSPACE CLASSIC API ***" ); |
---|
61 | rtems_test_exit( 0 ); |
---|
62 | } |
---|
63 | |
---|
64 | /* configuration information */ |
---|
65 | |
---|
66 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
67 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
68 | |
---|
69 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
70 | |
---|
71 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
72 | |
---|
73 | #define CONFIGURE_INIT |
---|
74 | #include <rtems/confdefs.h> |
---|