stm32: add SocketCAN support, based on stm32_can.c
This commit is contained in:
parent
e27962a997
commit
6fe95d8314
@ -10836,6 +10836,20 @@ config STM32_USB_ITRMP
|
||||
menu "CAN driver configuration"
|
||||
depends on STM32_CAN
|
||||
|
||||
choice
|
||||
prompt "CAN character driver or SocketCAN support"
|
||||
default STM32_CAN_CHARDRIVER
|
||||
|
||||
config STM32_CAN_CHARDRIVER
|
||||
bool "STM32 CAN character driver support"
|
||||
select ARCH_HAVE_CAN_ERRORS
|
||||
|
||||
config STM32_CAN_SOCKET
|
||||
bool "STM32 CAN SocketCAN support"
|
||||
select NET_CAN_HAVE_ERRORS
|
||||
|
||||
endchoice # CAN character driver or SocketCAN support
|
||||
|
||||
config STM32_CAN1_BAUD
|
||||
int "CAN1 BAUD"
|
||||
default 250000
|
||||
|
@ -241,8 +241,13 @@ CHIP_CSRCS += stm32_hall3ph.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_CAN),y)
|
||||
ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y)
|
||||
CHIP_CSRCS += stm32_can.c
|
||||
endif
|
||||
ifeq ($(CONFIG_STM32_CAN_SOCKET),y)
|
||||
CHIP_CSRCS += stm32_can_sock.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_IWDG),y)
|
||||
CHIP_CSRCS += stm32_iwdg.c
|
||||
|
@ -48,9 +48,6 @@
|
||||
# undef CONFIG_STM32_CAN1
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CAN) && \
|
||||
(defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
|
||||
|
||||
/* CAN BAUD */
|
||||
|
||||
#if defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN1_BAUD)
|
||||
@ -107,11 +104,13 @@ extern "C"
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_CAN_CHARDRIVER
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_caninitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the selected CAN port
|
||||
* Initialize the selected CAN port as character device
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple CAN interfaces)
|
||||
@ -123,6 +122,26 @@ extern "C"
|
||||
|
||||
struct can_dev_s;
|
||||
FAR struct can_dev_s *stm32_caninitialize(int port);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_CAN_SOCKET
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_cansockinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the selected CAN port as SocketCAN interface
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple CAN interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_cansockinitialize(int port);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
@ -130,5 +149,4 @@ FAR struct can_dev_s *stm32_caninitialize(int port);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* CONFIG_CAN && (CONFIG_STM32_CAN1 || CONFIG_STM32_CAN2) */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_CAN_H */
|
||||
|
2465
arch/arm/src/stm32/stm32_can_sock.c
Normal file
2465
arch/arm/src/stm32/stm32_can_sock.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user