3 Copyright 2002 Broadcom Corp. All Rights Reserved.
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.
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
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.
21 // bcmtypes.h - misc useful typedefs
26 // These are also defined in typedefs.h in the application area, so I need to
27 // protect against re-definition.
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
;
38 typedef unsigned char byte
;
39 // typedef unsigned long sem_t;
41 typedef unsigned long HANDLE
,*PULONG
,DWORD
,*PDWORD
;
42 typedef signed long LONG
,*PLONG
;
44 typedef unsigned int *PUINT
;
45 typedef signed int INT
;
47 typedef unsigned short *PUSHORT
;
48 typedef signed short SHORT
,*PSHORT
;
49 typedef unsigned short WORD
,*PWORD
;
51 typedef unsigned char *PUCHAR
;
52 typedef signed char *PCHAR
;
56 typedef unsigned char BOOLEAN
, *PBOOL
, *PBOOLEAN
;
58 typedef unsigned char BYTE
,*PBYTE
;
61 //The following has been defined in Vxworks internally: vxTypesOld.h
62 //redefine under vxworks will cause error
63 typedef signed int *PINT
;
65 typedef signed char INT8
;
66 typedef signed short INT16
;
67 typedef signed long INT32
;
69 typedef unsigned char UINT8
;
70 typedef unsigned short UINT16
;
71 typedef unsigned long UINT32
;
73 typedef unsigned char UCHAR
;
74 typedef unsigned short USHORT
;
75 typedef unsigned int UINT
;
76 typedef unsigned long ULONG
;
79 typedef unsigned char BOOL
;
81 //#endif /* __GNUC__ */
84 // These are also defined in typedefs.h in the application area, so I need to
85 // protect against re-definition.
88 // Maximum and minimum values for a signed 16 bit integer.
89 #define MAX_INT16 32767
90 #define MIN_INT16 -32768
92 // Useful for true/false return values. This uses the
93 // Taligent notation (k for constant).
102 /* macros to protect against unaligned accesses */
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); \
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); \
118 /* first arg is an address, returns a value */
119 #define GET16( a ) ( \
120 (*((byte *)a) << 8) | \
124 #define GET32( a ) ( \
125 (*((byte *)a) << 24) | \
126 (*(((byte *)a)+1) << 16) | \
127 (*(((byte *)a)+2) << 8) | \
156 #define READ32(addr) (*(volatile UINT32 *)((ULONG)&addr))
157 #define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr))
158 #define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr))