2 * @brief LPC18xx/43xx CCAN driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __CCAN_18XX_43XX_H_
\r
33 #define __CCAN_18XX_43XX_H_
\r
39 #define CCAN_SEG1_DEFAULT_VAL 5
\r
40 #define CCAN_SEG2_DEFAULT_VAL 4
\r
41 #define CCAN_SJW_DEFAULT_VAL 0
\r
43 /** @defgroup CCAN_18XX_43XX CHIP: LPC18xx/43xx CCAN driver
\r
44 * @ingroup CHIP_18XX_43XX_Drivers
\r
49 * @brief Enable/Disable CCAN Interrupts
\r
50 * @param pCCAN : The base of CCAN peripheral on the chip
\r
51 * @param NewState : New state, ENABLE or DISABLE
\r
54 STATIC INLINE void Chip_CCAN_IntEnable(LPC_CCAN_T *pCCAN, FunctionalState NewState)
\r
56 IP_CCAN_IntEnable(pCCAN, (IP_CCAN_INT_T) (CCAN_MODULE_INT | CCAN_STATUS_CHANGE_INT | CCAN_ERR_INT), NewState);
\r
60 * @brief Get the source ID of an interrupt
\r
61 * @param pCCAN : The base of CCAN peripheral on the chip
\r
62 * @return Interrupt source ID
\r
64 STATIC INLINE uint32_t Chip_CCAN_GetIntID(LPC_CCAN_T *pCCAN)
\r
66 return IP_CCAN_Get_IntID(pCCAN);
\r
70 * @brief Get the CCAN status register
\r
71 * @param pCCAN : The base of CCAN peripheral on the chip
\r
72 * @return CCAN status register
\r
74 STATIC INLINE uint32_t Chip_CCAN_GetStatus(LPC_CCAN_T *pCCAN)
\r
76 return IP_CCAN_GetStatus(pCCAN);
\r
80 * @brief Get a message object in message RAM into the message buffer
\r
81 * @param pCCAN : The base of CCAN peripheral on the chip
\r
82 * @param msg_num : The number of message object in message RAM to be get
\r
83 * @param msg_buf : Pointer of the message buffer
\r
86 STATIC INLINE void Chip_CCAN_GetMsgObject(LPC_CCAN_T *pCCAN, uint8_t msg_num, message_object *msg_buf)
\r
88 IP_CCAN_GetMsgObject(LPC_C_CAN0, IF2, msg_num, msg_buf);
\r
92 * @brief Initialize the CCAN peripheral, free all message object in RAM
\r
93 * @param pCCAN : The base of CCAN peripheral on the chip
\r
96 void Chip_CCAN_Init(LPC_CCAN_T *pCCAN);
\r
99 * @brief De-initialize the CCAN peripheral
\r
100 * @param pCCAN : The base of CCAN peripheral on the chip
\r
103 void Chip_CCAN_DeInit(LPC_CCAN_T *pCCAN);
\r
106 * @brief Select bit rate for CCAN bus
\r
107 * @param pCCAN : The base of CCAN peripheral on the chip
\r
108 * @param bitRate : Bit rate to be set
\r
111 void Chip_CCAN_SetBitRate(LPC_CCAN_T *pCCAN, uint32_t bitRate);
\r
114 * @brief Clear the status of CCAN bus
\r
115 * @param pCCAN : The base of CCAN peripheral on the chip
\r
116 * @param status : Status to be cleared
\r
119 void Chip_CCAN_ClearStatus(LPC_CCAN_T *pCCAN, IP_CCAN_STATUS_T status);
\r
122 * @brief Clear the pending interrupt
\r
123 * @param pCCAN : The base of CCAN peripheral on the chip
\r
124 * @param msg_num : Message number
\r
125 * @param TRxMode : Select transmit or receive interrupt to be cleared
\r
128 void Chip_CCAN_ClearIntPend(LPC_CCAN_T *pCCAN, uint8_t msg_num, uint8_t TRxMode);
\r
131 * @brief Send a message
\r
132 * @param pCCAN : The base of CCAN peripheral on the chip
\r
133 * @param RemoteEnable: Enable/Disable passives transmit by using remote frame
\r
134 * @param msg_ptr : Message to be transmitted
\r
137 void Chip_CCAN_Send (LPC_CCAN_T *pCCAN, uint32_t RemoteEnable, message_object *msg_ptr);
\r
140 * @brief Register a message ID for receiving
\r
141 * @param pCCAN : The base of CCAN peripheral on the chip
\r
142 * @param rev_id : Received message ID
\r
145 void Chip_CCAN_AddReceiveID(LPC_CCAN_T *pCCAN, uint32_t rev_id);
\r
148 * @brief Remove a registered message ID from receiving
\r
149 * @param pCCAN : The base of CCAN peripheral on the chip
\r
150 * @param rev_id : Received message ID to be removed
\r
153 void Chip_CCAN_DeleteReceiveID(LPC_CCAN_T *pCCAN, uint32_t rev_id);
\r
163 #endif /* __CCAN_18XX_43XX_H_ */
\r