My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lpc_types.h 5.8KB

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