You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/03/27 18:52:03 UTC

[incubator-nuttx] 02/02: arch/arm/src/nrf52: fix coding standard issues

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d217b3a889f07b6d6c78be50c3efb30c0900f09e
Author: raiden00pl <ra...@gmail.com>
AuthorDate: Fri Mar 27 17:56:57 2020 +0100

    arch/arm/src/nrf52: fix coding standard issues
---
 arch/arm/src/nrf52/chip.h              | 16 ----------------
 arch/arm/src/nrf52/nrf52_clockconfig.c |  2 +-
 arch/arm/src/nrf52/nrf52_clockconfig.h | 14 ++++----------
 arch/arm/src/nrf52/nrf52_config.h      |  6 +-----
 arch/arm/src/nrf52/nrf52_gpio.h        |  2 +-
 arch/arm/src/nrf52/nrf52_gpiote.h      |  4 ----
 arch/arm/src/nrf52/nrf52_i2c.c         |  2 +-
 arch/arm/src/nrf52/nrf52_i2c.h         |  4 ----
 arch/arm/src/nrf52/nrf52_irq.c         | 27 ++++++++++++++++++---------
 arch/arm/src/nrf52/nrf52_irq.h         |  2 +-
 arch/arm/src/nrf52/nrf52_lowputc.c     | 11 ++++++-----
 arch/arm/src/nrf52/nrf52_lowputc.h     |  2 +-
 arch/arm/src/nrf52/nrf52_serial.c      | 12 ++++++------
 arch/arm/src/nrf52/nrf52_serial.h      |  2 +-
 arch/arm/src/nrf52/nrf52_spi.c         |  4 +++-
 arch/arm/src/nrf52/nrf52_spi.h         | 12 ++++--------
 arch/arm/src/nrf52/nrf52_start.c       |  4 ++++
 arch/arm/src/nrf52/nrf52_utils.c       |  7 ++++---
 arch/arm/src/nrf52/nrf52_wdt.h         |  2 +-
 19 files changed, 57 insertions(+), 78 deletions(-)

diff --git a/arch/arm/src/nrf52/chip.h b/arch/arm/src/nrf52/chip.h
index 1791918..9c35af9 100644
--- a/arch/arm/src/nrf52/chip.h
+++ b/arch/arm/src/nrf52/chip.h
@@ -58,20 +58,4 @@
 
 #define ARMV7M_PERIPHERAL_INTERRUPTS NRF52_IRQ_NEXTINT
 
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
 #endif /* __ARCH_ARM_SRC_NRF52_CHIP_H */
diff --git a/arch/arm/src/nrf52/nrf52_clockconfig.c b/arch/arm/src/nrf52/nrf52_clockconfig.c
index e7aa614..7a4730d 100644
--- a/arch/arm/src/nrf52/nrf52_clockconfig.c
+++ b/arch/arm/src/nrf52/nrf52_clockconfig.c
@@ -63,7 +63,7 @@
  *   clocking using the settings in board.h.  This function also performs
  *   other low-level chip as necessary.
  *
- *****************************************************************************/
+ ****************************************************************************/
 
 void nrf52_clockconfig()
 {
diff --git a/arch/arm/src/nrf52/nrf52_clockconfig.h b/arch/arm/src/nrf52/nrf52_clockconfig.h
index 7fb21c5..62fe47c 100644
--- a/arch/arm/src/nrf52/nrf52_clockconfig.h
+++ b/arch/arm/src/nrf52/nrf52_clockconfig.h
@@ -49,15 +49,9 @@
 /* Frequencies of internal clocks */
 
 #define NRF52_SYSTEM_CLOCK     64000000  /* Default System clock value */
-#define NRF52_RTC_CLOCK           32768  /* RTC oscillator 32 kHz output (32k_clk )*/
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
+#define NRF52_RTC_CLOCK           32768  /* RTC oscillator 32 kHz output
+                                          * (32k_clk)
+                                          */
 
 #ifndef __ASSEMBLY__
 
@@ -87,7 +81,7 @@ extern "C"
  *   clocking using the settings in board.h.  This function also performs
  *   other low-level chip as necessary.
  *
- *****************************************************************************/
+ ****************************************************************************/
 
 void nrf52_clockconfig(void);
 
diff --git a/arch/arm/src/nrf52/nrf52_config.h b/arch/arm/src/nrf52/nrf52_config.h
index a01abca..be740d3 100644
--- a/arch/arm/src/nrf52/nrf52_config.h
+++ b/arch/arm/src/nrf52/nrf52_config.h
@@ -49,7 +49,7 @@
  * Pre-processor Definitions
  ************************************************************************************/
 
-/* Configuration *********************************************************************/
+/* Configuration ********************************************************************/
 
 /* Make sure that no unsupported UART, I2C master, or SPI master peripherals are
  * enabled.
@@ -95,8 +95,4 @@
 #  define HAVE_UART_CONSOLE 1
 #endif
 
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
 #endif /* __ARCH_ARM_SRC_NRF52_NRF52_CONFIG_H */
diff --git a/arch/arm/src/nrf52/nrf52_gpio.h b/arch/arm/src/nrf52/nrf52_gpio.h
index e03810d..85fe0d0 100644
--- a/arch/arm/src/nrf52/nrf52_gpio.h
+++ b/arch/arm/src/nrf52/nrf52_gpio.h
@@ -202,7 +202,7 @@ extern "C"
 #endif
 
 /************************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ************************************************************************************/
 
 /************************************************************************************
diff --git a/arch/arm/src/nrf52/nrf52_gpiote.h b/arch/arm/src/nrf52/nrf52_gpiote.h
index 3b1e162..d822a2e 100644
--- a/arch/arm/src/nrf52/nrf52_gpiote.h
+++ b/arch/arm/src/nrf52/nrf52_gpiote.h
@@ -47,10 +47,6 @@
 #include "chip.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
 
diff --git a/arch/arm/src/nrf52/nrf52_i2c.c b/arch/arm/src/nrf52/nrf52_i2c.c
index 0285d8e..bae704a 100644
--- a/arch/arm/src/nrf52/nrf52_i2c.c
+++ b/arch/arm/src/nrf52/nrf52_i2c.c
@@ -85,7 +85,7 @@ struct nrf52_i2c_priv_s
   uint32_t                freq;     /* Current I2C frequency */
   int                     dcnt;     /* Current message length */
   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 */
 #ifndef CONFIG_I2C_POLLED
   sem_t sem_isr;                    /* Interrupt wait semaphore */
diff --git a/arch/arm/src/nrf52/nrf52_i2c.h b/arch/arm/src/nrf52/nrf52_i2c.h
index 9e39e7b..286cf71 100644
--- a/arch/arm/src/nrf52/nrf52_i2c.h
+++ b/arch/arm/src/nrf52/nrf52_i2c.h
@@ -46,10 +46,6 @@
 #include "chip.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
 
diff --git a/arch/arm/src/nrf52/nrf52_irq.c b/arch/arm/src/nrf52/nrf52_irq.c
index c822d56..a5f7599 100644
--- a/arch/arm/src/nrf52/nrf52_irq.c
+++ b/arch/arm/src/nrf52/nrf52_irq.c
@@ -124,21 +124,30 @@ static void nrf52_dumpnvic(const char *msg, int irq)
           getreg32(NVIC_SYSTICK_CTRL_ENABLE));
 #endif
   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",
-          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));
   irqinfo("  IRQ PRIO:   %08x %08x %08x %08x\n",
-          getreg32(NVIC_IRQ0_3_PRIORITY), getreg32(NVIC_IRQ4_7_PRIORITY),
-          getreg32(NVIC_IRQ8_11_PRIORITY), getreg32(NVIC_IRQ12_15_PRIORITY));
+          getreg32(NVIC_IRQ0_3_PRIORITY),
+          getreg32(NVIC_IRQ4_7_PRIORITY),
+          getreg32(NVIC_IRQ8_11_PRIORITY),
+          getreg32(NVIC_IRQ12_15_PRIORITY));
   irqinfo("              %08x %08x %08x %08x\n",
-          getreg32(NVIC_IRQ16_19_PRIORITY), getreg32(NVIC_IRQ20_23_PRIORITY),
-          getreg32(NVIC_IRQ24_27_PRIORITY), getreg32(NVIC_IRQ28_31_PRIORITY));
+          getreg32(NVIC_IRQ16_19_PRIORITY),
+          getreg32(NVIC_IRQ20_23_PRIORITY),
+          getreg32(NVIC_IRQ24_27_PRIORITY),
+          getreg32(NVIC_IRQ28_31_PRIORITY));
   irqinfo("              %08x %08x %08x %08x\n",
-          getreg32(NVIC_IRQ32_35_PRIORITY), getreg32(NVIC_IRQ36_39_PRIORITY),
-          getreg32(NVIC_IRQ40_43_PRIORITY), getreg32(NVIC_IRQ44_47_PRIORITY));
+          getreg32(NVIC_IRQ32_35_PRIORITY),
+          getreg32(NVIC_IRQ36_39_PRIORITY),
+          getreg32(NVIC_IRQ40_43_PRIORITY),
+          getreg32(NVIC_IRQ44_47_PRIORITY));
   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));
 
   leave_critical_section(flags);
diff --git a/arch/arm/src/nrf52/nrf52_irq.h b/arch/arm/src/nrf52/nrf52_irq.h
index 6cbfe78..96cbfd9 100644
--- a/arch/arm/src/nrf52/nrf52_irq.h
+++ b/arch/arm/src/nrf52/nrf52_irq.h
@@ -43,7 +43,7 @@
 #include <nuttx/config.h>
 
 /****************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ****************************************************************************/
 
 /****************************************************************************
diff --git a/arch/arm/src/nrf52/nrf52_lowputc.c b/arch/arm/src/nrf52/nrf52_lowputc.c
index 212d1ab..fe9e4ec 100644
--- a/arch/arm/src/nrf52/nrf52_lowputc.c
+++ b/arch/arm/src/nrf52/nrf52_lowputc.c
@@ -135,10 +135,10 @@ static void nrf52_setbaud(uintptr_t base, const struct uart_config_s *config)
  * Name: nrf52_lowsetup
  *
  * Description:
- *   Called at the very beginning of _start. Performs low level initialization
- *   including setup of the console UART.  This UART initialization is done
- *   early so that the serial console is available for debugging very early in
- *   the boot sequence.
+ *   Called at the very beginning of _start. Performs low level
+ *   initialization including setup of the console UART.
+ *   This UART initialization is done early so that the serial console is
+ *   available for debugging very early in the boot sequence.
  *
  ****************************************************************************/
 
@@ -163,7 +163,8 @@ void nrf52_lowsetup(void)
  ****************************************************************************/
 
 #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 port   = 0;
diff --git a/arch/arm/src/nrf52/nrf52_lowputc.h b/arch/arm/src/nrf52/nrf52_lowputc.h
index d587c3d..6fe445d 100644
--- a/arch/arm/src/nrf52/nrf52_lowputc.h
+++ b/arch/arm/src/nrf52/nrf52_lowputc.h
@@ -71,7 +71,7 @@ struct uart_config_s
 #endif
 
 /****************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ****************************************************************************/
 
 /****************************************************************************
diff --git a/arch/arm/src/nrf52/nrf52_serial.c b/arch/arm/src/nrf52/nrf52_serial.c
index 92e8802..feddae4 100644
--- a/arch/arm/src/nrf52/nrf52_serial.c
+++ b/arch/arm/src/nrf52/nrf52_serial.c
@@ -329,10 +329,10 @@ static void nrf52_shutdown(struct uart_dev_s *dev)
  * Name: nrf52_attach
  *
  * Description:
- *   Configure the UART to operation in interrupt driven mode.  This method is
- *   called when the serial port is opened.  Normally, this is just after the
- *   the setup() method is called, however, the serial console may operate in
- *   a non-interrupt driven mode during the boot phase.
+ *   Configure the UART to operation in interrupt driven mode.  This method
+ *   is called when the serial port is opened.  Normally, this is just after
+ *   the the setup() method is called, however, the serial console may
+ *   operate in a non-interrupt driven mode during the boot phase.
  *
  *   RX and TX interrupts are not enabled when by the attach method (unless
  *   the hardware supports multiple levels of interrupt enabling).
@@ -364,8 +364,8 @@ static int nrf52_attach(struct uart_dev_s *dev)
  *
  * Description:
  *   Detach UART interrupts.  This method is called when the serial port is
- *   closed normally just before the shutdown method is called.  The exception
- *   is the serial console which is never shutdown.
+ *   closed normally just before the shutdown method is called.
+ *   The exception is the serial console which is never shutdown.
  *
  ****************************************************************************/
 
diff --git a/arch/arm/src/nrf52/nrf52_serial.h b/arch/arm/src/nrf52/nrf52_serial.h
index 90d83c3..e74ef67 100644
--- a/arch/arm/src/nrf52/nrf52_serial.h
+++ b/arch/arm/src/nrf52/nrf52_serial.h
@@ -44,7 +44,7 @@
 #include "nrf52_config.h"
 
 /****************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ****************************************************************************/
 
 /****************************************************************************
diff --git a/arch/arm/src/nrf52/nrf52_spi.c b/arch/arm/src/nrf52/nrf52_spi.c
index 188ad73..6646e9c 100644
--- a/arch/arm/src/nrf52/nrf52_spi.c
+++ b/arch/arm/src/nrf52/nrf52_spi.c
@@ -84,7 +84,9 @@ struct nrf52_spidev_s
   uint32_t         frequency;  /* Requested clock frequency */
   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
   sem_t            sem_isr;    /* Interrupt wait semaphore */
 #endif
diff --git a/arch/arm/src/nrf52/nrf52_spi.h b/arch/arm/src/nrf52/nrf52_spi.h
index c87e7db..07a9ad5 100644
--- a/arch/arm/src/nrf52/nrf52_spi.h
+++ b/arch/arm/src/nrf52/nrf52_spi.h
@@ -46,10 +46,6 @@
 #include "chip.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
 
@@ -84,14 +80,14 @@ FAR struct spi_dev_s *nrf52_spibus_initialize(int port);
  *      pins.
  *   2. Provide nrf52_spi0/1/...select() and nrf52_spi0/1/...status()
  *      functions in your board-specific logic. These functions will perform
- *      chip selection and status operations using GPIOs in the way your board
- *      is configured.
+ *      chip selection and status operations using GPIOs in the way your
+ *      board is configured.
  *   3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file,
  *      then provide nrf52_spi0/1/...cmddata() functions in your
  *      board-specific logic. These functions will perform cmd/data selection
  *      operations using GPIOs in the way your board is configured.
- *   4. Add a calls to nrf52_spibus_initialize() in your low level application
- *      initialization logic
+ *   4. Add a calls to nrf52_spibus_initialize() in your low level
+ *      application initialization logic.
  *   5. The handle returned by nrf52_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
diff --git a/arch/arm/src/nrf52/nrf52_start.c b/arch/arm/src/nrf52/nrf52_start.c
index d95a9a4..db587f1 100644
--- a/arch/arm/src/nrf52/nrf52_start.c
+++ b/arch/arm/src/nrf52/nrf52_start.c
@@ -33,6 +33,10 @@
  *
  ****************************************************************************/
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
 #include <nuttx/config.h>
 
 #include <stdint.h>
diff --git a/arch/arm/src/nrf52/nrf52_utils.c b/arch/arm/src/nrf52/nrf52_utils.c
index 1a23b91..92bcb09 100644
--- a/arch/arm/src/nrf52/nrf52_utils.c
+++ b/arch/arm/src/nrf52/nrf52_utils.c
@@ -55,8 +55,8 @@
  * Name: nrf52_clrpend
  *
  * Description:
- *   Clear a pending interrupt at the NVIC.  This does not seem to be required
- *   for most interrupts.
+ *   Clear a pending interrupt at the NVIC.  This does not seem to be
+ *   required for most interrupts.
  *
  *   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
@@ -76,7 +76,8 @@ void nrf52_clrpend(int irq)
         }
       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);
         }
     }
 }
diff --git a/arch/arm/src/nrf52/nrf52_wdt.h b/arch/arm/src/nrf52/nrf52_wdt.h
index 00afbda..0bfb4bd 100644
--- a/arch/arm/src/nrf52/nrf52_wdt.h
+++ b/arch/arm/src/nrf52/nrf52_wdt.h
@@ -55,7 +55,7 @@ enum wdt_behaviour_e
 };
 
 /****************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ****************************************************************************/
 
 #undef EXTERN