arch/arm/src/nrf52: fix coding standard issues

This commit is contained in:
raiden00pl 2020-03-27 17:56:57 +01:00 committed by patacongo
parent fef7abb598
commit d217b3a889
19 changed files with 57 additions and 78 deletions

View File

@ -58,20 +58,4 @@
#define ARMV7M_PERIPHERAL_INTERRUPTS NRF52_IRQ_NEXTINT #define ARMV7M_PERIPHERAL_INTERRUPTS NRF52_IRQ_NEXTINT
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_NRF52_CHIP_H */ #endif /* __ARCH_ARM_SRC_NRF52_CHIP_H */

View File

@ -63,7 +63,7 @@
* clocking using the settings in board.h. This function also performs * clocking using the settings in board.h. This function also performs
* other low-level chip as necessary. * other low-level chip as necessary.
* *
*****************************************************************************/ ****************************************************************************/
void nrf52_clockconfig() void nrf52_clockconfig()
{ {

View File

@ -49,15 +49,9 @@
/* Frequencies of internal clocks */ /* Frequencies of internal clocks */
#define NRF52_SYSTEM_CLOCK 64000000 /* Default System clock value */ #define NRF52_SYSTEM_CLOCK 64000000 /* Default System clock value */
#define NRF52_RTC_CLOCK 32768 /* RTC oscillator 32 kHz output (32k_clk )*/ #define NRF52_RTC_CLOCK 32768 /* RTC oscillator 32 kHz output
* (32k_clk)
/**************************************************************************** */
* Public Types
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
@ -87,7 +81,7 @@ extern "C"
* clocking using the settings in board.h. This function also performs * clocking using the settings in board.h. This function also performs
* other low-level chip as necessary. * other low-level chip as necessary.
* *
*****************************************************************************/ ****************************************************************************/
void nrf52_clockconfig(void); void nrf52_clockconfig(void);

View File

@ -49,7 +49,7 @@
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ************************************************************************************/
/* Configuration *********************************************************************/ /* Configuration ********************************************************************/
/* Make sure that no unsupported UART, I2C master, or SPI master peripherals are /* Make sure that no unsupported UART, I2C master, or SPI master peripherals are
* enabled. * enabled.
@ -95,8 +95,4 @@
# define HAVE_UART_CONSOLE 1 # define HAVE_UART_CONSOLE 1
#endif #endif
/************************************************************************************
* Public Functions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_NRF52_NRF52_CONFIG_H */ #endif /* __ARCH_ARM_SRC_NRF52_NRF52_CONFIG_H */

View File

@ -202,7 +202,7 @@ extern "C"
#endif #endif
/************************************************************************************ /************************************************************************************
* Public Functions * Public Function Prototypes
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************

View File

@ -46,10 +46,6 @@
#include "chip.h" #include "chip.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/

View File

@ -85,7 +85,7 @@ struct nrf52_i2c_priv_s
uint32_t freq; /* Current I2C frequency */ uint32_t freq; /* Current I2C frequency */
int dcnt; /* Current message length */ int dcnt; /* Current message length */
uint16_t flags; /* Current message flags */ uint16_t flags; /* Current message flags */
uint16_t addr; /* Current I2C address*/ uint16_t addr; /* Current I2C address */
sem_t sem_excl; /* Mutual exclusion semaphore */ sem_t sem_excl; /* Mutual exclusion semaphore */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
sem_t sem_isr; /* Interrupt wait semaphore */ sem_t sem_isr; /* Interrupt wait semaphore */

View File

@ -45,10 +45,6 @@
#include "chip.h" #include "chip.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/

View File

@ -124,21 +124,30 @@ static void nrf52_dumpnvic(const char *msg, int irq)
getreg32(NVIC_SYSTICK_CTRL_ENABLE)); getreg32(NVIC_SYSTICK_CTRL_ENABLE));
#endif #endif
irqinfo(" IRQ ENABLE: %08x %08x\n", irqinfo(" IRQ ENABLE: %08x %08x\n",
getreg32(NVIC_IRQ0_31_ENABLE), getreg32(NVIC_IRQ32_63_ENABLE)); getreg32(NVIC_IRQ0_31_ENABLE),
getreg32(NVIC_IRQ32_63_ENABLE));
irqinfo(" SYSH_PRIO: %08x %08x %08x\n", irqinfo(" SYSH_PRIO: %08x %08x %08x\n",
getreg32(NVIC_SYSH4_7_PRIORITY), getreg32(NVIC_SYSH8_11_PRIORITY), getreg32(NVIC_SYSH4_7_PRIORITY),
getreg32(NVIC_SYSH8_11_PRIORITY),
getreg32(NVIC_SYSH12_15_PRIORITY)); getreg32(NVIC_SYSH12_15_PRIORITY));
irqinfo(" IRQ PRIO: %08x %08x %08x %08x\n", irqinfo(" IRQ PRIO: %08x %08x %08x %08x\n",
getreg32(NVIC_IRQ0_3_PRIORITY), getreg32(NVIC_IRQ4_7_PRIORITY), getreg32(NVIC_IRQ0_3_PRIORITY),
getreg32(NVIC_IRQ8_11_PRIORITY), getreg32(NVIC_IRQ12_15_PRIORITY)); getreg32(NVIC_IRQ4_7_PRIORITY),
getreg32(NVIC_IRQ8_11_PRIORITY),
getreg32(NVIC_IRQ12_15_PRIORITY));
irqinfo(" %08x %08x %08x %08x\n", irqinfo(" %08x %08x %08x %08x\n",
getreg32(NVIC_IRQ16_19_PRIORITY), getreg32(NVIC_IRQ20_23_PRIORITY), getreg32(NVIC_IRQ16_19_PRIORITY),
getreg32(NVIC_IRQ24_27_PRIORITY), getreg32(NVIC_IRQ28_31_PRIORITY)); getreg32(NVIC_IRQ20_23_PRIORITY),
getreg32(NVIC_IRQ24_27_PRIORITY),
getreg32(NVIC_IRQ28_31_PRIORITY));
irqinfo(" %08x %08x %08x %08x\n", irqinfo(" %08x %08x %08x %08x\n",
getreg32(NVIC_IRQ32_35_PRIORITY), getreg32(NVIC_IRQ36_39_PRIORITY), getreg32(NVIC_IRQ32_35_PRIORITY),
getreg32(NVIC_IRQ40_43_PRIORITY), getreg32(NVIC_IRQ44_47_PRIORITY)); getreg32(NVIC_IRQ36_39_PRIORITY),
getreg32(NVIC_IRQ40_43_PRIORITY),
getreg32(NVIC_IRQ44_47_PRIORITY));
irqinfo(" %08x %08x %08x\n", irqinfo(" %08x %08x %08x\n",
getreg32(NVIC_IRQ48_51_PRIORITY), getreg32(NVIC_IRQ52_55_PRIORITY), getreg32(NVIC_IRQ48_51_PRIORITY),
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY)); getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags); leave_critical_section(flags);

View File

@ -43,7 +43,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************

View File

@ -135,10 +135,10 @@ static void nrf52_setbaud(uintptr_t base, const struct uart_config_s *config)
* Name: nrf52_lowsetup * Name: nrf52_lowsetup
* *
* Description: * Description:
* Called at the very beginning of _start. Performs low level initialization * Called at the very beginning of _start. Performs low level
* including setup of the console UART. This UART initialization is done * initialization including setup of the console UART.
* early so that the serial console is available for debugging very early in * This UART initialization is done early so that the serial console is
* the boot sequence. * available for debugging very early in the boot sequence.
* *
****************************************************************************/ ****************************************************************************/
@ -163,7 +163,8 @@ void nrf52_lowsetup(void)
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_UART_DEVICE #ifdef HAVE_UART_DEVICE
void nrf52_usart_configure(uintptr_t base, const struct uart_config_s *config) void nrf52_usart_configure(uintptr_t base,
const struct uart_config_s *config)
{ {
uint32_t pin = 0; uint32_t pin = 0;
uint32_t port = 0; uint32_t port = 0;

View File

@ -71,7 +71,7 @@ struct uart_config_s
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************

View File

@ -329,10 +329,10 @@ static void nrf52_shutdown(struct uart_dev_s *dev)
* Name: nrf52_attach * Name: nrf52_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * is called when the serial port is opened. Normally, this is just after
* the setup() method is called, however, the serial console may operate in * the the setup() method is called, however, the serial console may
* a non-interrupt driven mode during the boot phase. * operate in a non-interrupt driven mode during the boot phase.
* *
* RX and TX interrupts are not enabled when by the attach method (unless * RX and TX interrupts are not enabled when by the attach method (unless
* the hardware supports multiple levels of interrupt enabling). * the hardware supports multiple levels of interrupt enabling).
@ -364,8 +364,8 @@ static int nrf52_attach(struct uart_dev_s *dev)
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts. This method is called when the serial port is
* closed normally just before the shutdown method is called. The exception * closed normally just before the shutdown method is called.
* is the serial console which is never shutdown. * The exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -44,7 +44,7 @@
#include "nrf52_config.h" #include "nrf52_config.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************

View File

@ -84,7 +84,9 @@ struct nrf52_spidev_s
uint32_t frequency; /* Requested clock frequency */ uint32_t frequency; /* Requested clock frequency */
uint8_t mode; /* Mode 0,1,2,3 */ uint8_t mode; /* Mode 0,1,2,3 */
sem_t exclsem; /* Held while chip is selected for mutual exclusion */ sem_t exclsem; /* Held while chip is selected for mutual
* exclusion
*/
#ifdef CONFIG_NRF52_SPI_MASTER_INTERRUPTS #ifdef CONFIG_NRF52_SPI_MASTER_INTERRUPTS
sem_t sem_isr; /* Interrupt wait semaphore */ sem_t sem_isr; /* Interrupt wait semaphore */
#endif #endif

View File

@ -45,10 +45,6 @@
#include "chip.h" #include "chip.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
@ -84,14 +80,14 @@ FAR struct spi_dev_s *nrf52_spibus_initialize(int port);
* pins. * pins.
* 2. Provide nrf52_spi0/1/...select() and nrf52_spi0/1/...status() * 2. Provide nrf52_spi0/1/...select() and nrf52_spi0/1/...status()
* functions in your board-specific logic. These functions will perform * functions in your board-specific logic. These functions will perform
* chip selection and status operations using GPIOs in the way your board * chip selection and status operations using GPIOs in the way your
* is configured. * board is configured.
* 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file, * 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file,
* then provide nrf52_spi0/1/...cmddata() functions in your * then provide nrf52_spi0/1/...cmddata() functions in your
* board-specific logic. These functions will perform cmd/data selection * board-specific logic. These functions will perform cmd/data selection
* operations using GPIOs in the way your board is configured. * operations using GPIOs in the way your board is configured.
* 4. Add a calls to nrf52_spibus_initialize() in your low level application * 4. Add a calls to nrf52_spibus_initialize() in your low level
* initialization logic * application initialization logic.
* 5. The handle returned by nrf52_spibus_initialize() may then be used to * 5. The handle returned by nrf52_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

View File

@ -33,6 +33,10 @@
* *
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdint.h> #include <stdint.h>

View File

@ -55,8 +55,8 @@
* Name: nrf52_clrpend * Name: nrf52_clrpend
* *
* Description: * Description:
* Clear a pending interrupt at the NVIC. This does not seem to be required * Clear a pending interrupt at the NVIC. This does not seem to be
* for most interrupts. * required for most interrupts.
* *
* This function is logically a part of nrf52_irq.c, but I will keep it in * This function is logically a part of nrf52_irq.c, but I will keep it in
* a separate file so that it will not increase the footprint on NRF52 * a separate file so that it will not increase the footprint on NRF52
@ -76,7 +76,8 @@ void nrf52_clrpend(int irq)
} }
else if (irq < NRF52_IRQ_NIRQS) else if (irq < NRF52_IRQ_NIRQS)
{ {
putreg32(1 << (irq - NRF52_IRQ_EXTINT - 32), NVIC_IRQ32_63_CLRPEND); putreg32(1 << (irq - NRF52_IRQ_EXTINT - 32),
NVIC_IRQ32_63_CLRPEND);
} }
} }
} }

View File

@ -55,7 +55,7 @@ enum wdt_behaviour_e
}; };
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
#undef EXTERN #undef EXTERN