lin.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /** @file lin.h
  2. * @brief LIN Driver Definition File
  3. * @date 29.May.2013
  4. * @version 03.05.02
  5. *
  6. */
  7. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  8. #ifndef __LIN_H__
  9. #define __LIN_H__
  10. #include "reg_lin.h"
  11. /** @def LIN_BREAK_INT
  12. * @brief Alias for break detect interrupt flag
  13. *
  14. * Used with linEnableNotification, linDisableNotification.
  15. */
  16. #define LIN_BREAK_INT 0x00000001U
  17. /** @def LIN_WAKEUP_INT
  18. * @brief Alias for wakeup interrupt flag
  19. *
  20. * Used with linEnableNotification, linDisableNotification.
  21. */
  22. #define LIN_WAKEUP_INT 0x00000002U
  23. /** @def LIN_TO_INT
  24. * @brief Alias for time out interrupt flag
  25. *
  26. * Used with linEnableNotification, linDisableNotification.
  27. */
  28. #define LIN_TO_INT 0x00000010U
  29. /** @def LIN_TOAWUS_INT
  30. * @brief Alias for time out after wakeup signal interrupt flag
  31. *
  32. * Used with linEnableNotification, linDisableNotification.
  33. */
  34. #define LIN_TOAWUS_INT 0x00000040U
  35. /** @def LIN_TOA3WUS_INT
  36. * @brief Alias for time out after 3 wakeup signals interrupt flag
  37. *
  38. * Used with linEnableNotification, linDisableNotification.
  39. */
  40. #define LIN_TOA3WUS_INT 0x00000080U
  41. /** @def LIN_TX_READY
  42. * @brief Alias for transmit buffer ready flag
  43. *
  44. * Used with linIsTxReady.
  45. */
  46. #define LIN_TX_READY 0x00000100U
  47. /** @def LIN_RX_INT
  48. * @brief Alias for receive buffer ready interrupt flag
  49. *
  50. * Used with linEnableNotification, linDisableNotification.
  51. */
  52. #define LIN_RX_INT 0x00000200U
  53. /** @def LIN_ID_INT
  54. * @brief Alias for received matching identifier interrupt flag
  55. *
  56. * Used with linEnableNotification, linDisableNotification.
  57. */
  58. #define LIN_ID_INT 0x00002000U
  59. /** @def LIN_PE_INT
  60. * @brief Alias for parity error interrupt flag
  61. *
  62. * Used with linEnableNotification, linDisableNotification.
  63. */
  64. #define LIN_PE_INT 0x01000000U
  65. /** @def LIN_OE_INT
  66. * @brief Alias for overrun error interrupt flag
  67. *
  68. * Used with linEnableNotification, linDisableNotification.
  69. */
  70. #define LIN_OE_INT 0x02000000U
  71. /** @def LIN_FE_INT
  72. * @brief Alias for framing error interrupt flag
  73. *
  74. * Used with linEnableNotification, linDisableNotification.
  75. */
  76. #define LIN_FE_INT 0x04000000U
  77. /** @def LIN_NRE_INT
  78. * @brief Alias for no response error interrupt flag
  79. *
  80. * Used with linEnableNotification, linDisableNotification.
  81. */
  82. #define LIN_NRE_INT 0x08000000U
  83. /** @def LIN_ISFE_INT
  84. * @brief Alias for inconsistent sync field error interrupt flag
  85. *
  86. * Used with linEnableNotification, linDisableNotification.
  87. */
  88. #define LIN_ISFE_INT 0x10000000U
  89. /** @def LIN_CE_INT
  90. * @brief Alias for checksum error interrupt flag
  91. *
  92. * Used with linEnableNotification, linDisableNotification.
  93. */
  94. #define LIN_CE_INT 0x20000000U
  95. /** @def LIN_PBE_INT
  96. * @brief Alias for physical bus error interrupt flag
  97. *
  98. * Used with linEnableNotification, linDisableNotification.
  99. */
  100. #define LIN_PBE_INT 0x40000000U
  101. /** @def LIN_BE_INT
  102. * @brief Alias for bit error interrupt flag
  103. *
  104. * Used with linEnableNotification, linDisableNotification.
  105. */
  106. #define LIN_BE_INT 0x80000000U
  107. /** @struct linBase
  108. * @brief LIN Register Definition
  109. *
  110. * This structure is used to access the LIN module registers.
  111. */
  112. /** @typedef linBASE_t
  113. * @brief LIN Register Frame Type Definition
  114. *
  115. * This type is used to access the LIN Registers.
  116. */
  117. enum linPinSelect
  118. {
  119. PIN_LIN_TX = 0U,
  120. PIN_LIN_RX = 1U
  121. };
  122. /**
  123. * @defgroup LIN LIN
  124. * @brief Local Interconnect Network Module.
  125. *
  126. * The LIN standard is based on the SCI (UART) serial data link format. The communication concept is
  127. * single-master/multiple-slave with a message identification for multi-cast transmission between any network
  128. * nodes.
  129. *
  130. * Related Files
  131. * - reg_lin.h
  132. * - lin.h
  133. * - lin.c
  134. * @addtogroup LIN
  135. * @{
  136. */
  137. /* LIN Interface Functions */
  138. void linInit(void);
  139. void linSetFunctional(linBASE_t *lin, uint32 port);
  140. void linSendHeader(linBASE_t *lin, uint8 identifier);
  141. void linSendWakupSignal(linBASE_t *lin);
  142. void linEnterSleep(linBASE_t *lin);
  143. void linSoftwareReset(linBASE_t *lin);
  144. uint32 linIsTxReady(linBASE_t *lin);
  145. void linSetLength(linBASE_t *lin, uint32 length);
  146. void linSend(linBASE_t *lin, uint8 * data);
  147. uint32 linIsRxReady(linBASE_t *lin);
  148. uint32 linTxRxError(linBASE_t *lin);
  149. uint32 linGetIdentifier(linBASE_t *lin);
  150. void linGetData(linBASE_t *lin, uint8 * const data);
  151. void linEnableNotification(linBASE_t *lin, uint32 flags);
  152. void linDisableNotification(linBASE_t *lin, uint32 flags);
  153. void linEnableLoopback(linBASE_t *lin, loopBackType_t Loopbacktype);
  154. void linDisableLoopback(linBASE_t *lin);
  155. /** @fn void linNotification(linBASE_t *lin, uint32 flags)
  156. * @brief Interrupt callback
  157. * @param[in] lin - lin module base address
  158. * @param[in] flags - copy of error interrupt flags
  159. *
  160. * This is a callback that is provided by the application and is called upon
  161. * an interrupt. The parameter passed to the callback is a copy of the
  162. * interrupt flag register.
  163. */
  164. void linNotification(linBASE_t *lin, uint32 flags);
  165. /**@}*/
  166. #endif