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/c5471 | |
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/c5471')
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_ethernet.c | 164 | ||||
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_irq.c | 16 | ||||
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_serial.c | 106 | ||||
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_timerisr.c | 14 | ||||
-rw-r--r-- | nuttx/arch/arm/src/c5471/c5471_watchdog.c | 33 |
5 files changed, 171 insertions, 162 deletions
diff --git a/nuttx/arch/arm/src/c5471/c5471_ethernet.c b/nuttx/arch/arm/src/c5471/c5471_ethernet.c index 322882fd4..3395fd3b3 100644 --- a/nuttx/arch/arm/src/c5471/c5471_ethernet.c +++ b/nuttx/arch/arm/src/c5471/c5471_ethernet.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/c5471/c5471_ethernet.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Based one a C5471 Linux driver and released under this BSD license with @@ -45,8 +45,8 @@ #include <nuttx/config.h> #if defined(CONFIG_NET) -#include <sys/types.h> - +#include <stdint.h> +#include <stdbool.h> #include <stdio.h> #include <time.h> #include <string.h> @@ -67,7 +67,7 @@ #include "up_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ @@ -293,9 +293,9 @@ struct c5471_driver_s { - boolean c_bifup; /* TRUE:ifup FALSE:ifdown */ - WDOG_ID c_txpoll; /* TX poll timer */ - WDOG_ID c_txtimeout; /* TX timeout timer */ + bool c_bifup; /* true:ifup false:ifdown */ + WDOG_ID c_txpoll; /* TX poll timer */ + WDOG_ID c_txtimeout; /* TX timeout timer */ /* Note: According to the C547x documentation: "The software has to maintain * two pointers to the current RX-CPU and TX-CPU descriptors. At init time, @@ -303,40 +303,40 @@ struct c5471_driver_s * to be incremented each time a descriptor ownership is give to the SWITCH". */ - volatile uint32 c_txcpudesc; - volatile uint32 c_rxcpudesc; + volatile uint32_t c_txcpudesc; + volatile uint32_t c_rxcpudesc; /* Last TX descriptor saved for error handling */ - uint32 c_lastdescstart; - uint32 c_lastdescend; + uint32_t c_lastdescstart; + uint32_t c_lastdescend; /* Shadowed registers */ - uint32 c_eimstatus; + uint32_t c_eimstatus; #ifdef CONFIG_C5471_NET_STATS /* TX statistics */ - uint32 c_txpackets; /* Number of packets sent */ - uint32 c_txmiss; /* Miss */ - uint32 c_txvlan; /* VLAN */ - uint32 c_txlframe; /* Long frame errors */ - uint32 c_txsframe; /* Short frame errors */ - uint32 c_txcrc; /* CRC errors */ - uint32 c_txoverrun; /* Overrun errors */ - uint32 c_txalign; /* Non-octect align errors */ - uint32 c_txtimeouts; /* TX timeouts */ - - uint32 c_rxpackets; /* Number of packets received */ - uint32 c_rxretries; /* Exceed retry errors */ - uint32 c_rxheartbeat; /* Heartbeat (SQE) */ - uint32 c_rxlcollision; /* Late collision errors */ - uint32 c_rxcollision; /* Collision */ - uint32 c_rxcrc; /* CRC errors */ - uint32 c_rxunderrun; /* Underrun errors */ - uint32 c_rxloc; /* Loss of carrier */ - uint32 c_rxdropped; /* Packets dropped because of size */ + uint32_t c_txpackets; /* Number of packets sent */ + uint32_t c_txmiss; /* Miss */ + uint32_t c_txvlan; /* VLAN */ + uint32_t c_txlframe; /* Long frame errors */ + uint32_t c_txsframe; /* Short frame errors */ + uint32_t c_txcrc; /* CRC errors */ + uint32_t c_txoverrun; /* Overrun errors */ + uint32_t c_txalign; /* Non-octect align errors */ + uint32_t c_txtimeouts; /* TX timeouts */ + + uint32_t c_rxpackets; /* Number of packets received */ + uint32_t c_rxretries; /* Exceed retry errors */ + uint32_t c_rxheartbeat; /* Heartbeat (SQE) */ + uint32_t c_rxlcollision; /* Late collision errors */ + uint32_t c_rxcollision; /* Collision */ + uint32_t c_rxcrc; /* CRC errors */ + uint32_t c_rxunderrun; /* Underrun errors */ + uint32_t c_rxloc; /* Loss of carrier */ + uint32_t c_rxdropped; /* Packets dropped because of size */ #endif /* This holds the information visible to uIP/NuttX */ @@ -386,8 +386,8 @@ static int c5471_interrupt(int irq, FAR void *context); /* Watchdog timer expirations */ -static void c5471_polltimer(int argc, uint32 arg, ...); -static void c5471_txtimeout(int argc, uint32 arg, ...); +static void c5471_polltimer(int argc, uint32_t arg, ...); +static void c5471_txtimeout(int argc, uint32_t arg, ...); /* NuttX callback functions */ @@ -415,7 +415,7 @@ static void c5471_macassign(struct c5471_driver_s *c5471); ****************************************************************************/ #ifdef CONFIG_C5471_NET_DUMPBUFFER -static inline void c5471_dumpbuffer(const char *msg, const ubyte *buffer, unsigned int nbytes) +static inline void c5471_dumpbuffer(const char *msg, const uint8_t *buffer, unsigned int nbytes) { /* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_NET have to be * defined or the following does nothing. @@ -516,7 +516,7 @@ static void c5471_mdtxbit (int bit_state) static int c5471_mdrxbit (void) { - register volatile uint32 bit_state; + register volatile uint32_t bit_state; /* config MDIO as input pin. */ @@ -807,7 +807,7 @@ static inline void c5471_inctxcpu(struct c5471_driver_s *c5471) } else { - c5471->c_txcpudesc += 2*sizeof(uint32); + c5471->c_txcpudesc += 2*sizeof(uint32_t); } nvdbg("TX CPU desc: %08x\n", c5471->c_txcpudesc); @@ -830,7 +830,7 @@ static inline void c5471_incrxcpu(struct c5471_driver_s *c5471) } else { - c5471->c_rxcpudesc += 2*sizeof(uint32); + c5471->c_rxcpudesc += 2*sizeof(uint32_t); } nvdbg("RX CPU desc: %08x\n", c5471->c_rxcpudesc); @@ -856,9 +856,9 @@ static inline void c5471_incrxcpu(struct c5471_driver_s *c5471) static int c5471_transmit(struct c5471_driver_s *c5471) { struct uip_driver_s *dev = &c5471->c_dev; - volatile uint16 *packetmem; - uint16 framelen; - boolean bfirstframe; + volatile uint16_t *packetmem; + uint16_t framelen; + bool bfirstframe; int nbytes; int nshorts; unsigned int i; @@ -866,7 +866,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471) nbytes = (dev->d_len + 1) & ~1; j = 0; - bfirstframe = TRUE; + bfirstframe = true; c5471->c_lastdescstart = c5471->c_rxcpudesc; nvdbg("Packet size: %d RX CPU desc: %08x\n", nbytes, c5471->c_rxcpudesc); @@ -916,12 +916,12 @@ static int c5471_transmit(struct c5471_driver_s *c5471) /* Words #2 and #3 of descriptor */ - packetmem = (uint16*)getreg32(c5471->c_rxcpudesc + sizeof(uint32)); + packetmem = (uint16_t*)getreg32(c5471->c_rxcpudesc + sizeof(uint32_t)); for (i = 0; i < nshorts; i++, j++) { /* 16-bits at a time. */ - packetmem[i] = htons(((uint16*)dev->d_buf)[j]); + packetmem[i] = htons(((uint16_t*)dev->d_buf)[j]); } putreg32(((getreg32(c5471->c_rxcpudesc) & ~EIM_RXDESC_BYTEMASK) | framelen), c5471->c_rxcpudesc); @@ -949,7 +949,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471) /* Advance to the next free descriptor */ c5471_incrxcpu(c5471); - bfirstframe = FALSE; + bfirstframe = false; } /* Packet transferred .. Update statistics */ @@ -960,7 +960,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471) /* Setup the TX timeout watchdog (perhaps restarting the timer) */ - (void)wd_start(c5471->c_txtimeout, C5471_TXTIMEOUT, c5471_txtimeout, 1, (uint32)c5471); + (void)wd_start(c5471->c_txtimeout, C5471_TXTIMEOUT, c5471_txtimeout, 1, (uint32_t)c5471); return OK; } @@ -1036,8 +1036,8 @@ static int c5471_uiptxpoll(struct uip_driver_s *dev) #ifdef CONFIG_C5471_NET_STATS static void c5471_rxstatus(struct c5471_driver_s *c5471) { - uint32 desc = c5471->c_txcpudesc; - uint32 rxstatus; + uint32_t desc = c5471->c_txcpudesc; + uint32_t rxstatus; /* Walk that last packet we just received to collect xmit status bits. */ @@ -1068,7 +1068,7 @@ static void c5471_rxstatus(struct c5471_driver_s *c5471) } else { - desc += 2 * sizeof(uint32); + desc += 2 * sizeof(uint32_t); } } @@ -1138,8 +1138,8 @@ static void c5471_rxstatus(struct c5471_driver_s *c5471) static void c5471_receive(struct c5471_driver_s *c5471) { struct uip_driver_s *dev = &c5471->c_dev; - uint16 *packetmem; - boolean bmore = TRUE; + uint16_t *packetmem; + bool bmore = true; int packetlen = 0; int framelen; int nshorts; @@ -1176,7 +1176,7 @@ static void c5471_receive(struct c5471_driver_s *c5471) { /* Get the packet memory from words #2 and #3 of descriptor */ - packetmem = (uint16*)getreg32(c5471->c_txcpudesc + sizeof(uint32)); + packetmem = (uint16_t*)getreg32(c5471->c_txcpudesc + sizeof(uint32_t)); /* Divide by 2 with round up to get the number of 16-bit words. */ @@ -1190,7 +1190,7 @@ static void c5471_receive(struct c5471_driver_s *c5471) * a time. */ - ((uint16*)dev->d_buf)[j] = htons(packetmem[i]); + ((uint16_t*)dev->d_buf)[j] = htons(packetmem[i]); } } else @@ -1200,7 +1200,7 @@ static void c5471_receive(struct c5471_driver_s *c5471) if (getreg32(c5471->c_txcpudesc) & EIM_TXDESC_LIF) { - bmore = FALSE; + bmore = false; } /* Next, Clear all bits of words0/1 of the emptied descriptor except preserve @@ -1312,8 +1312,8 @@ static void c5471_receive(struct c5471_driver_s *c5471) #ifdef CONFIG_C5471_NET_STATS static void c5471_txstatus(struct c5471_driver_s *c5471) { - uint32 desc = c5471->c_lastdescstart; - uint32 txstatus; + uint32_t desc = c5471->c_lastdescstart; + uint32_t txstatus; /* Walk that last packet we just sent to collect xmit status bits. */ @@ -1338,7 +1338,7 @@ static void c5471_txstatus(struct c5471_driver_s *c5471) } else { - desc += 2 * sizeof(uint32); + desc += 2 * sizeof(uint32_t); } } } @@ -1515,7 +1515,7 @@ static int c5471_interrupt(int irq, FAR void *context) * ****************************************************************************/ -static void c5471_txtimeout(int argc, uint32 arg, ...) +static void c5471_txtimeout(int argc, uint32_t arg, ...) { struct c5471_driver_s *c5471 = (struct c5471_driver_s *)arg; @@ -1553,7 +1553,7 @@ static void c5471_txtimeout(int argc, uint32 arg, ...) * ****************************************************************************/ -static void c5471_polltimer(int argc, uint32 arg, ...) +static void c5471_polltimer(int argc, uint32_t arg, ...) { struct c5471_driver_s *c5471 = (struct c5471_driver_s *)arg; @@ -1594,7 +1594,7 @@ static void c5471_polltimer(int argc, uint32 arg, ...) static int c5471_ifup(struct uip_driver_s *dev) { struct c5471_driver_s *c5471 = (struct c5471_driver_s *)dev->d_private; - volatile uint32 clearbits; + volatile uint32_t clearbits; ndbg("Bringing up: %d.%d.%d.%d\n", dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff, @@ -1626,11 +1626,11 @@ static int c5471_ifup(struct uip_driver_s *dev) /* Set and activate a timer process */ - (void)wd_start(c5471->c_txpoll, C5471_WDDELAY, c5471_polltimer, 1, (uint32)c5471); + (void)wd_start(c5471->c_txpoll, C5471_WDDELAY, c5471_polltimer, 1, (uint32_t)c5471); /* Enable the Ethernet interrupt */ - c5471->c_bifup = TRUE; + c5471->c_bifup = true; up_enable_irq(C5471_IRQ_ETHER); return OK; } @@ -1682,7 +1682,7 @@ static int c5471_ifdown(struct uip_driver_s *dev) /* Reset the device */ - c5471->c_bifup = FALSE; + c5471->c_bifup = false; irqrestore(flags); return OK; } @@ -1793,9 +1793,9 @@ static void c5471_eimreset (struct c5471_driver_s *c5471) static void c5471_eimconfig(struct c5471_driver_s *c5471) { - volatile uint32 pbuf; - volatile uint32 desc; - volatile uint32 val; + volatile uint32_t pbuf; + volatile uint32_t desc; + volatile uint32_t val; int i; desc = EIM_RAM_START; @@ -1815,16 +1815,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471) val |= EIM_TXDESC_OWN_HOST|EIM_TXDESC_INTRE|EIM_TXDESC_PADCRC|EIM_PACKET_BYTES; putreg32(val, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(pbuf, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(0, pbuf); pbuf += EIM_PACKET_BYTES; putreg32(0, pbuf); - pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */ + pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */ } /* RX ENET 0 */ @@ -1841,16 +1841,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471) val |= EIM_RXDESC_OWN_ENET|EIM_RXDESC_INTRE|EIM_RXDESC_PADCRC|EIM_PACKET_BYTES; putreg32(val, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(pbuf, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(0, pbuf); pbuf += EIM_PACKET_BYTES; putreg32(0, pbuf); - pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */ + pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */ } /* TX CPU */ @@ -1870,16 +1870,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471) val |= EIM_TXDESC_OWN_HOST|EIM_TXDESC_INTRE|EIM_TXDESC_PADCRC|EIM_PACKET_BYTES; putreg32(val, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(pbuf, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg(0, pbuf); pbuf += EIM_PACKET_BYTES; putreg(0, pbuf); - pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */ + pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */ } /* RX CPU */ @@ -1899,16 +1899,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471) val |= EIM_RXDESC_OWN_ENET|EIM_RXDESC_INTRE|EIM_RXDESC_PADCRC|EIM_PACKET_BYTES; putreg32(val, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(pbuf, desc); - desc += sizeof(uint32); + desc += sizeof(uint32_t); putreg32(0, pbuf); pbuf += EIM_PACKET_BYTES; putreg32(0, pbuf); - pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */ + pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */ } ndbg("END desc: %08x pbuf: %08x\n", desc, pbuf); @@ -2018,8 +2018,8 @@ static void c5471_reset(struct c5471_driver_s *c5471) static void c5471_macassign(struct c5471_driver_s *c5471) { struct uip_driver_s *dev = &c5471->c_dev; - uint8 *mptr = dev->d_mac.ether_addr_octet; - register uint32 tmp; + uint8_t *mptr = dev->d_mac.ether_addr_octet; + register uint32_t tmp; ndbg("MAC: %0x:%0x:%0x:%0x:%0x:%0x\n", mptr[0], mptr[1], mptr[2], mptr[3], mptr[4], mptr[5]); @@ -2028,11 +2028,11 @@ static void c5471_macassign(struct c5471_driver_s *c5471) * this destination address. */ - tmp = (((uint32)mptr[0]) << 8) | ((uint32)mptr[1]); + tmp = (((uint32_t)mptr[0]) << 8) | ((uint32_t)mptr[1]); putreg32(tmp, EIM_CPU_DAHI); - tmp = (((uint32)mptr[2]) << 24) | (((uint32)mptr[3]) << 16) | - (((uint32)mptr[4]) << 8) | ((uint32)mptr[5]); + tmp = (((uint32_t)mptr[2]) << 24) | (((uint32_t)mptr[3]) << 16) | + (((uint32_t)mptr[4]) << 8) | ((uint32_t)mptr[5]); putreg32(tmp, EIM_CPU_DALO); #if 0 diff --git a/nuttx/arch/arm/src/c5471/c5471_irq.c b/nuttx/arch/arm/src/c5471/c5471_irq.c index 08b76d3e7..27e178469 100644 --- a/nuttx/arch/arm/src/c5471/c5471_irq.c +++ b/nuttx/arch/arm/src/c5471/c5471_irq.c @@ -38,8 +38,8 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include <nuttx/irq.h> #include "arm.h" @@ -48,7 +48,7 @@ #include "up_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ #define ILR_EDGESENSITIVE 0x00000020 @@ -58,7 +58,7 @@ * Public Data ****************************************************************************/ -uint32 *current_regs; +uint32_t *current_regs; /**************************************************************************** * Private Data @@ -107,7 +107,7 @@ static up_vector_t g_vectorinittab[] = static inline void up_ackirq(unsigned int irq) { - uint32 reg; + uint32_t reg; reg = getreg32(SRC_IRQ_REG); /* Insure appropriate IT_REG bit clears */ putreg32(reg | 0x00000001, INT_CTRL_REG); /* write the NEW_IRQ_AGR bit. */ } @@ -125,7 +125,7 @@ static inline void up_ackirq(unsigned int irq) static inline void up_ackfiq(unsigned int irq) { - uint32 reg; + uint32_t reg; reg = getreg32(SRC_FIQ_REG); /* Insure appropriate IT_REG bit clears */ putreg32(reg | 0x00000002, INT_CTRL_REG); /* write the NEW_FIQ_AGR bit. */ } @@ -197,7 +197,7 @@ void up_disable_irq(int irq) { if ((unsigned)irq < NR_IRQS) { - uint32 reg = getreg32(MASK_IT_REG); + uint32_t reg = getreg32(MASK_IT_REG); putreg32(reg | (1 << irq), MASK_IT_REG); } } @@ -214,7 +214,7 @@ void up_enable_irq(int irq) { if ((unsigned)irq < NR_IRQS) { - uint32 reg = getreg32(MASK_IT_REG); + uint32_t reg = getreg32(MASK_IT_REG); putreg32(reg & ~(1 << irq), MASK_IT_REG); } } @@ -229,7 +229,7 @@ void up_enable_irq(int irq) void up_maskack_irq(int irq) { - uint32 reg = getreg32(INT_CTRL_REG); + uint32_t reg = getreg32(INT_CTRL_REG); /* Mask the interrupt */ diff --git a/nuttx/arch/arm/src/c5471/c5471_serial.c b/nuttx/arch/arm/src/c5471/c5471_serial.c index 375bacd81..6e3d52c67 100644 --- a/nuttx/arch/arm/src/c5471/c5471_serial.c +++ b/nuttx/arch/arm/src/c5471/c5471_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * c5471/c5471_serial.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,8 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> #include <unistd.h> #include <semaphore.h> #include <string.h> @@ -56,7 +58,7 @@ #include "up_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ #define BASE_BAUD 115200 @@ -71,12 +73,12 @@ struct uart_regs_s { - uint32 ier; - uint32 lcr; - uint32 fcr; + uint32_t ier; + uint32_t lcr; + uint32_t fcr; #ifdef CONFIG_UART_HWFLOWCONTROL - uint32 efr; - uint32 tcr; + uint32_t efr; + uint32_t tcr; #endif }; @@ -85,16 +87,16 @@ struct up_dev_s unsigned int uartbase; /* Base address of UART registers */ unsigned int baud_base; /* Base baud for conversions */ unsigned int baud; /* Configured baud */ - ubyte xmit_fifo_size; /* Size of transmit FIFO */ - ubyte irq; /* IRQ associated with this UART */ - ubyte parity; /* 0=none, 1=odd, 2=even */ - ubyte bits; /* Number of bits (7 or 8) */ + uint8_t xmit_fifo_size; /* Size of transmit FIFO */ + uint8_t irq; /* IRQ associated with this UART */ + uint8_t parity; /* 0=none, 1=odd, 2=even */ + uint8_t bits; /* Number of bits (7 or 8) */ #ifdef CONFIG_UART_HWFLOWCONTROL - boolean flowcontrol; /* TRUE: Hardware flow control - * is enabled. */ + bool flowcontrol; /* true: Hardware flow control + * is enabled. */ #endif - boolean stopbits2; /* TRUE: Configure with 2 - * stop bits instead of 1 */ + bool stopbits2; /* true: Configure with 2 + * stop bits instead of 1 */ struct uart_regs_s regs; /* Shadow copy of readonly regs */ }; @@ -102,19 +104,19 @@ struct up_dev_s * Private Function Prototypes ****************************************************************************/ -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_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, unsigned int *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_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_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, unsigned int *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 @@ -155,7 +157,7 @@ static struct up_dev_s g_irdapriv = .parity = CONFIG_UART_IRDA_PARITY, .bits = CONFIG_UART_IRDA_BITS, #ifdef CONFIG_UART_IRDA_HWFLOWCONTROL - .flowcontrol = TRUE, + .flowcontrol = true, #endif .stopbits2 = CONFIG_UART_IRDA_2STOP, }; @@ -188,7 +190,7 @@ static struct up_dev_s g_modempriv = .parity = CONFIG_UART_MODEM_PARITY, .bits = CONFIG_UART_MODEM_BITS, #ifdef CONFIG_UART_MODEM_HWFLOWCONTROL - .flowcontrol = TRUE, + .flowcontrol = true, #endif .stopbits2 = CONFIG_UART_MODEM_2STOP, }; @@ -229,7 +231,7 @@ static uart_dev_t g_modemport = * Name: up_inserial ****************************************************************************/ -static inline uint32 up_inserial(struct up_dev_s *priv, uint32 offset) +static inline uint32_t up_inserial(struct up_dev_s *priv, uint32_t offset) { return getreg32(priv->uartbase + offset); } @@ -238,7 +240,7 @@ static inline uint32 up_inserial(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); } @@ -247,7 +249,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, uint16 *ier) +static inline void up_disableuartint(struct up_dev_s *priv, uint16_t *ier) { if (ier) { @@ -261,7 +263,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint16 *ier) * Name: up_restoreuartint ****************************************************************************/ -static inline void up_restoreuartint(struct up_dev_s *priv, uint16 ier) +static inline void up_restoreuartint(struct up_dev_s *priv, uint16_t ier) { priv->regs.ier |= ier & (UART_IER_RECVINT|UART_IER_XMITINT); up_serialout(priv, UART_IER_OFFS, priv->regs.ier); @@ -309,7 +311,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv) static inline void up_setrate(struct up_dev_s *priv, unsigned int rate) { - uint32 div_bit_rate; + uint32_t div_bit_rate; switch (rate) { @@ -420,7 +422,7 @@ static int up_setup(struct uart_dev_s *dev) up_setrate(priv, priv->baud); priv->regs.lcr &= 0xffffffe0; /* clear original field, and... */ - priv->regs.lcr |= (uint32)cval; /* Set new bits in that field. */ + priv->regs.lcr |= (uint32_t)cval; /* Set new bits in that field. */ up_serialout(priv, UART_LCR_OFFS, priv->regs.lcr); #ifdef CONFIG_UART_HWFLOWCONTROL @@ -532,7 +534,7 @@ static int up_interrupt(int irq, void *context) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; - volatile uint32 cause; + volatile uint32_t cause; if (g_irdapriv.irq == irq) { @@ -552,7 +554,7 @@ static int up_interrupt(int irq, void *context) if ((cause & 0x0000000c) == 0x0000000c) { - uint32 ier_val = 0; + uint32_t ier_val = 0; /* Is this an interrupt from the IrDA UART? */ @@ -671,8 +673,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) static int up_receive(struct uart_dev_s *dev, unsigned int *status) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - uint32 rhr; - uint32 lsr; + uint32_t rhr; + uint32_t lsr; /* Construct a 16bit status word that uses the high byte to * hold the status bits associated with framing,parity,break @@ -696,7 +698,7 @@ static int up_receive(struct uart_dev_s *dev, unsigned int *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; if (enable) @@ -717,11 +719,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; return up_inserial(priv, UART_LSR_OFFS) & UART_RX_FIFO_NOEMPTY; @@ -738,7 +740,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_THR_OFFS, (ubyte)ch); + up_serialout(priv, UART_THR_OFFS, (uint8_t)ch); } /**************************************************************************** @@ -749,7 +751,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; if (enable) @@ -770,11 +772,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; return (up_inserial(priv, UART_SSR_OFFS) & UART_SSR_TXFULL) == 0; @@ -784,11 +786,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; return (up_inserial(priv, UART_LSR_OFFS) & UART_LSR_TREF) != 0; @@ -813,7 +815,7 @@ void up_earlyserialinit(void) up_disableuartint(TTYS0_DEV.priv, NULL); up_disableuartint(TTYS1_DEV.priv, NULL); - CONSOLE_DEV.isconsole = TRUE; + CONSOLE_DEV.isconsole = true; up_setup(&CONSOLE_DEV); } @@ -845,11 +847,11 @@ void up_serialinit(void) int up_putc(int ch) { struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv; - uint16 ier; + uint16_t ier; up_disableuartint(priv, &ier); up_waittxready(priv); - up_serialout(priv, UART_THR_OFFS, (ubyte)ch); + up_serialout(priv, UART_THR_OFFS, (uint8_t)ch); /* Check for LF */ diff --git a/nuttx/arch/arm/src/c5471/c5471_timerisr.c b/nuttx/arch/arm/src/c5471/c5471_timerisr.c index e37043173..81fb24a21 100644 --- a/nuttx/arch/arm/src/c5471/c5471_timerisr.c +++ b/nuttx/arch/arm/src/c5471/c5471_timerisr.c @@ -1,7 +1,7 @@ /************************************************************ * c5471/c5471_timerisr.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,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. * @@ -38,15 +38,17 @@ ************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> + +#include <stdint.h> #include <debug.h> #include <nuttx/arch.h> + #include "clock_internal.h" #include "up_internal.h" #include "up_arch.h" /************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************/ /* We want the general purpose timer running at the rate @@ -87,7 +89,7 @@ * ************************************************************/ -int up_timerisr(int irq, uint32 *regs) +int up_timerisr(int irq, uint32_t *regs) { /* Process timer interrupt */ @@ -106,7 +108,7 @@ int up_timerisr(int irq, uint32 *regs) void up_timerinit(void) { - uint32 val; + uint32_t val; up_disable_irq(C5471_IRQ_SYSTIMER); diff --git a/nuttx/arch/arm/src/c5471/c5471_watchdog.c b/nuttx/arch/arm/src/c5471/c5471_watchdog.c index 96ddb6529..366099698 100644 --- a/nuttx/arch/arm/src/c5471/c5471_watchdog.c +++ b/nuttx/arch/arm/src/c5471/c5471_watchdog.c @@ -1,7 +1,7 @@ /************************************************************************** * c5471/c5471_watchdog.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,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. * @@ -38,13 +38,18 @@ **************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> #include <stdio.h> #include <debug.h> #include <errno.h> + #include <nuttx/fs.h> #include <nuttx/irq.h> #include <arch/watchdog.h> + #include "up_arch.h" /************************************************************************** @@ -72,8 +77,8 @@ /* Macros to manage access to to watchdog timer macros */ -#define c5471_wdt_cntl (*(volatile uint32*)C5471_TIMER0_CTRL) -#define c5471_wdt_count (*(volatile uint32*)C5471_TIMER0_CNT) +#define c5471_wdt_cntl (*(volatile uint32_t*)C5471_TIMER0_CTRL) +#define c5471_wdt_count (*(volatile uint32_t*)C5471_TIMER0_CNT) /************************************************************************** * Private Types @@ -87,20 +92,20 @@ static inline unsigned int wdt_prescaletoptv(unsigned int prescale); -static int wdt_setusec(uint32 usec); +static int wdt_setusec(uint32_t usec); static int wdt_interrupt(int irq, void *context); static int wdt_open(struct file *filep); static int wdt_close(struct file *filep); static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen); static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen); -static int wdt_ioctl(struct file *filep, int cmd, uint32 arg); +static int wdt_ioctl(struct file *filep, int cmd, uint32_t arg); /************************************************************************** * Private Data **************************************************************************/ -static boolean g_wdtopen; +static bool g_wdtopen; static const struct file_operations g_wdtops = { @@ -156,15 +161,15 @@ static inline unsigned int wdt_prescaletoptv(unsigned int prescale) * Name: wdt_setusec **************************************************************************/ -static int wdt_setusec(uint32 usec) +static int wdt_setusec(uint32_t usec) { /* prescaler: clock / prescaler = #clock ticks per counter in ptv * divisor: #counts until the interrupt comes. */ - uint32 prescaler = MAX_PRESCALER; - uint32 divisor = 1; - uint32 mode; + uint32_t prescaler = MAX_PRESCALER; + uint32_t divisor = 1; + uint32_t mode; dbg("usec=%d\n", usec); @@ -283,7 +288,7 @@ static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen) * Name: wdt_ioctl **************************************************************************/ -static int wdt_ioctl(struct file *filep, int cmd, uint32 arg) +static int wdt_ioctl(struct file *filep, int cmd, uint32_t arg) { dbg("ioctl Call: cmd=0x%x arg=0x%x", cmd, arg); @@ -323,7 +328,7 @@ static int wdt_open(struct file *filep) c5471_wdt_cntl = C5471_DISABLE_VALUE1; c5471_wdt_cntl = C5471_DISABLE_VALUE2; - g_wdtopen = TRUE; + g_wdtopen = true; return OK; } @@ -345,7 +350,7 @@ static int wdt_close(struct file *filep) c5471_wdt_cntl = C5471_TIMER_MODE; #endif - g_wdtopen = FALSE; + g_wdtopen = false; return 0; } |