Add HAL API for can pinmap

Add the functions can_rd_pinmap and can_td_pinmap to all targets.
pull/9449/head
Russ Butler 2019-01-23 21:53:06 -06:00
parent 3bd3aca6db
commit 7e8695a2c5
14 changed files with 150 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#define MBED_CAN_API_H
#include "device.h"
#include "pinmap.h"
#if DEVICE_CAN
@ -76,6 +77,24 @@ unsigned char can_rderror(can_t *obj);
unsigned char can_tderror(can_t *obj);
void can_monitor(can_t *obj, int silent);
/** Get the pins that support CAN RD
*
* Return a PinMap array of pins that support CAN RD. The
* array is terminated with {NC, NC, 0}.
*
* @return PinMap array
*/
const PinMap *can_rd_pinmap(void);
/** Get the pins that support CAN TD
*
* Return a PinMap array of pins that support CAN TD. The
* array is terminated with {NC, NC, 0}.
*
* @return PinMap array
*/
const PinMap *can_td_pinmap(void);
#ifdef __cplusplus
};
#endif

View File

@ -630,4 +630,14 @@ void can_monitor(can_t *obj, int silent)
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif

View File

@ -629,4 +629,14 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
return handle;
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif

View File

@ -628,4 +628,14 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
return handle;
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif

View File

@ -309,4 +309,14 @@ void can_monitor(can_t *obj, int silent)
CAN_EnterTestMode((CAN_T *)NU_MODBASE(obj->can), CAN_TEST_SILENT_Msk);
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif // DEVICE_CAN

View File

@ -352,4 +352,14 @@ void can_monitor(can_t *obj, int silent)
CAN_EnterTestMode((CAN_T *)NU_MODBASE(obj->can), CAN_TEST_SILENT_Msk);
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif // DEVICE_CAN

View File

@ -357,4 +357,14 @@ void can_monitor(can_t *obj, int silent)
CAN_EnterTestMode((CAN_T *)NU_MODBASE(obj->can), CAN_TEST_SILENT_Msk);
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif // DEVICE_CAN

View File

@ -461,3 +461,13 @@ void can_monitor(can_t *obj, int silent) {
LPC_CAN->CNTL |= CANCNTL_INIT;
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -626,3 +626,13 @@ void can_monitor(can_t *obj, int silent) {
LPC_C_CAN0->CANCNTL |= (1UL << 0);
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -452,3 +452,13 @@ void can_monitor(can_t *obj, int silent) {
can_enable(obj);
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -393,3 +393,13 @@ void can_monitor(can_t *obj, int silent) {
can_enable(obj);
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -390,3 +390,13 @@ void can_monitor(can_t *obj, int silent) {
can_enable(obj);
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -388,7 +388,7 @@ static void can_err_irq(uint32_t ch, CanIrqType type) {
*dmy_erfl &= 0xFFFFFF7F; // Clear ALF
break;
case IRQ_BUS:
*dmy_erfl &= 0xFFFF00FF; // Clear ADERR、B0ERR、B1ERR、CERR、AERR、FERR、SERR
*dmy_erfl &= 0xFFFF00FF; // Clear ADERR<EFBFBD>AB0ERR<EFBFBD>AB1ERR<EFBFBD>ACERR<EFBFBD>AAERR<EFBFBD>AFERR<EFBFBD>ASERR
*dmy_erfl &= 0xFFFFFFFE; // Clear BEF
break;
case IRQ_WAKEUP:
@ -1033,3 +1033,13 @@ static void can_set_channel_mode(uint32_t ch, int mode) {
}
}
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}

View File

@ -1205,4 +1205,14 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)
#endif /* FDCAN1 */
const PinMap *can_rd_pinmap()
{
return PinMap_CAN_TD;
}
const PinMap *can_td_pinmap()
{
return PinMap_CAN_RD;
}
#endif // DEVICE_CAN