mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
arch/arm/tiva: simplify TIVA_CAN option usage
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
bd7cb522a1
commit
a58e73add8
@@ -435,6 +435,7 @@ config TIVA_HAVE_ADC1
|
||||
config TIVA_CAN
|
||||
bool
|
||||
default n
|
||||
select CAN
|
||||
select ARCH_HAVE_CAN_ERRORS
|
||||
select CAN_TXREADY
|
||||
select CAN_USE_RTR
|
||||
@@ -610,7 +611,6 @@ config TIVA_CAN0
|
||||
bool "CAN0"
|
||||
default n
|
||||
depends on TIVA_HAVE_CAN0
|
||||
select CAN
|
||||
select TIVA_CAN
|
||||
|
||||
config TIVA_CAN0_PRIO
|
||||
@@ -627,7 +627,6 @@ config TIVA_CAN1
|
||||
bool "CAN1"
|
||||
default n
|
||||
depends on TIVA_HAVE_CAN1
|
||||
select CAN
|
||||
select TIVA_CAN
|
||||
|
||||
config TIVA_CAN1_PRIO
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#include "tiva_gpio.h"
|
||||
#include "hardware/tiva_pinmap.h"
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
#ifdef CONFIG_TIVA_CAN
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -78,21 +78,18 @@
|
||||
|
||||
int tm4c_can_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_TIVA_CAN
|
||||
int ret;
|
||||
int ret = ERROR;
|
||||
|
||||
# ifdef CONFIG_TIVA_CAN0
|
||||
tiva_can0_enableclk();
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN0_RX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
}
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN0_TX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
@@ -114,14 +111,12 @@ int tm4c_can_setup(void)
|
||||
tiva_can1_enableclk();
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN1_RX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
}
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN1_TX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
@@ -144,10 +139,6 @@ int tm4c_can_setup(void)
|
||||
configgpio_error:
|
||||
canerr("ERROR: failed to configure CAN GPIO pin.\n");
|
||||
return ret;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CAN */
|
||||
|
||||
#endif /* CONFIG_TIVA_CAN */
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "tiva_gpio.h"
|
||||
#include "hardware/tiva_pinmap.h"
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
#ifdef CONFIG_TIVA_CAN
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -61,21 +61,18 @@
|
||||
|
||||
int tm4c_can_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_TIVA_CAN
|
||||
int ret;
|
||||
int ret = ERROR;
|
||||
|
||||
# ifdef CONFIG_TIVA_CAN0
|
||||
tiva_can0_enableclk();
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN0_RX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
}
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN0_TX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
@@ -97,14 +94,12 @@ int tm4c_can_setup(void)
|
||||
tiva_can1_enableclk();
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN1_RX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
}
|
||||
|
||||
ret = tiva_configgpio(GPIO_CAN1_TX);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
goto configgpio_error;
|
||||
@@ -127,10 +122,6 @@ int tm4c_can_setup(void)
|
||||
configgpio_error:
|
||||
canerr("ERROR: failed to configure CAN GPIO pin.\n");
|
||||
return ret;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CAN */
|
||||
|
||||
#endif /* CONFIG_TIVA_CAN */
|
||||
|
||||
Reference in New Issue
Block a user