Adapted to Lora Semtech + Nucleo

Dependencies:   DebugLib

Dependents:   LoRaWAN-lmic-app LoRaWAN-lmic-app LoRaWAN-test-10secs LoRaPersonalizedDeviceForEverynet ... more

Fork of lwip_ppp_ethernet by Donatien Garnier

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