Split up brcm63xx into files/
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx-2.6 / files / arch / mips / bcm963xx / include / bcmtypes.h
1 /*
2 <:copyright-gpl
3 Copyright 2002 Broadcom Corp. All Rights Reserved.
4
5 This program is free software; you can distribute it and/or modify it
6 under the terms of the GNU General Public License (Version 2) as
7 published by the Free Software Foundation.
8
9 This program is distributed in the hope it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 :>
18 */
19
20 //
21 // bcmtypes.h - misc useful typedefs
22 //
23 #ifndef BCMTYPES_H
24 #define BCMTYPES_H
25
26 // These are also defined in typedefs.h in the application area, so I need to
27 // protect against re-definition.
28
29 #ifndef _TYPEDEFS_H_
30 typedef unsigned char uint8;
31 typedef unsigned short uint16;
32 typedef unsigned long uint32;
33 typedef signed char int8;
34 typedef signed short int16;
35 typedef signed long int32;
36 #endif
37
38 typedef unsigned char byte;
39 // typedef unsigned long sem_t;
40
41 typedef unsigned long HANDLE,*PULONG,DWORD,*PDWORD;
42 typedef signed long LONG,*PLONG;
43
44 typedef unsigned int *PUINT;
45 typedef signed int INT;
46
47 typedef unsigned short *PUSHORT;
48 typedef signed short SHORT,*PSHORT;
49 typedef unsigned short WORD,*PWORD;
50
51 typedef unsigned char *PUCHAR;
52 typedef signed char *PCHAR;
53
54 typedef void *PVOID;
55
56 typedef unsigned char BOOLEAN, *PBOOL, *PBOOLEAN;
57
58 typedef unsigned char BYTE,*PBYTE;
59
60 //#ifndef __GNUC__
61 //The following has been defined in Vxworks internally: vxTypesOld.h
62 //redefine under vxworks will cause error
63 typedef signed int *PINT;
64
65 typedef signed char INT8;
66 typedef signed short INT16;
67 typedef signed long INT32;
68
69 typedef unsigned char UINT8;
70 typedef unsigned short UINT16;
71 typedef unsigned long UINT32;
72
73 typedef unsigned char UCHAR;
74 typedef unsigned short USHORT;
75 typedef unsigned int UINT;
76 typedef unsigned long ULONG;
77
78 typedef void VOID;
79 typedef unsigned char BOOL;
80
81 //#endif /* __GNUC__ */
82
83
84 // These are also defined in typedefs.h in the application area, so I need to
85 // protect against re-definition.
86 #ifndef TYPEDEFS_H
87
88 // Maximum and minimum values for a signed 16 bit integer.
89 #define MAX_INT16 32767
90 #define MIN_INT16 -32768
91
92 // Useful for true/false return values. This uses the
93 // Taligent notation (k for constant).
94 typedef enum
95 {
96 kFalse = 0,
97 kTrue = 1
98 } Bool;
99
100 #endif
101
102 /* macros to protect against unaligned accesses */
103
104 #if 0
105 /* first arg is an address, second is a value */
106 #define PUT16( a, d ) { \
107 *((byte *)a) = (byte)((d)>>8); \
108 *(((byte *)a)+1) = (byte)(d); \
109 }
110
111 #define PUT32( a, d ) { \
112 *((byte *)a) = (byte)((d)>>24); \
113 *(((byte *)a)+1) = (byte)((d)>>16); \
114 *(((byte *)a)+2) = (byte)((d)>>8); \
115 *(((byte *)a)+3) = (byte)(d); \
116 }
117
118 /* first arg is an address, returns a value */
119 #define GET16( a ) ( \
120 (*((byte *)a) << 8) | \
121 (*(((byte *)a)+1)) \
122 )
123
124 #define GET32( a ) ( \
125 (*((byte *)a) << 24) | \
126 (*(((byte *)a)+1) << 16) | \
127 (*(((byte *)a)+2) << 8) | \
128 (*(((byte *)a)+3)) \
129 )
130 #endif
131
132 #ifndef YES
133 #define YES 1
134 #endif
135
136 #ifndef NO
137 #define NO 0
138 #endif
139
140 #ifndef IN
141 #define IN
142 #endif
143
144 #ifndef OUT
145 #define OUT
146 #endif
147
148 #ifndef TRUE
149 #define TRUE 1
150 #endif
151
152 #ifndef FALSE
153 #define FALSE 0
154 #endif
155
156 #define READ32(addr) (*(volatile UINT32 *)((ULONG)&addr))
157 #define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr))
158 #define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr))
159
160 #endif