]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_M4F_M0_LPC43xx_Keil/platform/M4_PeripheralLibraryFiles/lpc_types.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_M4F_M0_LPC43xx_Keil / platform / M4_PeripheralLibraryFiles / lpc_types.h
1 /**********************************************************************\r
2 * $Id$          lpc_types.h                     2011-06-02\r
3 *//**\r
4 * @file         lpc_types.h\r
5 * @brief        Contains the NXP ABL typedefs for C standard types.\r
6 *               It is intended to be used in ISO C conforming development\r
7 *               environments and checks for this insofar as it is possible\r
8 *               to do so.\r
9 * @version      1.0\r
10 * @date         02. June. 2011\r
11 * @author       NXP MCU SW Application Team\r
12 *\r
13 * Copyright(C) 2011, NXP Semiconductor\r
14 * All rights reserved.\r
15 *\r
16 ***********************************************************************\r
17 * Software that is described herein is for illustrative purposes only\r
18 * which provides customers with programming information regarding the\r
19 * products. This software is supplied "AS IS" without any warranties.\r
20 * NXP Semiconductors assumes no responsibility or liability for the\r
21 * use of the software, conveys no license or title under any patent,\r
22 * copyright, or mask work right to the product. NXP Semiconductors\r
23 * reserves the right to make changes in the software without\r
24 * notification. NXP Semiconductors also make no representation or\r
25 * warranty that such application will be suitable for the specified\r
26 * use without further testing or modification.\r
27 **********************************************************************/\r
28 \r
29 /* Type group ----------------------------------------------------------- */\r
30 /** @defgroup LPC_Types LPC_Types\r
31  * @ingroup LPC4300CMSIS_FwLib_Drivers\r
32  * @{\r
33  */\r
34 \r
35 #ifndef LPC_TYPES_H\r
36 #define LPC_TYPES_H\r
37 \r
38 /* Includes ------------------------------------------------------------------- */\r
39 #include <stdint.h>\r
40 \r
41 \r
42 /* Public Types --------------------------------------------------------------- */\r
43 /** @defgroup LPC_Types_Public_Types LPC_Types Public Types\r
44  * @{\r
45  */\r
46 \r
47 /**\r
48  * @brief Boolean Type definition\r
49  */\r
50 typedef enum {FALSE = 0, TRUE = !FALSE} Bool;\r
51 \r
52 /**\r
53  * @brief Flag Status and Interrupt Flag Status type definition\r
54  */\r
55 typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;\r
56 #define PARAM_SETSTATE(State) ((State==RESET) || (State==SET))\r
57 \r
58 /**\r
59  * @brief Functional State Definition\r
60  */\r
61 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;\r
62 #define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE))\r
63 \r
64 /**\r
65  * @ Status type definition\r
66  */\r
67 typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;\r
68 \r
69 \r
70 /**\r
71  * Read/Write transfer type mode (Block or non-block)\r
72  */\r
73 typedef enum\r
74 {\r
75         NONE_BLOCKING = 0,              /**< None Blocking type */\r
76         BLOCKING,                               /**< Blocking type */\r
77 } TRANSFER_BLOCK_Type;\r
78 \r
79 \r
80 /** Pointer to Function returning Void (any number of parameters) */\r
81 typedef void (*PFV)();\r
82 \r
83 /** Pointer to Function returning int32_t (any number of parameters) */\r
84 typedef int32_t(*PFI)();\r
85 \r
86 /**\r
87  * @}\r
88  */\r
89 \r
90 \r
91 /* Public Macros -------------------------------------------------------------- */\r
92 /** @defgroup LPC_Types_Public_Macros  LPC_Types Public Macros\r
93  * @{\r
94  */\r
95 \r
96 /* _BIT(n) sets the bit at position "n"\r
97  * _BIT(n) is intended to be used in "OR" and "AND" expressions:\r
98  * e.g., "(_BIT(3) | _BIT(7))".\r
99  */\r
100 #undef _BIT\r
101 /* Set bit macro */\r
102 #define _BIT(n) (1<<(n))\r
103 \r
104 /* _SBF(f,v) sets the bit field starting at position "f" to value "v".\r
105  * _SBF(f,v) is intended to be used in "OR" and "AND" expressions:\r
106  * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)"\r
107  */\r
108 #undef _SBF\r
109 /* Set bit field macro */\r
110 #define _SBF(f,v) ((v)<<(f))\r
111 \r
112 /* _BITMASK constructs a symbol with 'field_width' least significant\r
113  * bits set.\r
114  * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF\r
115  * The symbol is intended to be used to limit the bit field width\r
116  * thusly:\r
117  * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32.\r
118  * If "any_expression" results in a value that is larger than can be\r
119  * contained in 'x' bits, the bits above 'x - 1' are masked off.  When\r
120  * used with the _SBF example above, the example would be written:\r
121  * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))\r
122  * This ensures that the value written to a_reg is no wider than\r
123  * 16 bits, and makes the code easier to read and understand.\r
124  */\r
125 #undef _BITMASK\r
126 /* Bitmask creation macro */\r
127 #define _BITMASK(field_width) ( _BIT(field_width) - 1)\r
128 \r
129 /* NULL pointer */\r
130 #ifndef NULL\r
131 #define NULL ((void*) 0)\r
132 #endif\r
133 \r
134 /* Number of elements in an array */\r
135 #define NELEMENTS(array)  (sizeof (array) / sizeof (array[0]))\r
136 \r
137 /* Static data/function define */\r
138 #define STATIC static\r
139 /* External data/function define */\r
140 #define EXTERN extern\r
141 \r
142 #if !defined(MAX)\r
143 #define MAX(a, b) (((a) > (b)) ? (a) : (b))\r
144 #endif\r
145 #if !defined(MIN)\r
146 #define MIN(a, b) (((a) < (b)) ? (a) : (b))\r
147 #endif\r
148 \r
149 /**\r
150  * @}\r
151  */\r
152 \r
153 \r
154 /* Old Type Definition compatibility ------------------------------------------ */\r
155 /** @addtogroup LPC_Types_Public_Types LPC_Types Public Types\r
156  * @{\r
157  */\r
158 \r
159 /** SMA type for character type */\r
160 typedef char CHAR;\r
161 \r
162 /** SMA type for 8 bit unsigned value */\r
163 typedef uint8_t UNS_8;\r
164 \r
165 /** SMA type for 8 bit signed value */\r
166 typedef int8_t INT_8;\r
167 \r
168 /** SMA type for 16 bit unsigned value */\r
169 typedef uint16_t UNS_16;\r
170 \r
171 /** SMA type for 16 bit signed value */\r
172 typedef int16_t INT_16;\r
173 \r
174 /** SMA type for 32 bit unsigned value */\r
175 typedef uint32_t UNS_32;\r
176 \r
177 /** SMA type for 32 bit signed value */\r
178 typedef int32_t INT_32;\r
179 \r
180 /** SMA type for 64 bit signed value */\r
181 typedef int64_t INT_64;\r
182 \r
183 /** SMA type for 64 bit unsigned value */\r
184 typedef uint64_t UNS_64;\r
185 \r
186 /** 32 bit boolean type */\r
187 typedef Bool BOOL_32;\r
188 \r
189 /** 16 bit boolean type */\r
190 typedef Bool BOOL_16;\r
191 \r
192 /** 8 bit boolean type */\r
193 typedef Bool BOOL_8;\r
194 \r
195 #ifdef __CC_ARM\r
196 #define INLINE  __inline\r
197 #else\r
198 #define INLINE inline\r
199 #endif\r
200 /**\r
201  * @}\r
202  */\r
203 \r
204 \r
205 #endif /* LPC_TYPES_H */\r
206 \r
207 /**\r
208  * @}\r
209  */\r
210 \r
211 /* --------------------------------- End Of File ------------------------------ */\r