boards: cxd56: spresense: nxstyle fixes

nxstyle fixes for the Sony Spresense board

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2020-04-17 11:23:05 +02:00
committed by patacongo
parent f2a6d88c9d
commit efbd6ada21
12 changed files with 61 additions and 29 deletions
+10 -10
View File
@@ -78,7 +78,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Clocking ****************************************************************/ /* Clocking *****************************************************************/
#ifdef CONFIG_CXD56_80MHz #ifdef CONFIG_CXD56_80MHz
# define BOARD_FCLKOUT_FREQUENCY (80000000) # define BOARD_FCLKOUT_FREQUENCY (80000000)
@@ -86,7 +86,7 @@
# define BOARD_FCLKOUT_FREQUENCY (100000000) # define BOARD_FCLKOUT_FREQUENCY (100000000)
#endif #endif
/* UART clocking ***********************************************************/ /* UART clocking ************************************************************/
/* Configure all UARTs to use the XTAL input frequency */ /* Configure all UARTs to use the XTAL input frequency */
@@ -94,7 +94,7 @@
#define BOARD_UART1_BASEFREQ BOARD_FCLKOUT_FREQUENCY #define BOARD_UART1_BASEFREQ BOARD_FCLKOUT_FREQUENCY
#define BOARD_UART2_BASEFREQ CONFIG_CXD56_XOSC_CLOCK #define BOARD_UART2_BASEFREQ CONFIG_CXD56_XOSC_CLOCK
/* LED definitions *********************************************************/ /* LED definitions **********************************************************/
#define GPIO_LED1 (PIN_I2S1_BCK) #define GPIO_LED1 (PIN_I2S1_BCK)
#define GPIO_LED2 (PIN_I2S1_LRCK) #define GPIO_LED2 (PIN_I2S1_LRCK)
@@ -125,11 +125,11 @@
#define LED_ASSERTION (BOARD_LED1_BIT | BOARD_LED2_BIT | BOARD_LED3_BIT) #define LED_ASSERTION (BOARD_LED1_BIT | BOARD_LED2_BIT | BOARD_LED3_BIT)
#define LED_PANIC (BOARD_LED4_BIT) #define LED_PANIC (BOARD_LED4_BIT)
/* Buttons definitions *****************************************************/ /* Buttons definitions ******************************************************/
#define BOARD_NUM_BUTTONS (2) #define BOARD_NUM_BUTTONS (2)
/* Power Control definitions ***********************************************/ /* Power Control definitions ************************************************/
/* For SPRESENSE board: /* For SPRESENSE board:
* *
@@ -192,17 +192,17 @@ enum board_power_device
POWER_LTE = PMIC_GPO(2), POWER_LTE = PMIC_GPO(2),
}; };
/* CXD5247 audio control definitions ***************************************/ /* CXD5247 audio control definitions ****************************************/
#define CXD5247_XRST PIN_SPI3_CS2_X #define CXD5247_XRST PIN_SPI3_CS2_X
#define CXD5247_AVDD (0x01) #define CXD5247_AVDD (0x01)
#define CXD5247_DVDD (0x02) #define CXD5247_DVDD (0x02)
/* LCD Display clocking ****************************************************/ /* LCD Display clocking *****************************************************/
#define ILI9340_SPI_MAXFREQUENCY 40000000 #define ILI9340_SPI_MAXFREQUENCY 40000000
/* Display device pin definitions ******************************************/ /* Display device pin definitions *******************************************/
#if defined(CONFIG_LCD_ON_MAIN_BOARD) /* Display connected to main board. */ #if defined(CONFIG_LCD_ON_MAIN_BOARD) /* Display connected to main board. */
@@ -234,12 +234,12 @@ enum board_power_device
#endif #endif
/* Sensor device bus definitions *******************************************/ /* Sensor device bus definitions ********************************************/
#define SENSOR_I2C 0 #define SENSOR_I2C 0
#define SENSOR_SPI 3 #define SENSOR_SPI 3
/* Imager device pin definitions *******************************************/ /* Imager device pin definitions ********************************************/
#define IMAGER_RST PIN_SDIO_DIR1_3 #define IMAGER_RST PIN_SDIO_DIR1_3
#define IMAGER_SLEEP PIN_SDIO_DIR0 #define IMAGER_SLEEP PIN_SDIO_DIR0
@@ -49,7 +49,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Altair modem gpio definitions *******************************************/ /* Altair modem gpio definitions ********************************************/
#if defined(CONFIG_MODEM_ALTMDM) && defined(CONFIG_CXD56_GPIO_IRQ) #if defined(CONFIG_MODEM_ALTMDM) && defined(CONFIG_CXD56_GPIO_IRQ)
@@ -1,4 +1,4 @@
/*************************************************************************** /****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h * boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h
* *
* Copyright 2018 Sony Semiconductor Solutions Corporation * Copyright 2018 Sony Semiconductor Solutions Corporation
@@ -32,6 +32,10 @@
* *
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_IMAGEPROC_H #ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_IMAGEPROC_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_IMAGEPROC_H #define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_IMAGEPROC_H
@@ -55,6 +59,10 @@ extern "C"
}; };
typedef struct imageproc_rect_s imageproc_rect_t; typedef struct imageproc_rect_s imageproc_rect_t;
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/* Initialize imageproc library /* Initialize imageproc library
*/ */
@@ -61,8 +61,9 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/* Below functions are template to support the Board button for NuttX original /* Below functions are template to support the Board button for NuttX
* feature. If you support the feature, copy this file into your board * original feature.
* If you support the feature, copy this file into your board
* directory and implement the contents. * directory and implement the contents.
*/ */
@@ -57,7 +57,12 @@ static int g_chargerinitialized = 0;
* *
****************************************************************************/ ****************************************************************************/
int board_charger_initialize(FAR const char *devpath, FAR int16_t *gaugemeter) /****************************************************************************
* Public Functions
****************************************************************************/
int board_charger_initialize(FAR const char *devpath,
FAR int16_t *gaugemeter)
{ {
int ret; int ret;
@@ -69,6 +74,7 @@ int board_charger_initialize(FAR const char *devpath, FAR int16_t *gaugemeter)
_err("ERROR: Failed to initialize charger.\n"); _err("ERROR: Failed to initialize charger.\n");
return -ENODEV; return -ENODEV;
} }
g_chargerinitialized = 1; g_chargerinitialized = 1;
} }
@@ -95,6 +101,7 @@ int board_charger_uninitialize(FAR const char *devpath)
_err("ERROR: Failed to finalize charger.\n"); _err("ERROR: Failed to finalize charger.\n");
return -ENODEV; return -ENODEV;
} }
g_chargerinitialized = 0; g_chargerinitialized = 0;
} }
@@ -137,9 +137,9 @@ static int board_mscclassobject(int minor,
* Name: board_mscuninitialize * Name: board_mscuninitialize
* *
* Description: * Description:
* Un-initialize the USB storage class driver. This is just an application- * Un-initialize the USB storage class driver.
* specific wrapper aboutn usbmsc_unitialize() that is called form the * This is just an application specific wrapper for usbmsc_unitialize()
* composite device logic. * that is called form the composite device logic.
* *
* Input Parameters: * Input Parameters:
* classdev - The class driver instrance previously give to the composite * classdev - The class driver instrance previously give to the composite
@@ -49,6 +49,10 @@
static int g_gaugeinitialized = 0; static int g_gaugeinitialized = 0;
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: board_gauge_initialize * Name: board_gauge_initialize
* *
@@ -69,6 +73,7 @@ int board_gauge_initialize(FAR const char *devpath, FAR int16_t *gaugemeter)
_err("ERROR: Failed to initialize gauge.\n"); _err("ERROR: Failed to initialize gauge.\n");
return -ENODEV; return -ENODEV;
} }
g_gaugeinitialized = 1; g_gaugeinitialized = 1;
} }
@@ -95,6 +100,7 @@ int board_gauge_uninitialize(FAR const char *devpath)
_err("ERROR: Failed to finalize gauge.\n"); _err("ERROR: Failed to finalize gauge.\n");
return -ENODEV; return -ENODEV;
} }
g_gaugeinitialized = 0; g_gaugeinitialized = 0;
} }
@@ -110,6 +110,7 @@ int board_gpio_status(uint32_t pin, bool *input, bool *output, bool *drive,
{ {
return ret; return ret;
} }
*input = PINCONF_INPUT_ENABLED(pstat.input_en); *input = PINCONF_INPUT_ENABLED(pstat.input_en);
*drive = PINCONF_IS_DRIVE_HIGH(pstat.drive); *drive = PINCONF_IS_DRIVE_HIGH(pstat.drive);
if (PINCONF_IS_FLOAT(pstat.pull)) if (PINCONF_IS_FLOAT(pstat.pull))
@@ -149,6 +150,7 @@ void board_gpio_write(uint32_t pin, int value)
{ {
cxd56_gpio_write(pin, (value > 0)); cxd56_gpio_write(pin, (value > 0));
} }
return; return;
} }
@@ -212,7 +214,10 @@ int board_gpio_intconfig(uint32_t pin, int mode, bool filter, xcpt_t isr)
* Name: board_gpio_intstatus * Name: board_gpio_intstatus
****************************************************************************/ ****************************************************************************/
int board_gpio_intstatus(uint32_t pin, int *mode, bool *filter, bool *enabled) int board_gpio_intstatus(uint32_t pin,
int *mode,
bool *filter,
bool *enabled)
{ {
#ifdef CONFIG_CXD56_GPIO_IRQ #ifdef CONFIG_CXD56_GPIO_IRQ
int ret; int ret;
@@ -249,6 +254,7 @@ int board_gpio_intstatus(uint32_t pin, int *mode, bool *filter, bool *enabled)
*mode = 0; *mode = 0;
break; break;
} }
*filter = stat.filter; *filter = stat.filter;
*enabled = stat.enable; *enabled = stat.enable;
@@ -278,6 +284,7 @@ int board_gpio_int(uint32_t pin, bool enable)
cxd56_gpioint_disable(pin); cxd56_gpioint_disable(pin);
} }
} }
return irq; return irq;
#else #else
return -ENOTSUP; return -ENOTSUP;
@@ -67,10 +67,11 @@
* calls. This, however, may not be practical in many cases and will lead * calls. This, however, may not be practical in many cases and will lead
* to "correct" but awkward implementations. * to "correct" but awkward implementations.
* *
* boardctl() is non-standard OS interface to alleviate the problem. It * boardctl() is non-standard OS interface to alleviate the problem.
* basically circumvents the normal device driver ioctl interlace and allows * It basically circumvents the normal device driver ioctl interlace and
* the application to perform direct IOCTL-like calls to the board-specific * allows the application to perform direct IOCTL-like calls to the
* logic. It is especially useful for setting up board operational and * board-specific logic.
* It is especially useful for setting up board operational and
* test configurations. * test configurations.
* *
* Input Parameters: * Input Parameters:
@@ -295,6 +295,7 @@ int board_flash_power_control(bool en)
board_power_control(POWER_FLASH, false); board_power_control(POWER_FLASH, false);
} }
return ret; return ret;
} }
@@ -166,7 +166,8 @@ static void board_sdcard_enable(FAR void *arg)
ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL);
if (ret == 0) if (ret == 0)
{ {
finfo("Successfully mount a SDCARD via the MMC/SD driver\n"); finfo(
"Successfully mount a SDCARD via the MMC/SD driver\n");
} }
else else
{ {
@@ -181,9 +182,9 @@ static void board_sdcard_enable(FAR void *arg)
release_frequency_lock: release_frequency_lock:
/* Release frequency lock */ /* Release frequency lock */
up_pm_release_freqlock(&g_hv_lock); up_pm_release_freqlock(&g_hv_lock);
} }
/**************************************************************************** /****************************************************************************
@@ -317,7 +318,7 @@ static int board_sdcard_detect_int(int irq, FAR void *context, FAR void *arg)
NULL); NULL);
} }
return OK; return OK;
} }
#endif #endif
+2 -2
View File
@@ -74,8 +74,8 @@
* functions in your board-specific logic. * functions in your board-specific logic.
* These functions will perform chip selection and status operations * These functions will perform chip selection and status operations
* using GPIOs in the way your board is configured. * using GPIOs in the way your board is configured.
* 3. Add a calls to cxd56_spibus_initialize() in your low level application * 3. Add a calls to cxd56_spibus_initialize() in your low level
* initialization logic * application initialization logic
* 4. The handle returned by cxd56_spibus_initialize() may then be used to * 4. The handle returned by cxd56_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling * bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to * mmcsd_spislotinitialize(), for example, will bind the SPI driver to