LINKED LIST TEST on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lpc_types.h Source File

lpc_types.h

Go to the documentation of this file.
00001 /***********************************************************************//**
00002  * @file        lpc_types.h
00003  * @brief        Contains the NXP ABL typedefs for C standard types.
00004  *                 It is intended to be used in ISO C conforming development
00005  *                 environments and checks for this insofar as it is possible
00006  *                 to do so.
00007  * @version        1.0
00008  * @date        27 Jul. 2008
00009  * @author        wellsk
00010  **************************************************************************
00011  * Software that is described herein is for illustrative purposes only
00012  * which provides customers with programming information regarding the
00013  * products. This software is supplied "AS IS" without any warranties.
00014  * NXP Semiconductors assumes no responsibility or liability for the
00015  * use of the software, conveys no license or title under any patent,
00016  * copyright, or mask work right to the product. NXP Semiconductors
00017  * reserves the right to make changes in the software without
00018  * notification. NXP Semiconductors also make no representation or
00019  * warranty that such application will be suitable for the specified
00020  * use without further testing or modification.
00021  **************************************************************************/
00022 
00023 /* Type group ----------------------------------------------------------- */
00024 /** @defgroup LPC_Types LPC_Types
00025  * @ingroup LPC1700CMSIS_FwLib_Drivers
00026  * @{
00027  */
00028 
00029 #ifndef LPC_TYPES_H
00030 #define LPC_TYPES_H
00031 
00032 /* Includes ------------------------------------------------------------------- */
00033 #include <stdint.h>
00034 #include "mbed.h"
00035 
00036 
00037 /* Public Types --------------------------------------------------------------- */
00038 /** @defgroup LPC_Types_Public_Types LPC_Types Public Types
00039  * @{
00040  */
00041 
00042 /**
00043  * @brief Boolean Type definition
00044  */
00045 
00046 //typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
00047 #ifndef Bool
00048 #   define Bool int
00049 #endif
00050 #ifndef TRUE
00051 #   define TRUE 1
00052 #endif
00053 #ifndef FALSE
00054 #   define FALSE 0
00055 #endif
00056 
00057 /**
00058  * @brief Flag Status and Interrupt Flag Status type definition
00059  */
00060 typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
00061 #define PARAM_SETSTATE(State) ((State==RESET) || (State==SET))
00062 
00063 /**
00064  * @brief Functional State Definition
00065  */
00066 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
00067 #define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE))
00068 
00069 /**
00070  * @ Status type definition
00071  */
00072 typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
00073 
00074 
00075 /**
00076  * Read/Write transfer type mode (Block or non-block)
00077  */
00078 typedef enum
00079 {
00080     NONE_BLOCKING = 0,        /**< None Blocking type */
00081     BLOCKING,                /**< Blocking type */
00082 } TRANSFER_BLOCK_Type;
00083 
00084 
00085 /** Pointer to Function returning Void (any number of parameters) */
00086 typedef void (*PFV)();
00087 
00088 /** Pointer to Function returning int32_t (any number of parameters) */
00089 typedef int32_t(*PFI)();
00090 
00091 /**
00092  * @}
00093  */
00094 
00095 
00096 /* Public Macros -------------------------------------------------------------- */
00097 /** @defgroup LPC_Types_Public_Macros  LPC_Types Public Macros
00098  * @{
00099  */
00100 
00101 /* _BIT(n) sets the bit at position "n"
00102  * _BIT(n) is intended to be used in "OR" and "AND" expressions:
00103  * e.g., "(_BIT(3) | _BIT(7))".
00104  */
00105 #undef _BIT
00106 /* Set bit macro */
00107 #define _BIT(n)    (1<<n)
00108 
00109 /* _SBF(f,v) sets the bit field starting at position "f" to value "v".
00110  * _SBF(f,v) is intended to be used in "OR" and "AND" expressions:
00111  * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)"
00112  */
00113 #undef _SBF
00114 /* Set bit field macro */
00115 #define _SBF(f,v) (v<<f)
00116 
00117 /* _BITMASK constructs a symbol with 'field_width' least significant
00118  * bits set.
00119  * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF
00120  * The symbol is intended to be used to limit the bit field width
00121  * thusly:
00122  * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32.
00123  * If "any_expression" results in a value that is larger than can be
00124  * contained in 'x' bits, the bits above 'x - 1' are masked off.  When
00125  * used with the _SBF example above, the example would be written:
00126  * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))
00127  * This ensures that the value written to a_reg is no wider than
00128  * 16 bits, and makes the code easier to read and understand.
00129  */
00130 #undef _BITMASK
00131 /* Bitmask creation macro */
00132 #define _BITMASK(field_width) ( _BIT(field_width) - 1)
00133 
00134 /* NULL pointer */
00135 #ifndef NULL
00136 #define NULL ((void*) 0)
00137 #endif
00138 
00139 /* Number of elements in an array */
00140 #define NELEMENTS(array)  (sizeof (array) / sizeof (array[0]))
00141 
00142 /* Static data/function define */
00143 #define STATIC static
00144 /* External data/function define */
00145 #define EXTERN extern
00146 
00147 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
00148 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
00149 
00150 /**
00151  * @}
00152  */
00153 
00154 
00155 /* Old Type Definition compatibility ------------------------------------------ */
00156 /** @addtogroup LPC_Types_Public_Types LPC_Types Public Types
00157  * @{
00158  */
00159 
00160 /** SMA type for character type */
00161 //typedef char CHAR;
00162 
00163 /** SMA type for 8 bit unsigned value */
00164 typedef uint8_t UNS_8;
00165 
00166 /** SMA type for 8 bit signed value */
00167 typedef int8_t INT_8;
00168 
00169 /** SMA type for 16 bit unsigned value */
00170 typedef    uint16_t UNS_16;
00171 
00172 /** SMA type for 16 bit signed value */
00173 typedef    int16_t INT_16;
00174 
00175 /** SMA type for 32 bit unsigned value */
00176 typedef    uint32_t UNS_32;
00177 
00178 /** SMA type for 32 bit signed value */
00179 typedef    int32_t INT_32;
00180 
00181 /** SMA type for 64 bit signed value */
00182 typedef int64_t INT_64;
00183 
00184 /** SMA type for 64 bit unsigned value */
00185 typedef uint64_t UNS_64;
00186 
00187 /** 32 bit boolean type */
00188 typedef Bool BOOL_32;
00189 
00190 /** 16 bit boolean type */
00191 typedef Bool BOOL_16;
00192 
00193 /** 8 bit boolean type */
00194 typedef Bool BOOL_8;
00195 
00196 /**
00197  * @}
00198  */
00199 
00200 
00201 #endif /* LPC_TYPES_H */
00202 
00203 /**
00204  * @}
00205  */
00206 
00207 /* --------------------------------- End Of File ------------------------------ */