]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/compat/posix/v2_0/include/muttypes.h
Initial revision
[karo-tx-redboot.git] / packages / compat / posix / v2_0 / include / muttypes.h
1 #ifndef CYGONCE_POSIX_MUTTYPES_H
2 #define CYGONCE_POSIX_MUTTYPES_H
3 //=============================================================================
4 //
5 //      muttypes.h
6 //
7 //      POSIX mutex types header
8 //
9 //=============================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 //
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
18 //
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22 // for more details.
23 //
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 //
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
34 //
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 //
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //=============================================================================
43 //#####DESCRIPTIONBEGIN####
44 //
45 // Author(s):     nickg
46 // Contributors:  nickg,jlarmour
47 // Date:          2000-03-17
48 // Purpose:       POSIX types header
49 // Description:   This header contains POSIX type definitions for mutexes
50 //                and cond vars. These types are implementation defined.
51 //              
52 // Usage:         #include <sys/types.h>
53 //              
54 //
55 //####DESCRIPTIONEND####
56 //
57 //=============================================================================
58
59 #include <pkgconf/posix.h>
60 #include <pkgconf/kernel.h>
61
62 #include <cyg/infra/cyg_type.h>
63
64 //-----------------------------------------------------------------------------
65 // Mutex object
66 // This structure must exactly correspond in size and layout to the underlying
67 // eCos C++ class that implements this object. Because we have to support
68 // PTHREAD_MUTEX_INITIALIZER we cannot abstract this object very easily.
69
70 typedef struct
71 {
72     CYG_WORD32  locked;
73     CYG_ADDRESS owner;
74     CYG_ADDRESS queue;
75
76 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
77     CYG_WORD32  protocol;       // this mutex's protocol
78 #endif    
79     
80 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
81     CYG_WORD32  ceiling;        // mutex priority ceiling
82 #endif
83     
84 } pthread_mutex_t;
85
86 #if defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) &&\
87     defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
88 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0, 0 }
89 #elif defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) ||\
90     defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
91 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0 }
92 #else
93 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0 }
94 #endif
95
96 //-----------------------------------------------------------------------------
97 // Mutex attributes structure
98
99 typedef struct
100 {
101     int         protocol;
102 #ifdef _POSIX_THREAD_PRIO_PROTECT    
103     int         prioceiling;
104 #endif    
105 } pthread_mutexattr_t;
106
107 // Values for protocol
108 #define PTHREAD_PRIO_NONE       1
109 #if defined(_POSIX_THREAD_PRIO_INHERIT)
110 #define PTHREAD_PRIO_INHERIT    2
111 #endif
112 #if defined(_POSIX_THREAD_PRIO_PROTECT)
113 #define PTHREAD_PRIO_PROTECT    3
114 #endif
115
116 //-----------------------------------------------------------------------------
117 // Condition Variable structure.
118 // Like mutexes, this must match the underlying eCos implementation class.
119
120 typedef struct
121 {
122     CYG_ADDRESS         mutex;
123     CYG_ADDRESS         queue;    
124 } pthread_cond_t;
125
126 #define PTHREAD_COND_INITIALIZER { 0, 0 }
127
128 //-----------------------------------------------------------------------------
129 // Condition variable attributes structure
130
131 typedef struct
132 {
133     int         dummy;
134 } pthread_condattr_t;
135
136 //-----------------------------------------------------------------------------
137 #endif // ifndef CYGONCE_POSIX_MUTTYPES_H
138 // End of muttypes.h