From efbd6ada2183ea64f93c201487da2a2d690e0e2f Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Fri, 17 Apr 2020 11:23:05 +0200 Subject: [PATCH] boards: cxd56: spresense: nxstyle fixes nxstyle fixes for the Sony Spresense board Signed-off-by: Alin Jerpelea --- boards/arm/cxd56xx/spresense/include/board.h | 20 +++++++++---------- .../cxd56xx/spresense/include/cxd56_altmdm.h | 2 +- .../spresense/include/cxd56_imageproc.h | 10 +++++++++- .../arm/cxd56xx/spresense/src/cxd56_buttons.c | 5 +++-- .../arm/cxd56xx/spresense/src/cxd56_charger.c | 9 ++++++++- .../cxd56xx/spresense/src/cxd56_composite.c | 6 +++--- .../arm/cxd56xx/spresense/src/cxd56_gauge.c | 6 ++++++ .../arm/cxd56xx/spresense/src/cxd56_gpioif.c | 9 ++++++++- .../arm/cxd56xx/spresense/src/cxd56_ioctl.c | 9 +++++---- .../arm/cxd56xx/spresense/src/cxd56_power.c | 1 + .../arm/cxd56xx/spresense/src/cxd56_sdcard.c | 9 +++++---- boards/arm/cxd56xx/spresense/src/cxd56_spi.c | 4 ++-- 12 files changed, 61 insertions(+), 29 deletions(-) diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h index 037a279988..27ee098abc 100644 --- a/boards/arm/cxd56xx/spresense/include/board.h +++ b/boards/arm/cxd56xx/spresense/include/board.h @@ -78,7 +78,7 @@ * Pre-processor Definitions ****************************************************************************/ -/* Clocking ****************************************************************/ +/* Clocking *****************************************************************/ #ifdef CONFIG_CXD56_80MHz # define BOARD_FCLKOUT_FREQUENCY (80000000) @@ -86,7 +86,7 @@ # define BOARD_FCLKOUT_FREQUENCY (100000000) #endif -/* UART clocking ***********************************************************/ +/* UART clocking ************************************************************/ /* Configure all UARTs to use the XTAL input frequency */ @@ -94,7 +94,7 @@ #define BOARD_UART1_BASEFREQ BOARD_FCLKOUT_FREQUENCY #define BOARD_UART2_BASEFREQ CONFIG_CXD56_XOSC_CLOCK -/* LED definitions *********************************************************/ +/* LED definitions **********************************************************/ #define GPIO_LED1 (PIN_I2S1_BCK) #define GPIO_LED2 (PIN_I2S1_LRCK) @@ -125,11 +125,11 @@ #define LED_ASSERTION (BOARD_LED1_BIT | BOARD_LED2_BIT | BOARD_LED3_BIT) #define LED_PANIC (BOARD_LED4_BIT) -/* Buttons definitions *****************************************************/ +/* Buttons definitions ******************************************************/ #define BOARD_NUM_BUTTONS (2) -/* Power Control definitions ***********************************************/ +/* Power Control definitions ************************************************/ /* For SPRESENSE board: * @@ -192,17 +192,17 @@ enum board_power_device POWER_LTE = PMIC_GPO(2), }; -/* CXD5247 audio control definitions ***************************************/ +/* CXD5247 audio control definitions ****************************************/ #define CXD5247_XRST PIN_SPI3_CS2_X #define CXD5247_AVDD (0x01) #define CXD5247_DVDD (0x02) -/* LCD Display clocking ****************************************************/ +/* LCD Display clocking *****************************************************/ #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. */ @@ -234,12 +234,12 @@ enum board_power_device #endif -/* Sensor device bus definitions *******************************************/ +/* Sensor device bus definitions ********************************************/ #define SENSOR_I2C 0 #define SENSOR_SPI 3 -/* Imager device pin definitions *******************************************/ +/* Imager device pin definitions ********************************************/ #define IMAGER_RST PIN_SDIO_DIR1_3 #define IMAGER_SLEEP PIN_SDIO_DIR0 diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_altmdm.h b/boards/arm/cxd56xx/spresense/include/cxd56_altmdm.h index fe1b3522b4..37221b0908 100644 --- a/boards/arm/cxd56xx/spresense/include/cxd56_altmdm.h +++ b/boards/arm/cxd56xx/spresense/include/cxd56_altmdm.h @@ -49,7 +49,7 @@ * Pre-processor Definitions ****************************************************************************/ -/* Altair modem gpio definitions *******************************************/ +/* Altair modem gpio definitions ********************************************/ #if defined(CONFIG_MODEM_ALTMDM) && defined(CONFIG_CXD56_GPIO_IRQ) diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h b/boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h index 173df778e7..305d0a0a8f 100644 --- a/boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h +++ b/boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h @@ -1,4 +1,4 @@ -/*************************************************************************** +/**************************************************************************** * boards/arm/cxd56xx/spresense/include/cxd56_imageproc.h * * Copyright 2018 Sony Semiconductor Solutions Corporation @@ -32,6 +32,10 @@ * ****************************************************************************/ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #ifndef __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; +/**************************************************************************** + * Public Functions Prototypes + ****************************************************************************/ + /* Initialize imageproc library */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_buttons.c b/boards/arm/cxd56xx/spresense/src/cxd56_buttons.c index 60ba3d4579..fd3ca0ffa1 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_buttons.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_buttons.c @@ -61,8 +61,9 @@ * Public Functions ****************************************************************************/ -/* Below functions are template to support the Board button for NuttX original - * feature. If you support the feature, copy this file into your board +/* Below functions are template to support the Board button for NuttX + * original feature. + * If you support the feature, copy this file into your board * directory and implement the contents. */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_charger.c b/boards/arm/cxd56xx/spresense/src/cxd56_charger.c index fc5e9896e0..b12c0a50f2 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_charger.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_charger.c @@ -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; @@ -69,6 +74,7 @@ int board_charger_initialize(FAR const char *devpath, FAR int16_t *gaugemeter) _err("ERROR: Failed to initialize charger.\n"); return -ENODEV; } + g_chargerinitialized = 1; } @@ -95,6 +101,7 @@ int board_charger_uninitialize(FAR const char *devpath) _err("ERROR: Failed to finalize charger.\n"); return -ENODEV; } + g_chargerinitialized = 0; } diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_composite.c b/boards/arm/cxd56xx/spresense/src/cxd56_composite.c index 8cb3d85efc..d80774dbef 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_composite.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_composite.c @@ -137,9 +137,9 @@ static int board_mscclassobject(int minor, * Name: board_mscuninitialize * * Description: - * Un-initialize the USB storage class driver. This is just an application- - * specific wrapper aboutn usbmsc_unitialize() that is called form the - * composite device logic. + * Un-initialize the USB storage class driver. + * This is just an application specific wrapper for usbmsc_unitialize() + * that is called form the composite device logic. * * Input Parameters: * classdev - The class driver instrance previously give to the composite diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_gauge.c b/boards/arm/cxd56xx/spresense/src/cxd56_gauge.c index 88c384ff08..add2a226f3 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_gauge.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_gauge.c @@ -49,6 +49,10 @@ static int g_gaugeinitialized = 0; +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * 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"); return -ENODEV; } + g_gaugeinitialized = 1; } @@ -95,6 +100,7 @@ int board_gauge_uninitialize(FAR const char *devpath) _err("ERROR: Failed to finalize gauge.\n"); return -ENODEV; } + g_gaugeinitialized = 0; } diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_gpioif.c b/boards/arm/cxd56xx/spresense/src/cxd56_gpioif.c index 6e89653ff6..eb0d857880 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_gpioif.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_gpioif.c @@ -110,6 +110,7 @@ int board_gpio_status(uint32_t pin, bool *input, bool *output, bool *drive, { return ret; } + *input = PINCONF_INPUT_ENABLED(pstat.input_en); *drive = PINCONF_IS_DRIVE_HIGH(pstat.drive); 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)); } + return; } @@ -212,7 +214,10 @@ int board_gpio_intconfig(uint32_t pin, int mode, bool filter, xcpt_t isr) * 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 int ret; @@ -249,6 +254,7 @@ int board_gpio_intstatus(uint32_t pin, int *mode, bool *filter, bool *enabled) *mode = 0; break; } + *filter = stat.filter; *enabled = stat.enable; @@ -278,6 +284,7 @@ int board_gpio_int(uint32_t pin, bool enable) cxd56_gpioint_disable(pin); } } + return irq; #else return -ENOTSUP; diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c index 014fd4ca91..0580648173 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c @@ -67,10 +67,11 @@ * calls. This, however, may not be practical in many cases and will lead * to "correct" but awkward implementations. * - * boardctl() is non-standard OS interface to alleviate the problem. It - * basically circumvents the normal device driver ioctl interlace and allows - * the application to perform direct IOCTL-like calls to the board-specific - * logic. It is especially useful for setting up board operational and + * boardctl() is non-standard OS interface to alleviate the problem. + * It basically circumvents the normal device driver ioctl interlace and + * allows the application to perform direct IOCTL-like calls to the + * board-specific logic. + * It is especially useful for setting up board operational and * test configurations. * * Input Parameters: diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_power.c b/boards/arm/cxd56xx/spresense/src/cxd56_power.c index 0c15c959f3..b4dcbc5f74 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_power.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_power.c @@ -295,6 +295,7 @@ int board_flash_power_control(bool en) board_power_control(POWER_FLASH, false); } + return ret; } diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c index 6df583fb94..fb6eafae39 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c @@ -166,7 +166,8 @@ static void board_sdcard_enable(FAR void *arg) ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); 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 { @@ -181,9 +182,9 @@ static void board_sdcard_enable(FAR void *arg) 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); } - return OK; + return OK; } #endif diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_spi.c b/boards/arm/cxd56xx/spresense/src/cxd56_spi.c index 54ffba571f..9e4cb15ea0 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_spi.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_spi.c @@ -74,8 +74,8 @@ * functions in your board-specific logic. * These functions will perform chip selection and status operations * using GPIOs in the way your board is configured. - * 3. Add a calls to cxd56_spibus_initialize() in your low level application - * initialization logic + * 3. Add a calls to cxd56_spibus_initialize() in your low level + * application initialization logic * 4. The handle returned by cxd56_spibus_initialize() may then be used to * bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to