Go to the documentation of this file.
56 #ifndef ASM_INCLUDE // define ASM_INCLUDE in your a51 source code before include of .h file
57 typedef float Float16;
59 typedef unsigned char U8 ;
60 typedef unsigned short U16;
61 typedef unsigned long U32;
62 typedef signed char S8 ;
63 typedef signed short S16;
68 typedef unsigned char Bool;
72 typedef Bool Status_bool;
79 # define _MEM_TYPE_BIT_ bdata // Used for bit accesses
80 # define _MEM_TYPE_FAST_ data
81 # define _MEM_TYPE_MEDFAST_ idata
82 # define _MEM_TYPE_MEDSLOW_ pdata
83 # define _MEM_TYPE_SLOW_ xdata
85 # define _MEM_TYPE_BIT_
86 # define _MEM_TYPE_FAST_
87 # define _MEM_TYPE_MEDFAST_
88 # define _MEM_TYPE_MEDSLOW_
89 # define _MEM_TYPE_SLOW_
92 typedef unsigned char Uchar;
95 typedef unsigned char Uint8;
96 typedef unsigned int Uint16;
97 typedef unsigned long int Uint32;
101 typedef long int Int32;
103 typedef unsigned char Byte;
104 typedef unsigned int Word;
105 typedef unsigned long int DWord;
120 #ifdef __IAR_SYSTEMS_ICC__
122 typedef int p_uart_ptchar;
123 typedef int r_uart_ptchar;
125 #ifdef __CODEVISIONAVR__
127 typedef int p_uart_ptchar;
128 typedef char r_uart_ptchar;
130 #if !defined(__IAR_SYSTEMS_ICC__) && !defined(___ICC__)
131 typedef char p_uart_ptchar;
132 typedef char r_uart_ptchar;
141 #define _ConstType_ lit
143 #define _GenericType_ __generic
152 #ifdef __IAR_SYSTEMS_ICC__
154 #define _ConstType_ __flash
156 #define _GenericType_ __generic
157 #define FLASH __flash
158 #define FARFLASH __farflash
167 # define _CONST_TYPE_ code
170 #define Enable_interrupt() __enable_interrupt()
171 #define Disable_interrupt() __disable_interrupt()
174 #define SFR_W_EXT(a,b) SFR_W_R(b,a)
192 #define INTEL_ALIGNMENT LITTLE_ENDIAN
193 #define MOTOROLA_ALIGNMENT BIG_ENDIAN
196 #ifdef LITTLE_ENDIAN // => 16bit: (LSB,MSB), 32bit: (LSW,MSW) or (LSB0,LSB1,LSB2,LSB3) or (MSB3,MSB2,MSB1,MSB0)
197 # define MSB(u16) (((U8* )&u16)[1])
198 # define LSB(u16) (((U8* )&u16)[0])
199 # define MSW(u32) (((U16*)&u32)[1])
200 # define LSW(u32) (((U16*)&u32)[0])
201 # define MSB0(u32) (((U8* )&u32)[3])
202 # define MSB1(u32) (((U8* )&u32)[2])
203 # define MSB2(u32) (((U8* )&u32)[1])
204 # define MSB3(u32) (((U8* )&u32)[0])
205 # define LSB0(u32) MSB3(u32)
206 # define LSB1(u32) MSB2(u32)
207 # define LSB2(u32) MSB1(u32)
208 # define LSB3(u32) MSB0(u32)
209 #else // BIG_ENDIAN => 16bit: (MSB,LSB), 32bit: (MSW,LSW) or (LSB3,LSB2,LSB1,LSB0) or (MSB0,MSB1,MSB2,MSB3)
210 # define MSB(u16) (((U8* )&u16)[0])
211 # define LSB(u16) (((U8* )&u16)[1])
212 # define MSW(u32) (((U16*)&u32)[0])
213 # define LSW(u32) (((U16*)&u32)[1])
214 # define MSB0(u32) (((U8* )&u32)[0])
215 # define MSB1(u32) (((U8* )&u32)[1])
216 # define MSB2(u32) (((U8* )&u32)[2])
217 # define MSB3(u32) (((U8* )&u32)[3])
218 # define LSB0(u32) MSB3(u32)
219 # define LSB1(u32) MSB2(u32)
220 # define LSB2(u32) MSB1(u32)
221 # define LSB3(u32) MSB0(u32)
226 ( ((U16)( (b) & 0xFF) << 8) \
227 | ( ((U16)(b) & 0xFF00) >> 8) \
230 ( ((U32)( (b) & 0xFF) << 24) \
231 | ((U32)((U16)(b) & 0xFF00) << 8) \
232 | ( ((U32)(b) & 0xFF0000) >> 8) \
233 | ( ((U32)(b) & 0xFF000000) >> 24) \
269 #ifndef ASM_INCLUDE // define ASM_INCLUDE in your a51 source code before include of .h file
275 #define LOW(U16) ((Uchar)U16)
276 #define HIGH(U16) ((Uchar)(U16>>8))
277 #define TST_BIT_X(addrx,mask) (*addrx & mask)
278 #define SET_BIT_X(addrx,mask) (*addrx = (*addrx | mask))
279 #define CLR_BIT_X(addrx,mask) (*addrx = (*addrx & ~mask))
280 #define OUT_X(addrx,value) (*addrx = value)
281 #define IN_X(addrx) (*addrx)
283 # define Max(a, b) ( (a)>(b) ? (a) : (b) ) // Take the max between a and b
284 # define Min(a, b) ( (a)<(b) ? (a) : (b) ) // Take the min between a and b
293 # define Upper(val, n) ( ((val)+(n)) & ~((n)-1) )
302 # define Align_up(val, n) ( ((val)+(n)-1) & ~((n)-1) )
311 # define Align_down(val, n) ( (val) & ~((n)-1) )
323 #define SET_SFR_BIT(sfr_reg, bit_pos, bit_val) { sfr_reg &= ~(1<<(bit_pos)); sfr_reg |= ((bit_val)<<(bit_pos));}
325 #define TID_GUARD(proc) ((__TID__ & 0x7FF0) != ((90 << 8) | ((proc) << 4)))
332 #define _ConstType_ __flash
334 #define _GenericType_ __generic
335 #define FLASH PROGMEM
344 #include <avr/interrupt.h>
345 #include <avr/pgmspace.h>
346 #define Enable_interrupt() sei()
347 #define Disable_interrupt() cli()