Date: March 20, 2011 This library is created from "LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library (GNU, Keil, IAR) (Jan 28, 2011)", available from NXP's website, under "All microcontrollers support documents" [[http://ics.nxp.com/support/documents/microcontrollers/?type=software]] You will need to follow [[/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h]] while using this library Examples provided here [[/users/frank26080115/programs/LPC1700CMSIS_Examples/]] The beautiful thing is that NXP does not place copyright protection on any of the files in here Only a few modifications are made to make it compile with the mbed online compiler, I fixed some warnings as well. This is untested as of March 20, 2011 Forum post about this library: [[/forum/mbed/topic/2030/]]

Committer:
frank26080115
Date:
Sun Mar 20 18:45:15 2011 +0000
Revision:
0:84d7747641aa

        

Who changed what in which revision?

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