net/can: add an option to control CAN EXTID support
This commit is contained in:
parent
4f7ab47443
commit
bc178344a9
@ -881,7 +881,7 @@ static int stm32can_transmit(FAR struct stm32_can_s *priv)
|
|||||||
|
|
||||||
/* Set up the ID, standard 11-bit or extended 29-bit. */
|
/* Set up the ID, standard 11-bit or extended 29-bit. */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
regval &= ~CAN_TIR_EXID_MASK;
|
regval &= ~CAN_TIR_EXID_MASK;
|
||||||
if (frame->can_id & CAN_EFF_FLAG)
|
if (frame->can_id & CAN_EFF_FLAG)
|
||||||
{
|
{
|
||||||
@ -1205,7 +1205,7 @@ static int stm32can_rxinterrupt_work(FAR struct stm32_can_s *priv, int rxmb)
|
|||||||
|
|
||||||
regval = stm32can_getreg(priv, STM32_CAN_RIR_OFFSET(rxmb));
|
regval = stm32can_getreg(priv, STM32_CAN_RIR_OFFSET(rxmb));
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
if ((regval & CAN_RIR_IDE) != 0)
|
if ((regval & CAN_RIR_IDE) != 0)
|
||||||
{
|
{
|
||||||
frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT;
|
frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT;
|
||||||
@ -1277,7 +1277,7 @@ static int stm32can_rxinterrupt_work(FAR struct stm32_can_s *priv, int rxmb)
|
|||||||
|
|
||||||
/* Release the FIFO */
|
/* Release the FIFO */
|
||||||
|
|
||||||
#ifndef CONFIG_CAN_EXTID
|
#ifndef CONFIG_NET_CAN_EXTID
|
||||||
errout:
|
errout:
|
||||||
#endif
|
#endif
|
||||||
regval = stm32can_getreg(priv, STM32_CAN_RFR_OFFSET(rxmb));
|
regval = stm32can_getreg(priv, STM32_CAN_RFR_OFFSET(rxmb));
|
||||||
|
@ -520,14 +520,14 @@ struct stm32_fdcan_s
|
|||||||
const struct stm32_config_s *config;
|
const struct stm32_config_s *config;
|
||||||
|
|
||||||
uint8_t state; /* See enum can_state_s */
|
uint8_t state; /* See enum can_state_s */
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
uint8_t nextalloc; /* Number of allocated extended filters */
|
uint8_t nextalloc; /* Number of allocated extended filters */
|
||||||
#endif
|
#endif
|
||||||
uint8_t nstdalloc; /* Number of allocated standard filters */
|
uint8_t nstdalloc; /* Number of allocated standard filters */
|
||||||
uint32_t nbtp; /* Current nominal bit timing */
|
uint32_t nbtp; /* Current nominal bit timing */
|
||||||
uint32_t dbtp; /* Current data bit timing */
|
uint32_t dbtp; /* Current data bit timing */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
uint32_t extfilters[2]; /* Extended filter bit allocator. 2*32=64 */
|
uint32_t extfilters[2]; /* Extended filter bit allocator. 2*32=64 */
|
||||||
#endif
|
#endif
|
||||||
uint32_t stdfilters[4]; /* Standard filter bit allocator. 4*32=128 */
|
uint32_t stdfilters[4]; /* Standard filter bit allocator. 4*32=128 */
|
||||||
@ -1718,7 +1718,7 @@ static int fdcan_send(FAR struct stm32_fdcan_s *priv)
|
|||||||
* Extended Identifier (XTD) - Depends on configuration.
|
* Extended Identifier (XTD) - Depends on configuration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
if (frame->can_id & CAN_EFF_FLAG)
|
if (frame->can_id & CAN_EFF_FLAG)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(frame->can_id < (1 << 29));
|
DEBUGASSERT(frame->can_id < (1 << 29));
|
||||||
@ -2409,7 +2409,7 @@ static void fdcan_receive(FAR struct stm32_fdcan_s *priv,
|
|||||||
frame->can_id |= CAN_RTR_FLAG;
|
frame->can_id |= CAN_RTR_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_NET_CAN_EXTID
|
||||||
if ((regval & BUFFER_R0_XTD) != 0)
|
if ((regval & BUFFER_R0_XTD) != 0)
|
||||||
{
|
{
|
||||||
/* Save the extended ID of the newly received message */
|
/* Save the extended ID of the newly received message */
|
||||||
|
@ -24,7 +24,6 @@ CONFIG_ARCH_STACKDUMP=y
|
|||||||
CONFIG_BOARD_LATE_INITIALIZE=y
|
CONFIG_BOARD_LATE_INITIALIZE=y
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=8499
|
CONFIG_BOARD_LOOPSPERMSEC=8499
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
CONFIG_CAN_EXTID=y
|
|
||||||
CONFIG_DEBUG_FULLOPT=y
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
CONFIG_DEBUG_SYMBOLS=y
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
CONFIG_FS_PROCFS=y
|
CONFIG_FS_PROCFS=y
|
||||||
@ -37,6 +36,7 @@ CONFIG_NETDEVICES=y
|
|||||||
CONFIG_NETDEV_IFINDEX=y
|
CONFIG_NETDEV_IFINDEX=y
|
||||||
CONFIG_NETDEV_LATEINIT=y
|
CONFIG_NETDEV_LATEINIT=y
|
||||||
CONFIG_NET_CAN=y
|
CONFIG_NET_CAN=y
|
||||||
|
CONFIG_NET_CAN_EXTID=y
|
||||||
CONFIG_NET_SOCKOPTS=y
|
CONFIG_NET_SOCKOPTS=y
|
||||||
CONFIG_NET_STATISTICS=y
|
CONFIG_NET_STATISTICS=y
|
||||||
CONFIG_NSH_BUILTIN_APPS=y
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
@ -36,6 +36,13 @@ config CAN_CONNS
|
|||||||
---help---
|
---help---
|
||||||
Maximum number of CAN connections (all tasks).
|
Maximum number of CAN connections (all tasks).
|
||||||
|
|
||||||
|
config NET_CAN_EXTID
|
||||||
|
bool "Enable CAN extended IDs"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enables support for the 29-bit extended ID in SocketCAN stack.
|
||||||
|
Default Standard 11-bit IDs.
|
||||||
|
|
||||||
config NET_CAN_CANFD
|
config NET_CAN_CANFD
|
||||||
bool "Enable CAN FD support"
|
bool "Enable CAN FD support"
|
||||||
default y
|
default y
|
||||||
|
Loading…
Reference in New Issue
Block a user