Rename can_devinit() to board_can_initialize(). Hook in to boardctl() with BOARDIOC_CAN_INITIALIZE

This commit is contained in:
Gregory Nutt 2015-08-18 13:21:45 -06:00
parent bc9b901e13
commit 88660657c2
17 changed files with 56 additions and 28 deletions

View File

@ -1750,6 +1750,15 @@ config BOARDCTL_PWMTEST
Architecture specific logic must provide board_pwm_setup() Architecture specific logic must provide board_pwm_setup()
interface. 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 config BOARDCTL_GRAPHICS
bool "Enable custom graphics initialization interfaces" bool "Enable custom graphics initialization interfaces"
default n default n

View File

@ -188,6 +188,21 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break; break;
#endif #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 #ifdef CONFIG_BOARDCTL_GRAPHICS
/* CMD: BOARDIOC_GRAPHICS_SETUP /* CMD: BOARDIOC_GRAPHICS_SETUP
* DESCRIPTION: Configure graphics that require special initialization * DESCRIPTION: Configure graphics that require special initialization

View File

@ -97,7 +97,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All LPC17 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -89,7 +89,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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(); return stm32_can_initialize();
} }

View File

@ -85,7 +85,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -89,7 +89,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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(); return stm32_can_initialize();
} }

View File

@ -88,7 +88,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -93,7 +93,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -93,7 +93,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -1121,6 +1121,10 @@ MCAN1 Loopback Test
CONFIG_SAMV7_MCAN1_TXFIFOQ_SIZE=8 # There are 8 queue elements CONFIG_SAMV7_MCAN1_TXFIFOQ_SIZE=8 # There are 8 queue elements
CONFIG_SAMV7_MCAN1_TXEVENTFIFO_SIZE=0 # The event FIFO is not used 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 Enabling the CAN Loopback Test
------------------------------ ------------------------------
Application Configuration -> Examples -> CAN Example Application Configuration -> Examples -> CAN Example

View File

@ -87,7 +87,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -86,7 +86,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -86,7 +86,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -94,7 +94,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -94,7 +94,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -85,7 +85,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All STM32 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;

View File

@ -90,7 +90,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: can_devinit * Name: board_can_initialize
* *
* Description: * Description:
* All LPC17 architectures must provide the following interface to work with * 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; static bool initialized = false;
struct can_dev_s *can; struct can_dev_s *can;