arch: arm: a1x: nxstyle fixes for a1x arch

nxstyle fixes for a1x arch

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2020-04-17 21:21:59 +02:00 committed by Xiang Xiao
parent f706f5e0e8
commit afead9c9da
11 changed files with 113 additions and 80 deletions

View File

@ -45,6 +45,7 @@
/************************************************************************************ /************************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ************************************************************************************/
/* A1X Family */ /* A1X Family */
#if defined(CONFIG_ARCH_CHIP_A10) #if defined(CONFIG_ARCH_CHIP_A10)
@ -62,7 +63,7 @@
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions Prototypes
************************************************************************************/ ************************************************************************************/
#endif /* __ARCH_ARM_INCLUDE_A1X_CHIP_H */ #endif /* __ARCH_ARM_INCLUDE_A1X_CHIP_H */

View File

@ -47,10 +47,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <arch/a1x/chip.h> #include <arch/a1x/chip.h>
/****************************************************************************************
* Pre-processor Definitions
****************************************************************************************/
/* Chip-Specific External interrupts */ /* Chip-Specific External interrupts */
#if defined(CONFIG_ARCH_CHIP_A10) #if defined(CONFIG_ARCH_CHIP_A10)
@ -59,6 +55,10 @@
# error Unrecognized A1X chip # error Unrecognized A1X chip
#endif #endif
/****************************************************************************************
* Pre-processor Definitions
****************************************************************************************/
/**************************************************************************************** /****************************************************************************************
* Public Types * Public Types
****************************************************************************************/ ****************************************************************************************/

View File

@ -59,6 +59,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* The vectors are, by default, positioned at the beginning of the text /* The vectors are, by default, positioned at the beginning of the text
* section. They will always have to be copied to the correct location. * section. They will always have to be copied to the correct location.
* *
@ -247,8 +248,8 @@ static void a1x_copyvectorblock(void)
a1x_vectorpermissions(MMU_L2_VECTRWFLAGS); a1x_vectorpermissions(MMU_L2_VECTRWFLAGS);
#endif #endif
/* Copy the vectors into ISRAM at the address that will be mapped to the vector /* Copy the vectors into ISRAM at the address that will be mapped to the
* address: * vector address:
* *
* A1X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM * A1X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM
* A1X_VECTOR_VSRAM - Virtual address of vector table in SRAM * A1X_VECTOR_VSRAM - Virtual address of vector table in SRAM

View File

@ -1,4 +1,4 @@
/************************************************************************************ /****************************************************************************
* arch/arm/src/a1x/a1x_config.h * arch/arm/src/a1x/a1x_config.h
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013 Gregory Nutt. All rights reserved.
@ -31,25 +31,25 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************************************/ ****************************************************************************/
#ifndef __ARCH_ARM_SRC_A1X_A1X_CONFIG_H #ifndef __ARCH_ARM_SRC_A1X_A1X_CONFIG_H
#define __ARCH_ARM_SRC_A1X_A1X_CONFIG_H #define __ARCH_ARM_SRC_A1X_A1X_CONFIG_H
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "chip.h" #include "chip.h"
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
/* Configuration *********************************************************************/ /* Configuration ************************************************************/
/* Are any UARTs enabled? */ /* Are any UARTs enabled? */
@ -61,8 +61,8 @@
# define HAVE_UART_DEVICE 1 # define HAVE_UART_DEVICE 1
#endif #endif
/* Is there a serial console? There should be at most one defined. It could be on /* Is there a serial console? There should be at most one defined.
* any UARTn, n=0,1,2,3,4,5 * It could be on any UARTn, n=0,1,2,3,4,5
*/ */
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_A1X_UART0) #if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_A1X_UART0)
@ -160,16 +160,16 @@
# undef CONFIG_UART6_FLOWCONTROL # undef CONFIG_UART6_FLOWCONTROL
# undef CONFIG_UART7_FLOWCONTROL # undef CONFIG_UART7_FLOWCONTROL
/************************************************************************************ /****************************************************************************
* Public Types * Public Types
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Public Data * Public Data
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Public Functions * Public Functions Prototypes
************************************************************************************/ ****************************************************************************/
#endif /* __ARCH_ARM_SRC_A1X_A1X_CONFIG_H */ #endif /* __ARCH_ARM_SRC_A1X_A1X_CONFIG_H */

View File

@ -171,7 +171,9 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS #ifndef CONFIG_SUPPRESS_INTERRUPTS
#ifdef CONFIG_A1X_PIO_IRQ #ifdef CONFIG_A1X_PIO_IRQ
/* Initialize logic to support a second level of interrupt decoding for PIO pins. */ /* Initialize logic to support a second level of interrupt decoding
* for PIO pins.
*/
a1x_pio_irqinitialize(); a1x_pio_irqinitialize();
#endif #endif
@ -212,8 +214,8 @@ uint32_t *arm_decodeirq(uint32_t *regs)
uint32_t regval; uint32_t regval;
/* During initialization, the BASE address register was set to zero. /* During initialization, the BASE address register was set to zero.
* Therefore, when we read the VECTOR address register, we get the IRQ number * Therefore, when we read the VECTOR address register, we get the IRQ
* shifted left by two. * number shifted left by two.
*/ */
regval = getreg32(A1X_INTC_VECTOR); regval = getreg32(A1X_INTC_VECTOR);

View File

@ -203,11 +203,12 @@ void up_lowputc(char ch)
#if defined HAVE_UART_DEVICE && defined HAVE_SERIAL_CONSOLE #if defined HAVE_UART_DEVICE && defined HAVE_SERIAL_CONSOLE
/* Wait for the transmitter to be available */ /* Wait for the transmitter to be available */
while ((getreg32(CONSOLE_BASE+A1X_UART_LSR_OFFSET) & UART_LSR_THRE) == 0); while ((getreg32(CONSOLE_BASE + A1X_UART_LSR_OFFSET) &
UART_LSR_THRE) == 0);
/* Send the character */ /* Send the character */
putreg32((uint32_t)ch, CONSOLE_BASE+A1X_UART_THR_OFFSET); putreg32((uint32_t)ch, CONSOLE_BASE + A1X_UART_THR_OFFSET);
#endif #endif
} }
@ -264,28 +265,35 @@ void a1x_lowsetup(void)
/* Clear fifos */ /* Clear fifos */
putreg32(UART_FCR_RFIFOR | UART_FCR_XFIFOR, CONSOLE_BASE + A1X_UART_FCR_OFFSET); putreg32(UART_FCR_RFIFOR | UART_FCR_XFIFOR,
CONSOLE_BASE + A1X_UART_FCR_OFFSET);
/* Set trigger */ /* Set trigger */
putreg32(UART_FCR_FIFOE | UART_FCR_RT_HALF, CONSOLE_BASE + A1X_UART_FCR_OFFSET); putreg32(UART_FCR_FIFOE | UART_FCR_RT_HALF,
CONSOLE_BASE + A1X_UART_FCR_OFFSET);
/* Set up the LCR and set DLAB=1 */ /* Set up the LCR and set DLAB=1 */
putreg32(CONSOLE_LCR_VALUE | UART_LCR_DLAB, CONSOLE_BASE + A1X_UART_LCR_OFFSET); putreg32(CONSOLE_LCR_VALUE | UART_LCR_DLAB,
CONSOLE_BASE + A1X_UART_LCR_OFFSET);
/* Set the BAUD divisor */ /* Set the BAUD divisor */
putreg32(CONSOLE_DL >> 8, CONSOLE_BASE+A1X_UART_DLH_OFFSET); putreg32(CONSOLE_DL >> 8,
putreg32(CONSOLE_DL & 0xff, CONSOLE_BASE+A1X_UART_DLL_OFFSET); CONSOLE_BASE + A1X_UART_DLH_OFFSET);
putreg32(CONSOLE_DL & 0xff,
CONSOLE_BASE + A1X_UART_DLL_OFFSET);
/* Clear DLAB */ /* Clear DLAB */
putreg32(CONSOLE_LCR_VALUE, CONSOLE_BASE+A1X_UART_LCR_OFFSET); putreg32(CONSOLE_LCR_VALUE,
CONSOLE_BASE + A1X_UART_LCR_OFFSET);
/* Configure the FIFOs */ /* Configure the FIFOs */
putreg32(UART_FCR_RT_HALF | UART_FCR_XFIFOR | UART_FCR_RFIFOR | UART_FCR_FIFOE, putreg32(UART_FCR_RT_HALF | UART_FCR_XFIFOR |
UART_FCR_RFIFOR | UART_FCR_FIFOE,
CONSOLE_BASE + A1X_UART_FCR_OFFSET); CONSOLE_BASE + A1X_UART_FCR_OFFSET);
#endif #endif
#endif /* HAVE_UART_DEVICE */ #endif /* HAVE_UART_DEVICE */

View File

@ -70,6 +70,7 @@
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: a1x_pio_pin * Name: a1x_pio_pin
* *
@ -398,13 +399,13 @@ bool a1x_pio_read(pio_pinset_t pinset)
return ((regval & PIO_DAT(pin)) != 0); return ((regval & PIO_DAT(pin)) != 0);
} }
/************************************************************************************ /****************************************************************************
* Name: a1x_pio_irqenable * Name: a1x_pio_irqenable
* *
* Description: * Description:
* Enable the interrupt for specified PIO IRQ * Enable the interrupt for specified PIO IRQ
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_A1X_PIO_IRQ #ifdef CONFIG_A1X_PIO_IRQ
void a1x_pio_irqenable(int irq) void a1x_pio_irqenable(int irq)
@ -419,8 +420,8 @@ void a1x_pio_irqenable(int irq)
pin = irq - A1X_PIO_EINT0 pin = irq - A1X_PIO_EINT0
/* Un-mask the interrupt be setting the corresponding bit in the PIO INT CTL /* Un-mask the interrupt be setting the corresponding bit in the
* register. * PIO INT CTL register.
*/ */
flags = enter_critical_section(); flags = enter_critical_section();
@ -431,13 +432,13 @@ void a1x_pio_irqenable(int irq)
} }
#endif #endif
/************************************************************************************ /****************************************************************************
* Name: a1x_pio_irqdisable * Name: a1x_pio_irqdisable
* *
* Description: * Description:
* Disable the interrupt for specified PIO IRQ * Disable the interrupt for specified PIO IRQ
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_A1X_PIO_IRQ #ifdef CONFIG_A1X_PIO_IRQ
void a1x_pio_irqdisable(int irq) void a1x_pio_irqdisable(int irq)
@ -452,8 +453,8 @@ void a1x_pio_irqdisable(int irq)
pin = irq - A1X_PIO_EINT0 pin = irq - A1X_PIO_EINT0
/* Mask the interrupt be clearning the corresponding bit in the PIO INT CTL /* Mask the interrupt be clearning the corresponding bit in the
* register. * PIO INT CTL register.
*/ */
flags = enter_critical_section(); flags = enter_critical_section();

View File

@ -50,6 +50,7 @@
/************************************************************************************ /************************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ************************************************************************************/
/* Bit-encoded input to a1x_pio_config() ********************************************/ /* Bit-encoded input to a1x_pio_config() ********************************************/
/* 32-bit Encoding: /* 32-bit Encoding:

View File

@ -656,7 +656,8 @@ static inline uint32_t up_serialin(struct up_dev_s *priv, int offset)
* Name: up_serialout * Name: up_serialout
****************************************************************************/ ****************************************************************************/
static inline void up_serialout(struct up_dev_s *priv, int offset, uint32_t value) static inline void up_serialout(struct up_dev_s *priv, int offset,
uint32_t value)
{ {
putreg32(value, priv->uartbase + offset); putreg32(value, priv->uartbase + offset);
} }
@ -706,13 +707,13 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
up_serialout(priv, A1X_UART_LCR_OFFSET, lcr); up_serialout(priv, A1X_UART_LCR_OFFSET, lcr);
} }
/************************************************************************************ /****************************************************************************
* Name: a1x_uart0config, uart1config, uart2config, ..., uart7config * Name: a1x_uart0config, uart1config, uart2config, ..., uart7config
* *
* Description: * Description:
* Configure the UART * Configure the UART
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_A1X_UART0 #ifdef CONFIG_A1X_UART0
static inline void a1x_uart0config(void) static inline void a1x_uart0config(void)
@ -882,7 +883,7 @@ static inline void a1x_uart7config(void)
}; };
#endif #endif
/************************************************************************************ /****************************************************************************
* Name: a1x_uartdl * Name: a1x_uartdl
* *
* Description: * Description:
@ -891,7 +892,7 @@ static inline void a1x_uart7config(void)
* BAUD = PCLK / (16 * DL), or * BAUD = PCLK / (16 * DL), or
* DL = PCLK / BAUD / 16 * DL = PCLK / BAUD / 16
* *
************************************************************************************/ ****************************************************************************/
static inline uint32_t a1x_uartdl(uint32_t baud) static inline uint32_t a1x_uartdl(uint32_t baud)
{ {
@ -920,11 +921,13 @@ static int up_setup(struct uart_dev_s *dev)
/* Clear fifos */ /* Clear fifos */
up_serialout(priv, A1X_UART_FCR_OFFSET, (UART_FCR_RFIFOR | UART_FCR_XFIFOR)); up_serialout(priv, A1X_UART_FCR_OFFSET,
(UART_FCR_RFIFOR | UART_FCR_XFIFOR));
/* Set trigger */ /* Set trigger */
up_serialout(priv, A1X_UART_FCR_OFFSET, (UART_FCR_FIFOE | UART_FCR_RT_HALF)); up_serialout(priv, A1X_UART_FCR_OFFSET,
(UART_FCR_FIFOE | UART_FCR_RT_HALF));
/* Set up the IER */ /* Set up the IER */
@ -1016,14 +1019,16 @@ static void up_shutdown(struct uart_dev_s *dev)
* Name: up_attach * Name: up_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode.
* called when the serial port is opened. Normally, this is just after the * This method is called when the serial port is opened.
* the setup() method is called, however, the serial console may operate in * 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. * a non-interrupt driven mode during the boot phase.
* *
* RX and TX interrupts are not enabled when by the attach method (unless the * RX and TX interrupts are not enabled when by the attach method
* hardware supports multiple levels of interrupt enabling). The RX and TX * (unless the hardware supports multiple levels of interrupt enabling).
* interrupts are not enabled until the txint() and rxint() methods are called. * The RX and TX interrupts are not enabled until the txint() and rxint()
* methods are called.
* *
****************************************************************************/ ****************************************************************************/
@ -1051,8 +1056,9 @@ static int up_attach(struct uart_dev_s *dev)
* Name: up_detach * Name: up_detach
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts.
* closed normally just before the shutdown method is called. The exception is * 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. * the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -1139,11 +1145,16 @@ static int uart_interrupt(int irq, void *context, void *arg)
break; break;
} }
/* Busy detect. Just ignore. Cleared by reading the status register */ /* Busy detect.
* Just ignore.
* Cleared by reading the status register
*/
case UART_IIR_IID_BUSY: case UART_IIR_IID_BUSY:
{ {
/* Read from the UART status register to clear the BUSY condition */ /* Read from the UART status register
* to clear the BUSY condition
*/
status = up_serialin(priv, A1X_UART_USR_OFFSET); status = up_serialin(priv, A1X_UART_USR_OFFSET);
break; break;
@ -1156,7 +1167,9 @@ static int uart_interrupt(int irq, void *context, void *arg)
return OK; return OK;
} }
/* Otherwise we have received an interrupt that we cannot handle */ /* Otherwise we have received an interrupt
* that we cannot handle
*/
default: default:
{ {
@ -1266,7 +1279,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
*/ */
/* DLAB open latch */ /* DLAB open latch */
/* REVISIT: Shouldn't we just call up_setup() to do all of the following? */
/* REVISIT:
* Shouldn't we just call up_setup() to do all of the following?
*/
lcr = getreg32(priv->uartbase + A1X_UART_LCR_OFFSET); lcr = getreg32(priv->uartbase + A1X_UART_LCR_OFFSET);
up_serialout(priv, A1X_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB)); up_serialout(priv, A1X_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));

View File

@ -1,4 +1,4 @@
/************************************************************************************ /****************************************************************************
* arch/arm/src/a1x/a1x_serial.h * arch/arm/src/a1x/a1x_serial.h
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013 Gregory Nutt. All rights reserved.
@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************************************/ ****************************************************************************/
#ifndef __ARCH_ARM_SRC_A1X_A1X_SERIAL_H #ifndef __ARCH_ARM_SRC_A1X_A1X_SERIAL_H
#define __ARCH_ARM_SRC_A1X_A1X_SERIAL_H #define __ARCH_ARM_SRC_A1X_A1X_SERIAL_H
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <arch/board/board.h> #include <arch/board/board.h>
@ -48,32 +48,34 @@
#include "a1x_config.h" #include "a1x_config.h"
#include "a1x_pio.h" #include "a1x_pio.h"
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
/* Configuration *********************************************************************/
/* We cannot allow the DLM/DLL divisor to become to small or will will lose too /* Configuration ************************************************************/
* much accuracy. This following is a "fudge factor" that represents the minimum
/* We cannot allow the DLM/DLL divisor to become to small or will will lose
* too much accuracy.
* This following is a "fudge factor" that represents the minimum
* value of the divisor that we will permit. * value of the divisor that we will permit.
*/ */
#define UART_MINDL 32 #define UART_MINDL 32
/************************************************************************************ /****************************************************************************
* Public Types * Public Types
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Public Data * Public Data
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Inline Functions * Inline Functions
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Public Functions * Public Functions Prototypes
************************************************************************************/ ****************************************************************************/
#endif /* __ARCH_ARM_SRC_A1X_A1X_SERIAL_H */ #endif /* __ARCH_ARM_SRC_A1X_A1X_SERIAL_H */

View File

@ -54,6 +54,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Timer 0 will run at the rate of OSC24M with no division */ /* Timer 0 will run at the rate of OSC24M with no division */
#define TMR0_CLOCK (24000000) #define TMR0_CLOCK (24000000)