1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2009. |
---|
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 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #include <tmacros.h> |
---|
13 | |
---|
14 | rtems_task Init( |
---|
15 | rtems_task_argument argument |
---|
16 | ) |
---|
17 | { |
---|
18 | rtems_status_code sc; |
---|
19 | rtems_id mutex; |
---|
20 | |
---|
21 | puts( "\n\n*** TEST 51 ***" ); |
---|
22 | |
---|
23 | puts( "Create semaphore - priority ceiling locked - violate ceiling" ); |
---|
24 | sc = rtems_semaphore_create( |
---|
25 | rtems_build_name( 'S', 'E', 'M', '1' ), |
---|
26 | 0, |
---|
27 | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY, |
---|
28 | (RTEMS_MAXIMUM_PRIORITY - 4u), |
---|
29 | &mutex |
---|
30 | ); |
---|
31 | fatal_directive_status(sc, RTEMS_INVALID_PRIORITY, "rtems_semaphore_create"); |
---|
32 | |
---|
33 | puts( "Create semaphore - priority ceiling unlocked" ); |
---|
34 | sc = rtems_semaphore_create( |
---|
35 | rtems_build_name( 'S', 'E', 'M', '1' ), |
---|
36 | 1, |
---|
37 | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY, |
---|
38 | (RTEMS_MAXIMUM_PRIORITY - 4u), |
---|
39 | &mutex |
---|
40 | ); |
---|
41 | directive_failed( sc, "rtems_semaphore_create" ); |
---|
42 | |
---|
43 | puts( "Obtain semaphore -- violate ceiling" ); |
---|
44 | sc = rtems_semaphore_obtain( mutex, RTEMS_DEFAULT_OPTIONS, 0 ); |
---|
45 | fatal_directive_status( |
---|
46 | sc, RTEMS_INVALID_PRIORITY, "rtems_semaphore_obtain" ); |
---|
47 | |
---|
48 | /* This returns successful because RTEMS eats the unneeded unlock */ |
---|
49 | puts( "Release semaphore we did not obtain" ); |
---|
50 | sc = rtems_semaphore_release( mutex ); |
---|
51 | directive_failed( sc, "rtems_semaphore_release" ); |
---|
52 | |
---|
53 | puts( "*** END OF TEST 51 ***" ); |
---|
54 | rtems_test_exit( 0 ); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | /**************** START OF CONFIGURATION INFORMATION ****************/ |
---|
59 | |
---|
60 | #define CONFIGURE_INIT |
---|
61 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
62 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
63 | |
---|
64 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
65 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
66 | |
---|
67 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
68 | |
---|
69 | #include <rtems/confdefs.h> |
---|
70 | |
---|
71 | /**************** END OF CONFIGURATION INFORMATION ****************/ |
---|