diff --git a/configs/Kconfig b/configs/Kconfig index f5896b20de..78fb41ad77 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -1750,6 +1750,15 @@ config BOARDCTL_PWMTEST Architecture specific logic must provide board_pwm_setup() interface. +config BOARDCTL_CANINIT + bool "Enable CAN initialize interface" + default n + depends on CAN + ---help--- + Enables support for the BOARDIOC_CAN_INITIALIZE boardctl() command. + Architecture specific logic must provide board_can_initialize() + interface. + config BOARDCTL_GRAPHICS bool "Enable custom graphics initialization interfaces" default n diff --git a/configs/boardctl.c b/configs/boardctl.c index 3eaf6a4b5d..2a690a671a 100644 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -188,6 +188,21 @@ int boardctl(unsigned int cmd, uintptr_t arg) break; #endif +#ifdef CONFIG_BOARDCTL_CANINIT + /* CMD: BOARDIOC_CAN_INITIALIZE + * DESCRIPTION: CAN device initialization + * ARG: None + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_CANINIT + * DEPENDENCIES: Board logic must provide board_can_initialize() + */ + + case BOARDIOC_CAN_INITIALIZE: + { + ret = board_can_initialize(); + } + break; +#endif + #ifdef CONFIG_BOARDCTL_GRAPHICS /* CMD: BOARDIOC_GRAPHICS_SETUP * DESCRIPTION: Configure graphics that require special initialization diff --git a/configs/olimex-lpc1766stk/src/lpc17_can.c b/configs/olimex-lpc1766stk/src/lpc17_can.c index 364696ed94..ca0f8b05f1 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_can.c +++ b/configs/olimex-lpc1766stk/src/lpc17_can.c @@ -97,7 +97,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All LPC17 architectures must provide the following interface to work with @@ -105,7 +105,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/olimex-stm32-h405/src/stm32_can.c b/configs/olimex-stm32-h405/src/stm32_can.c index 210d707d36..6443bdb88d 100644 --- a/configs/olimex-stm32-h405/src/stm32_can.c +++ b/configs/olimex-stm32-h405/src/stm32_can.c @@ -89,7 +89,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -97,7 +97,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { return stm32_can_initialize(); } diff --git a/configs/olimex-stm32-p107/src/stm32_can.c b/configs/olimex-stm32-p107/src/stm32_can.c index c33874dbf7..690417f9f5 100644 --- a/configs/olimex-stm32-p107/src/stm32_can.c +++ b/configs/olimex-stm32-p107/src/stm32_can.c @@ -85,7 +85,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -93,7 +93,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/olimex-stm32-p207/src/stm32_can.c b/configs/olimex-stm32-p207/src/stm32_can.c index 57f4f110dd..9728422aea 100644 --- a/configs/olimex-stm32-p207/src/stm32_can.c +++ b/configs/olimex-stm32-p207/src/stm32_can.c @@ -89,7 +89,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -97,7 +97,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { return stm32_can_initialize(); } diff --git a/configs/olimexino-stm32/src/stm32_can.c b/configs/olimexino-stm32/src/stm32_can.c index 9f5ac69dc3..00e5c374de 100644 --- a/configs/olimexino-stm32/src/stm32_can.c +++ b/configs/olimexino-stm32/src/stm32_can.c @@ -88,7 +88,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -96,7 +96,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/sama5d3-xplained/src/sam_can.c b/configs/sama5d3-xplained/src/sam_can.c index 623e11666e..9fc10f9d2b 100644 --- a/configs/sama5d3-xplained/src/sam_can.c +++ b/configs/sama5d3-xplained/src/sam_can.c @@ -93,7 +93,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -101,7 +101,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/sama5d3x-ek/src/sam_can.c b/configs/sama5d3x-ek/src/sam_can.c index ffda3cc03c..d904d12d83 100644 --- a/configs/sama5d3x-ek/src/sam_can.c +++ b/configs/sama5d3x-ek/src/sam_can.c @@ -93,7 +93,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -101,7 +101,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 5b58f1d006..6f6e5fb3c4 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -1121,6 +1121,10 @@ MCAN1 Loopback Test CONFIG_SAMV7_MCAN1_TXFIFOQ_SIZE=8 # There are 8 queue elements CONFIG_SAMV7_MCAN1_TXEVENTFIFO_SIZE=0 # The event FIFO is not used + Board Selection + CONFIG_LIB_BOARDCTL=y # Needed for CAN initialization + CONFIG_BOARDCTL_CANINIT=y # Enabled CAN initialization + Enabling the CAN Loopback Test ------------------------------ Application Configuration -> Examples -> CAN Example diff --git a/configs/samv71-xult/src/sam_mcan.c b/configs/samv71-xult/src/sam_mcan.c index 8df2375941..dd4e8e7c3a 100644 --- a/configs/samv71-xult/src/sam_mcan.c +++ b/configs/samv71-xult/src/sam_mcan.c @@ -87,7 +87,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -95,7 +95,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/shenzhou/src/stm32_can.c b/configs/shenzhou/src/stm32_can.c index 0c888f7c8b..929d25316b 100644 --- a/configs/shenzhou/src/stm32_can.c +++ b/configs/shenzhou/src/stm32_can.c @@ -86,7 +86,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -94,7 +94,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/stm3210e-eval/src/stm32_can.c b/configs/stm3210e-eval/src/stm32_can.c index c356524516..2efb493ca1 100644 --- a/configs/stm3210e-eval/src/stm32_can.c +++ b/configs/stm3210e-eval/src/stm32_can.c @@ -86,7 +86,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -94,7 +94,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/stm3220g-eval/src/stm32_can.c b/configs/stm3220g-eval/src/stm32_can.c index e99e98ba48..dfd96e84c2 100644 --- a/configs/stm3220g-eval/src/stm32_can.c +++ b/configs/stm3220g-eval/src/stm32_can.c @@ -94,7 +94,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -102,7 +102,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/stm3240g-eval/src/stm32_can.c b/configs/stm3240g-eval/src/stm32_can.c index f89acdb760..40a29e50d8 100644 --- a/configs/stm3240g-eval/src/stm32_can.c +++ b/configs/stm3240g-eval/src/stm32_can.c @@ -94,7 +94,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -102,7 +102,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/viewtool-stm32f107/src/stm32_can.c b/configs/viewtool-stm32f107/src/stm32_can.c index 38dfa340e5..c6d0616ee3 100644 --- a/configs/viewtool-stm32f107/src/stm32_can.c +++ b/configs/viewtool-stm32f107/src/stm32_can.c @@ -85,7 +85,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All STM32 architectures must provide the following interface to work with @@ -93,7 +93,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can; diff --git a/configs/zkit-arm-1769/src/lpc17_can.c b/configs/zkit-arm-1769/src/lpc17_can.c index 5bc6b94410..72bff22c59 100644 --- a/configs/zkit-arm-1769/src/lpc17_can.c +++ b/configs/zkit-arm-1769/src/lpc17_can.c @@ -90,7 +90,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: can_devinit + * Name: board_can_initialize * * Description: * All LPC17 architectures must provide the following interface to work with @@ -98,7 +98,7 @@ * ************************************************************************************/ -int can_devinit(void) +int board_can_initialize(void) { static bool initialized = false; struct can_dev_s *can;