diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-16 20:05:51 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-16 20:05:51 +0000 |
commit | 891f61e86fcc0a4c42f25432016762b6aafb287e (patch) | |
tree | f0447a687a6bc51494a5c24c81170ca3811b0c7f /nuttx/arch/arm/src/imx | |
parent | c33cfd52449fc6c1b9211cb45618a77b544876e6 (diff) | |
download | px4-nuttx-891f61e86fcc0a4c42f25432016762b6aafb287e.tar.gz px4-nuttx-891f61e86fcc0a4c42f25432016762b6aafb287e.tar.bz2 px4-nuttx-891f61e86fcc0a4c42f25432016762b6aafb287e.zip |
Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2359 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/imx')
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_allocateheap.c | 8 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_boot.c | 36 | ||||
-rwxr-xr-x | nuttx/arch/arm/src/imx/imx_cspi.h | 8 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_decodeirq.c | 11 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_gpio.c | 3 | ||||
-rwxr-xr-x | nuttx/arch/arm/src/imx/imx_gpio.h | 97 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_irq.c | 7 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_serial.c | 118 | ||||
-rwxr-xr-x | nuttx/arch/arm/src/imx/imx_spi.c | 114 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_timerisr.c | 11 |
10 files changed, 213 insertions, 200 deletions
diff --git a/nuttx/arch/arm/src/imx/imx_allocateheap.c b/nuttx/arch/arm/src/imx/imx_allocateheap.c index 84f2b7b5a..fcf0117ff 100644 --- a/nuttx/arch/arm/src/imx/imx_allocateheap.c +++ b/nuttx/arch/arm/src/imx/imx_allocateheap.c @@ -39,7 +39,9 @@ ****************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdint.h> #include <debug.h> #include <nuttx/mm.h> #include <nuttx/arch.h> @@ -48,7 +50,7 @@ #include "up_internal.h" /**************************************************************************** - * Private Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -98,8 +100,8 @@ void up_addregion(void) #if !defined(CONFIG_BOOT_RUNFROMFLASH) && !defined(CONFIG_BOOT_COPYTORAM) # if (CONFIG_DRAM_NUTTXENTRY & 0xffff0000) != CONFIG_DRAM_VSTART - uint32 start = CONFIG_DRAM_VSTART + 0x1000; - uint32 end = (CONFIG_DRAM_NUTTXENTRY & 0xffff0000); + uint32_t start = CONFIG_DRAM_VSTART + 0x1000; + uint32_t end = (CONFIG_DRAM_NUTTXENTRY & 0xffff0000); mm_addregion((FAR void*)start, end - start); # endif #endif diff --git a/nuttx/arch/arm/src/imx/imx_boot.c b/nuttx/arch/arm/src/imx/imx_boot.c index a463dcf34..4979d7760 100644 --- a/nuttx/arch/arm/src/imx/imx_boot.c +++ b/nuttx/arch/arm/src/imx/imx_boot.c @@ -15,7 +15,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -39,13 +39,13 @@ ************************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include "up_internal.h" #include "up_arch.h" /************************************************************************************ - * Private Types + * Pre-processor Definitions ************************************************************************************/ /************************************************************************************ @@ -54,18 +54,18 @@ struct section_mapping_s { - uint32 physbase; /* Physical address of the region to be mapped */ - uint32 virtbase; /* Virtual address of the region to be mapped */ - uint32 mmuflags; /* MMU settings for the region (e.g., cache-able) */ - uint32 nsections; /* Number of mappings in the region */ + uint32_t physbase; /* Physical address of the region to be mapped */ + uint32_t virtbase; /* Virtual address of the region to be mapped */ + uint32_t mmuflags; /* MMU settings for the region (e.g., cache-able) */ + uint32_t nsections; /* Number of mappings in the region */ }; /************************************************************************************ * Public Variables ************************************************************************************/ -extern uint32 _vector_start; /* Beginning of vector block */ -extern uint32 _vector_end; /* End+1 of vector block */ +extern uint32_t _vector_start; /* Beginning of vector block */ +extern uint32_t _vector_end; /* End+1 of vector block */ /************************************************************************************ * Private Variables @@ -114,10 +114,10 @@ extern void imx_boardinitialize(void); * Name: up_setlevel1entry ************************************************************************************/ -static inline void up_setlevel1entry(uint32 paddr, uint32 vaddr, uint32 mmuflags) +static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags) { - uint32 *pgtable = (uint32*)PGTABLE_VBASE; - uint32 index = vaddr >> 20; + uint32_t *pgtable = (uint32_t*)PGTABLE_VBASE; + uint32_t index = vaddr >> 20; /* Save the page table entry */ @@ -134,9 +134,9 @@ static void up_setupmappings(void) for (i = 0; i < NMAPPINGS; i++) { - uint32 sect_paddr = section_mapping[i].physbase; - uint32 sect_vaddr = section_mapping[i].virtbase; - uint32 mmuflags = section_mapping[i].mmuflags; + uint32_t sect_paddr = section_mapping[i].physbase; + uint32_t sect_vaddr = section_mapping[i].virtbase; + uint32_t mmuflags = section_mapping[i].mmuflags; for (j = 0; j < section_mapping[i].nsections; j++) { @@ -178,9 +178,9 @@ static void up_copyvectorblock(void) */ #if !defined(CONFIG_BOOT_RUNFROMFLASH) && !defined(CONFIG_BOOT_COPYTORAM) - uint32 *src = (uint32*)&_vector_start; - uint32 *end = (uint32*)&_vector_end; - uint32 *dest = (uint32*)VECTOR_BASE; + uint32_t *src = (uint32_t*)&_vector_start; + uint32_t *end = (uint32_t*)&_vector_end; + uint32_t *dest = (uint32_t*)VECTOR_BASE; while (src < end) { diff --git a/nuttx/arch/arm/src/imx/imx_cspi.h b/nuttx/arch/arm/src/imx/imx_cspi.h index 71f9ad7cc..e0d97f2d4 100755 --- a/nuttx/arch/arm/src/imx/imx_cspi.h +++ b/nuttx/arch/arm/src/imx/imx_cspi.h @@ -41,11 +41,13 @@ ************************************************************************************/ #ifndef __ASSEMBLY__ +# include <stdint.h> +# include <stdbool.h> # include <nuttx/spi.h> #endif /************************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************************/ /* CSPI Register Offsets ************************************************************/ @@ -189,8 +191,8 @@ extern "C" { * for example, will bind the SPI driver to the SPI MMC/SD driver). */ -EXTERN void imx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected); -EXTERN ubyte imx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +EXTERN void imx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +EXTERN uint8_t imx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #undef EXTERN #ifdef __cplusplus diff --git a/nuttx/arch/arm/src/imx/imx_decodeirq.c b/nuttx/arch/arm/src/imx/imx_decodeirq.c index 7d2ba81dd..4657d18da 100644 --- a/nuttx/arch/arm/src/imx/imx_decodeirq.c +++ b/nuttx/arch/arm/src/imx/imx_decodeirq.c @@ -39,7 +39,8 @@ ********************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> + +#include <stdint.h> #include <nuttx/irq.h> #include <nuttx/arch.h> #include <assert.h> @@ -50,7 +51,7 @@ #include "up_internal.h" /******************************************************************************** - * Definitions + * Pre-processor Definitions ********************************************************************************/ /******************************************************************************** @@ -69,15 +70,15 @@ * Public Funtions ********************************************************************************/ -void up_decodeirq(uint32* regs) +void up_decodeirq(uint32_t* regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS lib_lowprintf("Unexpected IRQ\n"); current_regs = regs; PANIC(OSERR_ERREXCEPTION); #else - uint32 regval; - int irq; + uint32_t regval; + int irq; /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context switches. diff --git a/nuttx/arch/arm/src/imx/imx_gpio.c b/nuttx/arch/arm/src/imx/imx_gpio.c index 65d1b3d10..9ca86e120 100644 --- a/nuttx/arch/arm/src/imx/imx_gpio.c +++ b/nuttx/arch/arm/src/imx/imx_gpio.c @@ -39,13 +39,12 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> #include "up_arch.h" #include "imx_gpio.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/nuttx/arch/arm/src/imx/imx_gpio.h b/nuttx/arch/arm/src/imx/imx_gpio.h index e8da7c46f..26c1c4346 100755 --- a/nuttx/arch/arm/src/imx/imx_gpio.h +++ b/nuttx/arch/arm/src/imx/imx_gpio.h @@ -41,10 +41,13 @@ * Included Files
************************************************************************************/
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
#include "up_arch.h" /* getreg32(), putreg32() */
/************************************************************************************
- * Definitions
+ * Pre-processor Definitions
************************************************************************************/
/* GPIO Register Offsets ************************************************************/
@@ -197,14 +200,14 @@ static inline void imxgpio_dirout(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_DDIR(port));
+ uint32_t regval = getreg32(IMX_GPIO_DDIR(port));
regval |= (1 << bit);
putreg32(regval, IMX_GPIO_DDIR(port));
}
static inline void imxgpio_dirin(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_DDIR(port));
+ uint32_t regval = getreg32(IMX_GPIO_DDIR(port));
regval &= ~(1 << bit);
putreg32(regval, IMX_GPIO_DDIR(port));
}
@@ -213,9 +216,9 @@ static inline void imxgpio_dirin(int port, int bit) static inline void imxgpio_ocrain(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -235,9 +238,9 @@ static inline void imxgpio_ocrain(int port, int bit) static inline void imxgpio_ocrbin(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -258,9 +261,9 @@ static inline void imxgpio_ocrbin(int port, int bit) static inline void imxgpio_ocrcin(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -281,9 +284,9 @@ static inline void imxgpio_ocrcin(int port, int bit) static inline void imxgpio_ocrodrin(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -305,9 +308,9 @@ static inline void imxgpio_ocrodrin(int port, int bit) static inline void imxgpio_aoutgpio(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -327,9 +330,9 @@ static inline void imxgpio_aoutgpio(int port, int bit) static inline void imxgpio_aoutisr(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -350,9 +353,9 @@ static inline void imxgpio_aoutisr(int port, int bit) static inline void imxgpio_aout0(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -373,9 +376,9 @@ static inline void imxgpio_aout0(int port, int bit) static inline void imxgpio_aout1(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -395,9 +398,9 @@ static inline void imxgpio_aout1(int port, int bit) static inline void imxgpio_boutgpio(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -417,9 +420,9 @@ static inline void imxgpio_boutgpio(int port, int bit) static inline void imxgpio_boutisr(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -440,9 +443,9 @@ static inline void imxgpio_boutisr(int port, int bit) static inline void imxgpio_bout0(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -463,9 +466,9 @@ static inline void imxgpio_bout0(int port, int bit) static inline void imxgpio_bout1(int port, int bit)
{
- uint32 regval;
- uint32 regaddr;
- int shift;
+ uint32_t regval;
+ uint32_t regaddr;
+ int shift;
if (bit < 16)
{
@@ -490,28 +493,28 @@ static inline void imxgpio_bout1(int port, int bit) static inline void imxgpio_gpiofunc(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_GIUS(port));
+ uint32_t regval = getreg32(IMX_GPIO_GIUS(port));
regval |= (1 << bit);
putreg32(regval, IMX_GPIO_GIUS(port));
}
static inline void imxgpio_peripheralfunc(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_GIUS(port));
+ uint32_t regval = getreg32(IMX_GPIO_GIUS(port));
regval &= ~(1 << bit);
putreg32(regval, IMX_GPIO_GIUS(port));
}
static inline void imxgpio_altperipheralfunc(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_GPR(port));
+ uint32_t regval = getreg32(IMX_GPIO_GPR(port));
regval |= (1 << bit);
putreg32(regval, IMX_GPIO_GPR(port));
}
static inline void imxgpio_primaryperipheralfunc(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_GPR(port));
+ uint32_t regval = getreg32(IMX_GPIO_GPR(port));
regval &= ~(1 << bit);
putreg32(regval, IMX_GPIO_GPR(port));
}
@@ -520,28 +523,28 @@ static inline void imxgpio_primaryperipheralfunc(int port, int bit) static inline void imxgpio_pullupenable(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_PUEN(port));
+ uint32_t regval = getreg32(IMX_GPIO_PUEN(port));
regval |= (1 << bit);
putreg32(regval, IMX_GPIO_PUEN(port));
}
static inline void imxgpio_pullupdisable(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_PUEN(port));
+ uint32_t regval = getreg32(IMX_GPIO_PUEN(port));
regval &= ~(1 << bit);
putreg32(regval, IMX_GPIO_PUEN(port));
}
static inline void imxgpio_setoutput(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_DR(port));
+ uint32_t regval = getreg32(IMX_GPIO_DR(port));
regval |= (1 << bit);
putreg32(regval, IMX_GPIO_DR(port));
}
static inline void imxgpio_clroutput(int port, int bit)
{
- uint32 regval = getreg32(IMX_GPIO_DR(port));
+ uint32_t regval = getreg32(IMX_GPIO_DR(port));
regval &= ~(1 << bit);
putreg32(regval, IMX_GPIO_DR(port));
}
diff --git a/nuttx/arch/arm/src/imx/imx_irq.c b/nuttx/arch/arm/src/imx/imx_irq.c index 2e53db08e..2793438ed 100644 --- a/nuttx/arch/arm/src/imx/imx_irq.c +++ b/nuttx/arch/arm/src/imx/imx_irq.c @@ -39,7 +39,8 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> + +#include <stdint.h> #include <nuttx/irq.h> #include "up_arch.h" @@ -47,14 +48,14 @@ #include "up_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** * Public Data ****************************************************************************/ -uint32 *current_regs; +uint32_t *current_regs; /**************************************************************************** * Private Data diff --git a/nuttx/arch/arm/src/imx/imx_serial.c b/nuttx/arch/arm/src/imx/imx_serial.c index 70dcb5f1c..5a03a70bb 100644 --- a/nuttx/arch/arm/src/imx/imx_serial.c +++ b/nuttx/arch/arm/src/imx/imx_serial.c @@ -41,6 +41,8 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> #include <unistd.h> #include <semaphore.h> #include <string.h> @@ -60,7 +62,7 @@ #ifdef CONFIG_USE_SERIALDRIVER /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ @@ -77,46 +79,46 @@ struct up_dev_s { - uint32 uartbase; /* Base address of UART registers */ - uint32 baud; /* Configured baud */ - uint32 ucr1; /* Saved UCR1 value */ + uint32_t uartbase; /* Base address of UART registers */ + uint32_t baud; /* Configured baud */ + uint32_t ucr1; /* Saved UCR1 value */ #if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL) - ubyte rxirq; /* Rx IRQ associated with this UART */ - ubyte txirq; /* Tx IRQ associated with this UART */ + uint8_t rxirq; /* Rx IRQ associated with this UART */ + uint8_t txirq; /* Tx IRQ associated with this UART */ #else - ubyte irq; /* IRQ associated with this UART */ + uint8_t irq; /* IRQ associated with this UART */ #endif - ubyte parity; /* 0=none, 1=odd, 2=even */ - ubyte bits; /* Number of bits (7 or 8) */ - ubyte stopbits2:1; /* 1: Configure with 2 stop bits vs 1 */ - ubyte hwfc:1; /* 1: Hardware flow control */ - ubyte reserved:6; + uint8_t parity; /* 0=none, 1=odd, 2=even */ + uint8_t bits; /* Number of bits (7 or 8) */ + uint8_t stopbits2:1; /* 1: Configure with 2 stop bits vs 1 */ + uint8_t hwfc:1; /* 1: Hardware flow control */ + uint8_t reserved:6; }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset); -static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 value); -static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1); -static inline void up_restoreuartint(struct up_dev_s *priv, uint32 ucr1); +static inline uint32_t up_serialin(struct up_dev_s *priv, uint32_t offset); +static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint32_t value); +static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ucr1); +static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ucr1); static inline void up_waittxready(struct up_dev_s *priv); -static int up_setup(struct uart_dev_s *dev); -static void up_shutdown(struct uart_dev_s *dev); -static int up_attach(struct uart_dev_s *dev); -static void up_detach(struct uart_dev_s *dev); +static int up_setup(struct uart_dev_s *dev); +static void up_shutdown(struct uart_dev_s *dev); +static int up_attach(struct uart_dev_s *dev); +static void up_detach(struct uart_dev_s *dev); static inline struct uart_dev_s *up_mapirq(int irq); -static int up_interrupt(int irq, void *context); -static int up_ioctl(struct file *filep, int cmd, unsigned long arg); -static int up_receive(struct uart_dev_s *dev, uint32 *status); -static void up_rxint(struct uart_dev_s *dev, boolean enable); -static boolean up_rxavailable(struct uart_dev_s *dev); -static void up_send(struct uart_dev_s *dev, int ch); -static void up_txint(struct uart_dev_s *dev, boolean enable); -static boolean up_txready(struct uart_dev_s *dev); -static boolean up_txempty(struct uart_dev_s *dev); +static int up_interrupt(int irq, void *context); +static int up_ioctl(struct file *filep, int cmd, unsigned long arg); +static int up_receive(struct uart_dev_s *dev, uint32_t *status); +static void up_rxint(struct uart_dev_s *dev, bool enable); +static bool up_rxavailable(struct uart_dev_s *dev); +static void up_send(struct uart_dev_s *dev, int ch); +static void up_txint(struct uart_dev_s *dev, bool enable); +static bool up_txready(struct uart_dev_s *dev); +static bool up_txempty(struct uart_dev_s *dev); /**************************************************************************** * Private Variables @@ -372,7 +374,7 @@ static uart_dev_t g_uart3port = * Name: up_serialin ****************************************************************************/ -static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset) +static inline uint32_t up_serialin(struct up_dev_s *priv, uint32_t offset) { return getreg32(priv->uartbase + offset); } @@ -381,7 +383,7 @@ static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset) * Name: up_serialout ****************************************************************************/ -static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 value) +static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint32_t value) { putreg32(value, priv->uartbase + offset); } @@ -390,7 +392,7 @@ static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 val * Name: up_disableuartint ****************************************************************************/ -static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1) +static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ucr1) { /* Return the current Rx and Tx interrupt state */ @@ -409,7 +411,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1) * Name: up_restoreuartint ****************************************************************************/ -static inline void up_restoreuartint(struct up_dev_s *priv, uint32 ucr1) +static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ucr1) { /* Enable/disable any interrupts that are currently disabled but should be * enabled/disabled. @@ -451,11 +453,11 @@ static int up_setup(struct uart_dev_s *dev) { #ifndef CONFIG_SUPPRESS_UART_CONFIG struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - uint32 regval; - uint32 ucr2; - uint32 div; - uint32 num; - uint32 den; + uint32_t regval; + uint32_t ucr2; + uint32_t div; + uint32_t num; + uint32_t den; /* Disable the UART */ @@ -564,7 +566,7 @@ static int up_setup(struct uart_dev_s *dev) { /* b16 is a scale such that b16*num = 0x10000 * 2**16 */ - uint32 b16 = 0x100000000LL / num; + uint32_t b16 = 0x100000000LL / num; num = 0x00010000; den = (b16 * den) >> 16; } @@ -575,7 +577,7 @@ static int up_setup(struct uart_dev_s *dev) { /* b16 is a scale such that b16*den = 0x10000 * 2**16 */ - uint32 b16 = 0x100000000LL / den; + uint32_t b16 = 0x100000000LL / den; num = (b16 * num) >> 16; den = 0x00010000; } @@ -818,7 +820,7 @@ static int up_interrupt(int irq, void *context) { struct uart_dev_s *dev; struct up_dev_s *priv; - uint32 usr1; + uint32_t usr1; int passes = 0; dev = up_mapirq(irq); @@ -915,10 +917,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) * ****************************************************************************/ -static int up_receive(struct uart_dev_s *dev, uint32 *status) +static int up_receive(struct uart_dev_s *dev, uint32_t *status) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - uint32 rxd0; + uint32_t rxd0; rxd0 = up_serialin(priv, UART_RXD0); *status = rxd0; @@ -933,7 +935,7 @@ static int up_receive(struct uart_dev_s *dev, uint32 *status) * ****************************************************************************/ -static void up_rxint(struct uart_dev_s *dev, boolean enable) +static void up_rxint(struct uart_dev_s *dev, bool enable) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; @@ -956,11 +958,11 @@ static void up_rxint(struct uart_dev_s *dev, boolean enable) * Name: up_rxavailable * * Description: - * Return TRUE if the receive fifo is not empty + * Return true if the receive fifo is not empty * ****************************************************************************/ -static boolean up_rxavailable(struct uart_dev_s *dev) +static bool up_rxavailable(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; @@ -980,7 +982,7 @@ static boolean up_rxavailable(struct uart_dev_s *dev) static void up_send(struct uart_dev_s *dev, int ch) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - up_serialout(priv, UART_TXD0, (uint32)ch); + up_serialout(priv, UART_TXD0, (uint32_t)ch); } /**************************************************************************** @@ -991,7 +993,7 @@ static void up_send(struct uart_dev_s *dev, int ch) * ****************************************************************************/ -static void up_txint(struct uart_dev_s *dev, boolean enable) +static void up_txint(struct uart_dev_s *dev, bool enable) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; @@ -1016,11 +1018,11 @@ static void up_txint(struct uart_dev_s *dev, boolean enable) * Name: up_txready * * Description: - * Return TRUE if the tranmsit fifo is not full + * Return true if the tranmsit fifo is not full * ****************************************************************************/ -static boolean up_txready(struct uart_dev_s *dev) +static bool up_txready(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; @@ -1033,11 +1035,11 @@ static boolean up_txready(struct uart_dev_s *dev) * Name: up_txempty * * Description: - * Return TRUE if the transmit fifo is empty + * Return true if the transmit fifo is empty * ****************************************************************************/ -static boolean up_txempty(struct uart_dev_s *dev) +static bool up_txempty(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; @@ -1113,7 +1115,7 @@ void up_earlyserialinit(void) */ #ifdef CONSOLE_DEV - CONSOLE_DEV.isconsole = TRUE; + CONSOLE_DEV.isconsole = true; up_setup(&CONSOLE_DEV); #endif } @@ -1156,7 +1158,7 @@ void up_serialinit(void) int up_putc(int ch) { struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv; - uint32 ier; + uint32_t ier; up_disableuartint(priv, &ier); up_waittxready(priv); @@ -1167,11 +1169,11 @@ int up_putc(int ch) { /* Add CR */ - up_serialout(priv, UART_TXD0, (uint32)'\r'); + up_serialout(priv, UART_TXD0, (uint32_t)'\r'); up_waittxready(priv); } - up_serialout(priv, UART_TXD0, (uint32)ch); + up_serialout(priv, UART_TXD0, (uint32_t)ch); up_waittxready(priv); up_restoreuartint(priv, ier); return ch; @@ -1227,11 +1229,11 @@ int up_putc(int ch) { /* Add CR */ - putreg32((uint16)'\r', IMX_REGISTER_BASE + UART_TXD0); + putreg32((uint16_t)'\r', IMX_REGISTER_BASE + UART_TXD0); up_waittxready(); } - putreg32((uint16)ch, IMX_REGISTER_BASE + UART_TXD0); + putreg32((uint16_t)ch, IMX_REGISTER_BASE + UART_TXD0); return ch; } diff --git a/nuttx/arch/arm/src/imx/imx_spi.c b/nuttx/arch/arm/src/imx/imx_spi.c index 46cfb6913..5f065f886 100755 --- a/nuttx/arch/arm/src/imx/imx_spi.c +++ b/nuttx/arch/arm/src/imx/imx_spi.c @@ -38,7 +38,9 @@ ****************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdint.h> #include <errno.h> #include <debug.h> @@ -56,7 +58,7 @@ #include "imx_cspi.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /* The i.MX1/L supports 2 SPI interfaces. Which have been enabled? */ @@ -101,8 +103,8 @@ struct imx_spidev_s /* These following are the source and destination buffers of the transfer. * they are retained in this structure so that they will be accessible - * from an interrupt handler. The actual type of the buffer is ubyte is - * nbits <=8 and uint16 is nbits >8. + * from an interrupt handler. The actual type of the buffer is uint8_t is + * nbits <=8 and uint16_t is nbits >8. */ void *txbuffer; /* Source buffer */ @@ -118,18 +120,18 @@ struct imx_spidev_s void (*txword)(struct imx_spidev_s *priv); void (*rxword)(struct imx_spidev_s *priv); - uint32 base; /* SPI register base address */ - uint32 frequency; /* Current desired SCLK frequency */ - uint32 actual; /* Current actual SCLK frequency */ + uint32_t base; /* SPI register base address */ + uint32_t frequency; /* Current desired SCLK frequency */ + uint32_t actual; /* Current actual SCLK frequency */ int ntxwords; /* Number of words left to transfer on the Tx FIFO */ int nrxwords; /* Number of words received on the Rx FIFO */ int nwords; /* Number of words to be exchanged */ - ubyte mode; /* Current mode */ - ubyte nbits; /* Current number of bits per word */ + uint8_t mode; /* Current mode */ + uint8_t nbits; /* Current number of bits per word */ #ifndef CONFIG_SPI_POLLWAIT - ubyte irq; /* SPI IRQ number */ + uint8_t irq; /* SPI IRQ number */ #endif }; @@ -139,17 +141,17 @@ struct imx_spidev_s /* SPI register access */ -static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset); -static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32 value); +static inline uint32_t spi_getreg(struct imx_spidev_s *priv, unsigned int offset); +static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32_t value); /* SPI data transfer */ static void spi_txnull(struct imx_spidev_s *priv); static void spi_txuint16(struct imx_spidev_s *priv); -static void spi_txubyte(struct imx_spidev_s *priv); +static void spi_txuint8(struct imx_spidev_s *priv); static void spi_rxnull(struct imx_spidev_s *priv); -static void spi_rxuint16(struct imx_spidev_s *priv); -static void spi_rxubyte(struct imx_spidev_s *priv); +static void spi_rxuint16(struct imx_spidev_s *priv); +static void spi_rxuint8(struct imx_spidev_s *priv); static int spi_performtx(struct imx_spidev_s *priv); static inline void spi_performrx(struct imx_spidev_s *priv); static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, @@ -164,10 +166,10 @@ static int spi_interrupt(int irq, void *context); /* SPI methods */ -static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency); +static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); static void spi_setbits(FAR struct spi_dev_s *dev, int nbits); -static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd); +static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd); #ifdef CONFIG_SPI_EXCHANGE static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords); @@ -246,7 +248,7 @@ static struct imx_spidev_s g_spidev[] = * ****************************************************************************/ -static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset) +static inline uint32_t spi_getreg(struct imx_spidev_s *priv, unsigned int offset) { return getreg32(priv->base + offset); } @@ -267,16 +269,16 @@ static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset) * ****************************************************************************/ -static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32 value) +static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32_t value) { putreg32(value, priv->base + offset); } /**************************************************************************** - * Name: spi_txnull, spi_txuint16, and spi_txubyte + * Name: spi_txnull, spi_txuint16, and spi_txuint8 * * Description: - * Transfer all ones, a ubyte, or uint16 to Tx FIFO and update the txbuffer + * Transfer all ones, a uint8_t, or uint16_t to Tx FIFO and update the txbuffer * pointer appropriately. The selected function dependes on (1) if there * is a source txbuffer provided, and (2) if the number of bits per * word is <=8 or >8. @@ -296,23 +298,23 @@ static void spi_txnull(struct imx_spidev_s *priv) static void spi_txuint16(struct imx_spidev_s *priv) { - uint16 *ptr = (uint16*)priv->txbuffer; + uint16_t *ptr = (uint16_t*)priv->txbuffer; spi_putreg(priv, CSPI_TXD_OFFSET, *ptr++); priv->txbuffer = (void*)ptr; } -static void spi_txubyte(struct imx_spidev_s *priv) +static void spi_txuint8(struct imx_spidev_s *priv) { - ubyte *ptr = (ubyte*)priv->txbuffer; + uint8_t *ptr = (uint8_t*)priv->txbuffer; spi_putreg(priv, CSPI_TXD_OFFSET, *ptr++); priv->txbuffer = (void*)ptr; } /**************************************************************************** - * Name: spi_rxnull, spi_rxuint16, and spi_rxubyte + * Name: spi_rxnull,spi_rxuint16, and spi_rxuint8 * * Description: - * Discard input, save a ubyte, or or save a uint16 from Tx FIFO in the + * Discard input, save a uint8_t, or or save a uint16_t from Tx FIFO in the * user rxvbuffer and update the rxbuffer pointer appropriately. The * selected function dependes on (1) if there is a desination rxbuffer * provided, and (2) if the number of bits per word is <=8 or >8. @@ -330,17 +332,17 @@ static void spi_rxnull(struct imx_spidev_s *priv) (void)spi_getreg(priv, CSPI_RXD_OFFSET); } -static void spi_rxuint16(struct imx_spidev_s *priv) +static voidspi_rxuint16(struct imx_spidev_s *priv) { - uint16 *ptr = (uint16*)priv->rxbuffer; - *ptr++ = (uint16)spi_getreg(priv, CSPI_TXD_OFFSET); + uint16_t *ptr = (uint16_t*)priv->rxbuffer; + *ptr++ = (uint16_t)spi_getreg(priv, CSPI_TXD_OFFSET); priv->rxbuffer = (void*)ptr; } -static void spi_rxubyte(struct imx_spidev_s *priv) +static void spi_rxuint8(struct imx_spidev_s *priv) { - ubyte *ptr = (ubyte*)priv->rxbuffer; - *ptr++ = (ubyte)spi_getreg(priv, CSPI_TXD_OFFSET); + uint8_t *ptr = (uint8_t*)priv->rxbuffer; + *ptr++ = (uint8_t)spi_getreg(priv, CSPI_TXD_OFFSET); priv->rxbuffer = (void*)ptr; } @@ -362,7 +364,7 @@ static void spi_rxubyte(struct imx_spidev_s *priv) static int spi_performtx(struct imx_spidev_s *priv) { - uint32 regval; + uint32_t regval; int ntxd = 0; /* Number of words written to Tx FIFO */ /* Check if the Tx FIFO is empty */ @@ -448,7 +450,7 @@ static inline void spi_performrx(struct imx_spidev_s *priv) static void spi_startxfr(struct imx_spidev_s *priv, int ntxd) { - uint32 regval; + uint32_t regval; /* The XCH bit initiates an exchange in master mode. It remains set * remains set while the exchange is in progress but is automatically @@ -476,9 +478,9 @@ static void spi_startxfr(struct imx_spidev_s *priv, int ntxd) * txbuffer - The buffer of data to send to the device (may be NULL). * rxbuffer - The buffer to receive data from the device (may be NULL). * nwords - The total number of words to be exchanged. If the interface - * uses <= 8 bits per word, then this is the number of ubytes; + * uses <= 8 bits per word, then this is the number of uint8_t's; * if the interface uses >8 bits per word, then this is the - * number of uint16's + * number of uint16_t's * * Returned Value: * 0: success, <0:Negated error number on failure @@ -491,14 +493,14 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, #ifndef CONFIG_SPI_POLLWAIT irqstate_t flags; #endif - uint32 regval; + uint32_t regval; int ntxd; int ret; /* Set up to perform the transfer */ - priv->txbuffer = (ubyte*)txbuffer; /* Source buffer */ - priv->rxbuffer = (ubyte*)rxbuffer; /* Destination buffer */ + priv->txbuffer = (uint8_t*)txbuffer; /* Source buffer */ + priv->rxbuffer = (uint8_t*)rxbuffer; /* Destination buffer */ priv->ntxwords = nwords; /* Number of words left to send */ priv->nrxwords = 0; /* Number of words received */ priv->nwords = nwords; /* Total number of exchanges */ @@ -508,12 +510,12 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, if (priv->nbits > 8) { priv->txword = spi_txuint16; - priv->rxword = spi_rxuint16; + priv->rxword =spi_rxuint16; } else { - priv->txword = spi_txubyte; - priv->rxword = spi_rxubyte; + priv->txword = spi_txuint8; + priv->rxword = spi_rxuint8; } if (!txbuffer) @@ -629,9 +631,9 @@ static inline struct imx_spidev_s *spi_mapirq(int irq) * txbuffer - The buffer of data to send to the device (may be NULL). * rxbuffer - The buffer to receive data from the device (may be NULL). * nwords - The total number of words to be exchanged. If the interface - * uses <= 8 bits per word, then this is the number of ubytes; + * uses <= 8 bits per word, then this is the number of uint8_t's; * if the interface uses >8 bits per word, then this is the - * number of uint16's + * number of uint16_t's * * Returned Value: * 0: success, <0:Negated error number on failure @@ -685,15 +687,15 @@ static int spi_interrupt(int irq, void *context) * ****************************************************************************/ -static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency) +static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) { struct imx_spidev_s *priv = (struct imx_spidev_s *)dev; - uint32 actual = priv->actual; + uint32_t actual = priv->actual; if (priv && frequency != priv->frequency) { - uint32 freqbits; - uint32 regval; + uint32_t freqbits; + uint32_t regval; if (frequency >= IMX_PERCLK2_FREQ / 4) { @@ -770,8 +772,8 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) struct imx_spidev_s *priv = (struct imx_spidev_s *)dev; if (priv && mode != priv->mode) { - uint32 modebits; - uint32 regval; + uint32_t modebits; + uint32_t regval; /* Select the CTL register bits based on the selected mode */ @@ -826,7 +828,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) struct imx_spidev_s *priv = (struct imx_spidev_s *)dev; if (priv && nbits != priv->nbits && nbits > 0 && nbits <= 16) { - uint32 regval = spi_getreg(priv, CSPI_CTRL_OFFSET); + uint32_t regval = spi_getreg(priv, CSPI_CTRL_OFFSET); regval &= ~CSPI_CTRL_BITCOUNT_MASK; regval |= ((nbits - 1) << CSPI_CTRL_BITCOUNT_SHIFT); spi_putreg(priv, CSPI_CTRL_OFFSET, regval); @@ -850,10 +852,10 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) * ****************************************************************************/ -static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd) +static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd) { struct imx_spidev_s *priv = (struct imx_spidev_s*)dev; - uint16 response = 0; + uint16_t response = 0; (void)spi_transfer(priv, &wd, &response, 1); return response; @@ -872,7 +874,7 @@ static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd) * nwords - the length of data that to be exchanged in units of words. * The wordsize is determined by the number of bits-per-word * selected for the SPI interface. If nbits <= 8, the data is - * packed into ubytes; if nbits >8, the data is packed into uint16's + * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's * * Returned Value: * None @@ -900,7 +902,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, * nwords - the length of data to send from the buffer in number of words. * The wordsize is determined by the number of bits-per-word * selected for the SPI interface. If nbits <= 8, the data is - * packed into ubytes; if nbits >8, the data is packed into uint16's + * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's * * Returned Value: * None @@ -927,7 +929,7 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size * nwords - the length of data that can be received in the buffer in number * of words. The wordsize is determined by the number of bits-per-word * selected for the SPI interface. If nbits <= 8, the data is - * packed into ubytes; if nbits >8, the data is packed into uint16's + * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's * * Returned Value: * None @@ -971,7 +973,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw FAR struct spi_dev_s *up_spiinitialize(int port) { struct imx_spidev_s *priv; - ubyte regval; + uint8_t regval; /* Only the SPI1 interface is supported */ diff --git a/nuttx/arch/arm/src/imx/imx_timerisr.c b/nuttx/arch/arm/src/imx/imx_timerisr.c index c1543925a..74429ef5e 100644 --- a/nuttx/arch/arm/src/imx/imx_timerisr.c +++ b/nuttx/arch/arm/src/imx/imx_timerisr.c @@ -39,7 +39,8 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> + +#include <stdint.h> #include <debug.h> #include <errno.h> #include <nuttx/arch.h> @@ -49,7 +50,7 @@ #include "up_arch.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -73,9 +74,9 @@ * ****************************************************************************/ -int up_timerisr(int irq, uint32 *regs) +int up_timerisr(int irq, uint32_t *regs) { - uint32 tstat; + uint32_t tstat; int ret = -EIO; /* Get and clear the interrupt status */ @@ -107,7 +108,7 @@ int up_timerisr(int irq, uint32 *regs) void up_timerinit(void) { - uint32 tctl; + uint32_t tctl; /* Make sure the timer interrupts are disabled */ |