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