1 | /* |
---|
2 | * Semaphore Manager |
---|
3 | * |
---|
4 | * DESCRIPTION: |
---|
5 | * |
---|
6 | * This package is the implementation of the Semaphore Manager. |
---|
7 | * This manager utilizes standard Dijkstra counting semaphores to provide |
---|
8 | * synchronization and mutual exclusion capabilities. |
---|
9 | * |
---|
10 | * Directives provided are: |
---|
11 | * |
---|
12 | * + create a semaphore |
---|
13 | * + get an ID of a semaphore |
---|
14 | * + delete a semaphore |
---|
15 | * + acquire a semaphore |
---|
16 | * + release a semaphore |
---|
17 | * |
---|
18 | * COPYRIGHT (c) 1989-1998. |
---|
19 | * On-Line Applications Research Corporation (OAR). |
---|
20 | * Copyright assigned to U.S. Government, 1994. |
---|
21 | * |
---|
22 | * The license and distribution terms for this file may be |
---|
23 | * found in the file LICENSE in this distribution or at |
---|
24 | * http://www.OARcorp.com/rtems/license.html. |
---|
25 | * |
---|
26 | * $Id$ |
---|
27 | */ |
---|
28 | |
---|
29 | #include <rtems/system.h> |
---|
30 | #include <rtems/rtems/status.h> |
---|
31 | #include <rtems/rtems/support.h> |
---|
32 | #include <rtems/rtems/attr.h> |
---|
33 | #include <rtems/score/isr.h> |
---|
34 | #include <rtems/score/object.h> |
---|
35 | #include <rtems/rtems/options.h> |
---|
36 | #include <rtems/rtems/sem.h> |
---|
37 | #include <rtems/score/coremutex.h> |
---|
38 | #include <rtems/score/coresem.h> |
---|
39 | #include <rtems/score/states.h> |
---|
40 | #include <rtems/score/thread.h> |
---|
41 | #include <rtems/score/threadq.h> |
---|
42 | #if defined(RTEMS_MULTIPROCESSING) |
---|
43 | #include <rtems/score/mpci.h> |
---|
44 | #endif |
---|
45 | #include <rtems/score/sysstate.h> |
---|
46 | |
---|
47 | #include <rtems/score/interr.h> |
---|
48 | |
---|
49 | /*PAGE |
---|
50 | * |
---|
51 | * _Semaphore_Manager_initialization |
---|
52 | * |
---|
53 | * This routine initializes all semaphore manager related data structures. |
---|
54 | * |
---|
55 | * Input parameters: |
---|
56 | * maximum_semaphores - maximum configured semaphores |
---|
57 | * |
---|
58 | * Output parameters: NONE |
---|
59 | */ |
---|
60 | |
---|
61 | void _Semaphore_Manager_initialization( |
---|
62 | unsigned32 maximum_semaphores |
---|
63 | ) |
---|
64 | { |
---|
65 | _Objects_Initialize_information( |
---|
66 | &_Semaphore_Information, |
---|
67 | OBJECTS_RTEMS_SEMAPHORES, |
---|
68 | TRUE, |
---|
69 | maximum_semaphores, |
---|
70 | sizeof( Semaphore_Control ), |
---|
71 | FALSE, |
---|
72 | RTEMS_MAXIMUM_NAME_LENGTH, |
---|
73 | FALSE |
---|
74 | ); |
---|
75 | |
---|
76 | /* |
---|
77 | * Register the MP Process Packet routine. |
---|
78 | */ |
---|
79 | |
---|
80 | #if defined(RTEMS_MULTIPROCESSING) |
---|
81 | _MPCI_Register_packet_processor( |
---|
82 | MP_PACKET_SEMAPHORE, |
---|
83 | _Semaphore_MP_Process_packet |
---|
84 | ); |
---|
85 | #endif |
---|
86 | |
---|
87 | } |
---|