C:/nxpdrv/LPC1700CMSIS/Drivers/include/lpc_types.h
Go to the documentation of this file.00001 /***********************************************************************/ 00024 /* Type group ----------------------------------------------------------- */ 00030 #ifndef LPC_TYPES_H 00031 #define LPC_TYPES_H 00032 00033 /* Includes ------------------------------------------------------------------- */ 00034 #include <stdint.h> 00035 00036 00037 /* Public Types --------------------------------------------------------------- */ 00045 typedef enum {FALSE = 0, TRUE = !FALSE} Bool; 00046 00050 typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState; 00051 #define PARAM_SETSTATE(State) ((State==RESET) || (State==SET)) 00052 00056 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState; 00057 #define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE)) 00058 00062 typedef enum {ERROR = 0, SUCCESS = !ERROR} Status; 00063 00064 00068 typedef enum 00069 { 00070 NONE_BLOCKING = 0, 00071 BLOCKING, 00072 } TRANSFER_BLOCK_Type; 00073 00074 00076 typedef void (*PFV)(); 00077 00079 typedef int32_t(*PFI)(); 00080 00086 /* Public Macros -------------------------------------------------------------- */ 00091 /* _BIT(n) sets the bit at position "n" 00092 * _BIT(n) is intended to be used in "OR" and "AND" expressions: 00093 * e.g., "(_BIT(3) | _BIT(7))". 00094 */ 00095 #undef _BIT 00096 /* Set bit macro */ 00097 #define _BIT(n) (1<<n) 00098 00099 /* _SBF(f,v) sets the bit field starting at position "f" to value "v". 00100 * _SBF(f,v) is intended to be used in "OR" and "AND" expressions: 00101 * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)" 00102 */ 00103 #undef _SBF 00104 /* Set bit field macro */ 00105 #define _SBF(f,v) (v<<f) 00106 00107 /* _BITMASK constructs a symbol with 'field_width' least significant 00108 * bits set. 00109 * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF 00110 * The symbol is intended to be used to limit the bit field width 00111 * thusly: 00112 * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32. 00113 * If "any_expression" results in a value that is larger than can be 00114 * contained in 'x' bits, the bits above 'x - 1' are masked off. When 00115 * used with the _SBF example above, the example would be written: 00116 * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16)) 00117 * This ensures that the value written to a_reg is no wider than 00118 * 16 bits, and makes the code easier to read and understand. 00119 */ 00120 #undef _BITMASK 00121 /* Bitmask creation macro */ 00122 #define _BITMASK(field_width) ( _BIT(field_width) - 1) 00123 00124 /* NULL pointer */ 00125 #ifndef NULL 00126 #define NULL ((void*) 0) 00127 #endif 00128 00129 /* Number of elements in an array */ 00130 #define NELEMENTS(array) (sizeof (array) / sizeof (array[0])) 00131 00132 /* Static data/function define */ 00133 #define STATIC static 00134 /* External data/function define */ 00135 #define EXTERN extern 00136 00137 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) 00138 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 00139 00145 /* Old Type Definition compatibility ------------------------------------------ */ 00151 typedef char CHAR; 00152 00154 typedef uint8_t UNS_8; 00155 00157 typedef int8_t INT_8; 00158 00160 typedef uint16_t UNS_16; 00161 00163 typedef int16_t INT_16; 00164 00166 typedef uint32_t UNS_32; 00167 00169 typedef int32_t INT_32; 00170 00172 typedef int64_t INT_64; 00173 00175 typedef uint64_t UNS_64; 00176 00178 typedef Bool BOOL_32; 00179 00181 typedef Bool BOOL_16; 00182 00184 typedef Bool BOOL_8; 00185 00191 #endif /* LPC_TYPES_H */ 00192 00197 /* --------------------------------- End Of File ------------------------------ */
Generated on Mon Feb 8 10:01:37 2010 for LPC1700CMSIS Standard Peripheral Firmware Library by
