From e9fe00c5730b59b80f25924e0be58d0bb6f842e5 Mon Sep 17 00:00:00 2001 From: Petro Karashchenko Date: Thu, 15 Dec 2022 00:53:03 +0200 Subject: [PATCH] arch/renesas: remove FAR and apply formatting Signed-off-by: Petro Karashchenko --- .../renesas/src/common/renesas_allocateheap.c | 4 +- arch/renesas/src/common/renesas_createstack.c | 2 +- arch/renesas/src/common/renesas_exit.c | 4 +- .../renesas/src/common/renesas_releasestack.c | 2 +- arch/renesas/src/common/renesas_stackframe.c | 6 +- arch/renesas/src/m16c/m16c_dumpstate.c | 2 +- arch/renesas/src/m16c/m16c_initialstate.c | 8 +- arch/renesas/src/rx65n/rx65n_dtc.h | 2 +- arch/renesas/src/rx65n/rx65n_dumpstate.c | 2 +- arch/renesas/src/rx65n/rx65n_eth.c | 206 +- arch/renesas/src/rx65n/rx65n_riic.c | 298 +- arch/renesas/src/rx65n/rx65n_riic.h | 4 +- arch/renesas/src/rx65n/rx65n_rspi.c | 128 +- arch/renesas/src/rx65n/rx65n_rspi.h | 41 +- arch/renesas/src/rx65n/rx65n_rspi_sw.c | 140 +- arch/renesas/src/rx65n/rx65n_rtc.c | 40 +- arch/renesas/src/rx65n/rx65n_rtc.h | 20 +- arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c | 124 +- arch/renesas/src/rx65n/rx65n_sbram.c | 112 +- arch/renesas/src/rx65n/rx65n_serial.c | 10 +- arch/renesas/src/rx65n/rx65n_usbdev.c | 2479 ++++++++--------- arch/renesas/src/rx65n/rx65n_usbhost.c | 103 +- arch/renesas/src/rx65n/rx65n_usbhost.h | 2 +- arch/renesas/src/sh1/sh1_dumpstate.c | 2 +- arch/renesas/src/sh1/sh1_serial.c | 4 +- 25 files changed, 1845 insertions(+), 1900 deletions(-) diff --git a/arch/renesas/src/common/renesas_allocateheap.c b/arch/renesas/src/common/renesas_allocateheap.c index 2b22f27f6f..4e35e6a016 100644 --- a/arch/renesas/src/common/renesas_allocateheap.c +++ b/arch/renesas/src/common/renesas_allocateheap.c @@ -64,9 +64,9 @@ * ****************************************************************************/ -void up_allocate_heap(FAR void **heap_start, size_t *heap_size) +void up_allocate_heap(void **heap_start, size_t *heap_size) { board_autoled_on(LED_HEAPALLOCATE); - *heap_start = (FAR void *)g_idle_topstack; + *heap_start = (void *)g_idle_topstack; *heap_size = CONFIG_RAM_END - g_idle_topstack; } diff --git a/arch/renesas/src/common/renesas_createstack.c b/arch/renesas/src/common/renesas_createstack.c index 8544010ed1..fc335d6574 100644 --- a/arch/renesas/src/common/renesas_createstack.c +++ b/arch/renesas/src/common/renesas_createstack.c @@ -87,7 +87,7 @@ * ****************************************************************************/ -int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) +int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype) { #ifdef CONFIG_TLS_ALIGNED /* The allocated stack size must not exceed the maximum possible for the diff --git a/arch/renesas/src/common/renesas_exit.c b/arch/renesas/src/common/renesas_exit.c index 319667c0c0..8b8633ee5e 100644 --- a/arch/renesas/src/common/renesas_exit.c +++ b/arch/renesas/src/common/renesas_exit.c @@ -61,9 +61,9 @@ ****************************************************************************/ #ifdef CONFIG_DUMP_ON_EXIT -static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) +static void _up_dumponexit(struct tcb_s *tcb, void *arg) { - FAR struct filelist *filelist; + struct filelist *filelist; int i; int j; diff --git a/arch/renesas/src/common/renesas_releasestack.c b/arch/renesas/src/common/renesas_releasestack.c index 2c9ca5020d..0667f5bc6f 100644 --- a/arch/renesas/src/common/renesas_releasestack.c +++ b/arch/renesas/src/common/renesas_releasestack.c @@ -75,7 +75,7 @@ * ****************************************************************************/ -void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) +void up_release_stack(struct tcb_s *dtcb, uint8_t ttype) { /* Is there a stack allocated? */ diff --git a/arch/renesas/src/common/renesas_stackframe.c b/arch/renesas/src/common/renesas_stackframe.c index f683a1f6fe..9b9086a458 100644 --- a/arch/renesas/src/common/renesas_stackframe.c +++ b/arch/renesas/src/common/renesas_stackframe.c @@ -68,9 +68,9 @@ * ****************************************************************************/ -FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) +void *up_stack_frame(struct tcb_s *tcb, size_t frame_size) { - FAR void *ret; + void *ret; /* Align the frame_size */ @@ -88,7 +88,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - tcb->stack_base_ptr = (FAR uint8_t *)tcb->stack_base_ptr + frame_size; + tcb->stack_base_ptr = (uint8_t *)tcb->stack_base_ptr + frame_size; tcb->adj_stack_size -= frame_size; /* And return a pointer to allocated memory */ diff --git a/arch/renesas/src/m16c/m16c_dumpstate.c b/arch/renesas/src/m16c/m16c_dumpstate.c index e43d9b6fff..7e5c284864 100644 --- a/arch/renesas/src/m16c/m16c_dumpstate.c +++ b/arch/renesas/src/m16c/m16c_dumpstate.c @@ -125,7 +125,7 @@ static inline void m16c_registerdump(void) void renesas_dumpstate(void) { - FAR struct tcb_s *rtcb = running_task(); + struct tcb_s *rtcb = running_task(); uint16_t sp = up_getsp(); uint16_t ustackbase; uint16_t ustacksize; diff --git a/arch/renesas/src/m16c/m16c_initialstate.c b/arch/renesas/src/m16c/m16c_initialstate.c index e86717ba18..e7303ca7a5 100644 --- a/arch/renesas/src/m16c/m16c_initialstate.c +++ b/arch/renesas/src/m16c/m16c_initialstate.c @@ -49,11 +49,11 @@ * ****************************************************************************/ -void up_initial_state(FAR struct tcb_s *tcb) +void up_initial_state(struct tcb_s *tcb) { - FAR struct xcptcontext *xcp = &tcb->xcp; - FAR uint8_t *regs = xcp->regs; - uintptr_t sp; + struct xcptcontext *xcp = &tcb->xcp; + uint8_t *regs = xcp->regs; + uintptr_t sp; /* Initialize the idle thread stack */ diff --git a/arch/renesas/src/rx65n/rx65n_dtc.h b/arch/renesas/src/rx65n/rx65n_dtc.h index 64682b6bb9..1ab5fa83ba 100644 --- a/arch/renesas/src/rx65n/rx65n_dtc.h +++ b/arch/renesas/src/rx65n/rx65n_dtc.h @@ -42,7 +42,7 @@ * DTC channel. */ -typedef FAR void *DTC_HANDLE; +typedef void *DTC_HANDLE; /* Configurable options for DTC Transfer mode */ diff --git a/arch/renesas/src/rx65n/rx65n_dumpstate.c b/arch/renesas/src/rx65n/rx65n_dumpstate.c index a10d4cde95..b8509398c4 100644 --- a/arch/renesas/src/rx65n/rx65n_dumpstate.c +++ b/arch/renesas/src/rx65n/rx65n_dumpstate.c @@ -135,7 +135,7 @@ static inline void rx65n_registerdump(void) void renesas_dumpstate(void) { - FAR struct tcb_s *rtcb = running_task(); + struct tcb_s *rtcb = running_task(); uint32_t sp = up_getsp(); uint32_t ustackbase; uint32_t ustacksize; diff --git a/arch/renesas/src/rx65n/rx65n_eth.c b/arch/renesas/src/rx65n/rx65n_eth.c index 91e96681f5..6ec14ac77c 100644 --- a/arch/renesas/src/rx65n/rx65n_eth.c +++ b/arch/renesas/src/rx65n/rx65n_eth.c @@ -195,7 +195,7 @@ * header */ -#define BUF ((FAR struct eth_hdr_s *)priv->dev.d_buf) +#define BUF ((struct eth_hdr_s *)&priv->dev.d_buf[0]) /* PHY return definitions */ @@ -450,62 +450,62 @@ static void rx65n_checksetup(void); /* Free buffer management */ -static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv); -static inline uint8_t *rx65n_allocbuffer(FAR struct rx65n_ethmac_s *priv); -static inline void rx65n_freebuffer(FAR struct rx65n_ethmac_s *priv, - uint8_t *buffer); -static inline bool rx65n_isfreebuffer(FAR struct rx65n_ethmac_s *priv); +static void rx65n_initbuffer(struct rx65n_ethmac_s *priv); +static inline uint8_t *rx65n_allocbuffer(struct rx65n_ethmac_s *priv); +static inline void rx65n_freebuffer(struct rx65n_ethmac_s *priv, + uint8_t *buffer); +static inline bool rx65n_isfreebuffer(struct rx65n_ethmac_s *priv); /* Common TX logic */ -static int rx65n_transmit(FAR struct rx65n_ethmac_s *priv); +static int rx65n_transmit(struct rx65n_ethmac_s *priv); static int rx65n_txpoll(struct net_driver_s *dev); -static void rx65n_dopoll(FAR struct rx65n_ethmac_s *priv); +static void rx65n_dopoll(struct rx65n_ethmac_s *priv); /* Interrupt handling */ -static void rx65n_enableint(FAR struct rx65n_ethmac_s *priv, - uint32_t ierbit); -static void rx65n_disableint(FAR struct rx65n_ethmac_s *priv, - uint32_t ierbit); +static void rx65n_enableint(struct rx65n_ethmac_s *priv, + uint32_t ierbit); +static void rx65n_disableint(struct rx65n_ethmac_s *priv, + uint32_t ierbit); -static void rx65n_freesegment(FAR struct rx65n_ethmac_s *priv, - FAR struct eth_rxdesc_s *rxfirst, int segments); -static int rx65n_recvframe(FAR struct rx65n_ethmac_s *priv); -static void rx65n_receive(FAR struct rx65n_ethmac_s *priv); -static void rx65n_freeframe(FAR struct rx65n_ethmac_s *priv); -static void rx65n_txdone(FAR struct rx65n_ethmac_s *priv); +static void rx65n_freesegment(struct rx65n_ethmac_s *priv, + struct eth_rxdesc_s *rxfirst, int segments); +static int rx65n_recvframe(struct rx65n_ethmac_s *priv); +static void rx65n_receive(struct rx65n_ethmac_s *priv); +static void rx65n_freeframe(struct rx65n_ethmac_s *priv); +static void rx65n_txdone(struct rx65n_ethmac_s *priv); -static void rx65n_interrupt_work(FAR void *arg); -static int rx65n_interrupt(int irq, FAR void *context, FAR void *arg); +static void rx65n_interrupt_work(void *arg); +static int rx65n_interrupt(int irq, void *context, void *arg); /* Timer expirations */ -static void rx65n_txtimeout_work(FAR void *arg); +static void rx65n_txtimeout_work(void *arg); /* NuttX callback functions */ static int rx65n_ifup(struct net_driver_s *dev); static int rx65n_ifdown(struct net_driver_s *dev); -static void rx65n_txavail_work(FAR void *arg); +static void rx65n_txavail_work(void *arg); static int rx65n_txavail(struct net_driver_s *dev); #if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6) -static int rx65n_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); +static int rx65n_addmac(struct net_driver_s *dev, const uint8_t *mac); #endif #ifdef CONFIG_NET_MCASTGROUP -static int rx65n_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); +static int rx65n_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif #ifdef CONFIG_NETDEV_IOCTL static int rx65n_ioctl(struct net_driver_s *dev, int cmd, - unsigned long arg); + unsigned long arg); #endif /* Descriptor Initialization */ -static void rx65n_txdescinit(FAR struct rx65n_ethmac_s *priv); -static void rx65n_rxdescinit(FAR struct rx65n_ethmac_s *priv); +static void rx65n_txdescinit(struct rx65n_ethmac_s *priv); +static void rx65n_rxdescinit(struct rx65n_ethmac_s *priv); /* PHY Initialization */ @@ -513,36 +513,36 @@ static void rx65n_rxdescinit(FAR struct rx65n_ethmac_s *priv); static void rx65n_phyintenable(bool enable); #endif #if defined(CONFIG_ARCH_PHY_INTERRUPT) -int arch_phy_irq(FAR const char *intf, xcpt_t handler, void *arg, +int arch_phy_irq(const char *intf, xcpt_t handler, void *arg, phy_enable_t *enable); #endif -static int rx65n_phyinit(FAR struct rx65n_ethmac_s *priv); +static int rx65n_phyinit(struct rx65n_ethmac_s *priv); /* MAC/DMA Initialization */ -static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv); -static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv); -static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv); -static int rx65n_ethconfig(FAR struct rx65n_ethmac_s *priv); +static int rx65n_ethreset(struct rx65n_ethmac_s *priv); +static int rx65n_macconfig(struct rx65n_ethmac_s *priv); +static void rx65n_macaddress(struct rx65n_ethmac_s *priv); +static int rx65n_ethconfig(struct rx65n_ethmac_s *priv); -static void rx65n_phy_preamble (void); -static void rx65n_phy_trans_zto0 (void); -static void rx65n_phy_trans_1to0 (void); +static void rx65n_phy_preamble(void); +static void rx65n_phy_trans_zto0(void); +static void rx65n_phy_trans_1to0(void); static void rx65n_phy_reg_set(uint8_t phydevaddr, uint16_t reg_addr, int32_t option); -static void rx65n_phy_reg_write (uint16_t data); -static void rx65n_phy_mii_write1 (void); -static void rx65n_phy_mii_write0 (void); +static void rx65n_phy_reg_write(uint16_t data); +static void rx65n_phy_mii_write1(void); +static void rx65n_phy_mii_write0(void); void rx65n_ether_enable_icu(void); -void rx65n_power_on_control (void); +void rx65n_power_on_control(void); void rx65n_ether_set_phy_mode(uint8_t mode); void rx65n_ether_interrupt_init(void); -static int rx65n_phywrite (uint8_t phydevaddr, uint16_t reg_addr, - uint16_t data); -static uint16_t rx65n_phyread (uint8_t phydevaddr, uint16_t reg_addr, - uint16_t *value); +static int rx65n_phywrite(uint8_t phydevaddr, uint16_t reg_addr, + uint16_t data); +static uint16_t rx65n_phyread(uint8_t phydevaddr, uint16_t reg_addr, + uint16_t *value); void up_enable_irq(int irq); void up_disable_irq(int irq); @@ -550,9 +550,9 @@ void up_disable_irq(int irq); #if defined(CONFIG_ARCH_PHY_INTERRUPT) struct phylinknotification_t { - xcpt_t phandler; - void *penable; - struct phy_notify_s *pclient; + xcpt_t phandler; + void *penable; + struct phy_notify_s *pclient; }; struct phylinknotification_t phylinknotification = @@ -704,7 +704,7 @@ static void rx65n_checksetup(void) * ****************************************************************************/ -static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv) +static void rx65n_initbuffer(struct rx65n_ethmac_s *priv) { uint8_t *buffer; int i; @@ -719,7 +719,7 @@ static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv) i < RX65N_ETH_NFREEBUFFERS; i++, buffer += CONFIG_RX65N_ETH_BUFSIZE) { - sq_addlast((FAR sq_entry_t *)buffer, &priv->freeb); + sq_addlast((sq_entry_t *)buffer, &priv->freeb); } } @@ -742,7 +742,7 @@ static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static inline uint8_t *rx65n_allocbuffer(FAR struct rx65n_ethmac_s *priv) +static inline uint8_t *rx65n_allocbuffer(struct rx65n_ethmac_s *priv) { /* Allocate a buffer by returning the head of the free buffer list */ @@ -769,12 +769,12 @@ static inline uint8_t *rx65n_allocbuffer(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static inline void rx65n_freebuffer(FAR struct rx65n_ethmac_s *priv, +static inline void rx65n_freebuffer(struct rx65n_ethmac_s *priv, uint8_t *buffer) { /* Free the buffer by adding it to the end of the free buffer list */ - sq_addlast((FAR sq_entry_t *)buffer, &priv->freeb); + sq_addlast((sq_entry_t *)buffer, &priv->freeb); } /**************************************************************************** @@ -795,7 +795,7 @@ static inline void rx65n_freebuffer(FAR struct rx65n_ethmac_s *priv, * ****************************************************************************/ -static inline bool rx65n_isfreebuffer(FAR struct rx65n_ethmac_s *priv) +static inline bool rx65n_isfreebuffer(struct rx65n_ethmac_s *priv) { /* Return TRUE if the free buffer list is not empty */ @@ -822,7 +822,7 @@ static inline bool rx65n_isfreebuffer(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static int rx65n_transmit(FAR struct rx65n_ethmac_s *priv) +static int rx65n_transmit(struct rx65n_ethmac_s *priv) { struct eth_txdesc_s *txdesc; struct eth_txdesc_s *txfirst; @@ -1042,8 +1042,7 @@ static int rx65n_transmit(FAR struct rx65n_ethmac_s *priv) static int rx65n_txpoll(struct net_driver_s *dev) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> - d_private; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private; DEBUGASSERT(priv->dev.d_buf != NULL); @@ -1117,9 +1116,9 @@ static int rx65n_txpoll(struct net_driver_s *dev) * ****************************************************************************/ -static void rx65n_dopoll(FAR struct rx65n_ethmac_s *priv) +static void rx65n_dopoll(struct rx65n_ethmac_s *priv) { - FAR struct net_driver_s *dev = &priv->dev; + struct net_driver_s *dev = &priv->dev; /* Check if the next TX descriptor is owned by the Ethernet DMA or * CPU. We cannot perform the TX poll if we are unable to accept @@ -1174,7 +1173,7 @@ static void rx65n_dopoll(FAR struct rx65n_ethmac_s *priv) * None ****************************************************************************/ -static void rx65n_enableint(FAR struct rx65n_ethmac_s *priv, uint32_t ierbit) +static void rx65n_enableint(struct rx65n_ethmac_s *priv, uint32_t ierbit) { uint32_t regval; @@ -1199,7 +1198,7 @@ static void rx65n_enableint(FAR struct rx65n_ethmac_s *priv, uint32_t ierbit) * None ****************************************************************************/ -static void rx65n_disableint(FAR struct rx65n_ethmac_s *priv, +static void rx65n_disableint(struct rx65n_ethmac_s *priv, uint32_t ierbit) { uint32_t regval; @@ -1230,8 +1229,8 @@ static void rx65n_disableint(FAR struct rx65n_ethmac_s *priv, * ****************************************************************************/ -static void rx65n_freesegment(FAR struct rx65n_ethmac_s *priv, - FAR struct eth_rxdesc_s *rxfirst, int segments) +static void rx65n_freesegment(struct rx65n_ethmac_s *priv, + struct eth_rxdesc_s *rxfirst, int segments) { struct eth_rxdesc_s *rxdesc; int i; @@ -1294,7 +1293,7 @@ static void rx65n_freesegment(FAR struct rx65n_ethmac_s *priv, * ****************************************************************************/ -static int rx65n_recvframe(FAR struct rx65n_ethmac_s *priv) +static int rx65n_recvframe(struct rx65n_ethmac_s *priv) { struct eth_rxdesc_s *rxdesc; struct eth_rxdesc_s *rxcurr; @@ -1430,7 +1429,7 @@ static int rx65n_recvframe(FAR struct rx65n_ethmac_s *priv) */ nerr("ERROR: Dropped, RX descriptor errors: %08" PRIx32 "\n", - rxdesc->rdes0); + rxdesc->rdes0); rx65n_freesegment(priv, rxcurr, priv->segments); } } @@ -1470,7 +1469,7 @@ static int rx65n_recvframe(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_receive(FAR struct rx65n_ethmac_s *priv) +static void rx65n_receive(struct rx65n_ethmac_s *priv) { struct net_driver_s *dev = &priv->dev; @@ -1594,7 +1593,7 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s *priv) { nerr("ERROR: Dropped, Unknown type: %04x\n", BUF->type); #if defined(CONFIG_NETDEV_STATISTICS) - (priv->dev.d_statistics.rx_dropped)++; + (priv->dev.d_statistics.rx_dropped)++; #endif } @@ -1632,7 +1631,7 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_freeframe(FAR struct rx65n_ethmac_s *priv) +static void rx65n_freeframe(struct rx65n_ethmac_s *priv) { struct eth_txdesc_s *txdesc; int i; @@ -1735,7 +1734,7 @@ static void rx65n_freeframe(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_txdone(FAR struct rx65n_ethmac_s *priv) +static void rx65n_txdone(struct rx65n_ethmac_s *priv) { DEBUGASSERT(priv->txtail != NULL); @@ -1749,7 +1748,7 @@ static void rx65n_txdone(FAR struct rx65n_ethmac_s *priv) { /* Cancel the TX timeout */ - rx65n_cmtw0_stop(rx65n_cmtw0_timeout); + rx65n_cmtw0_stop(rx65n_cmtw0_timeout); /* And disable further TX interrupts. */ @@ -1778,9 +1777,9 @@ static void rx65n_txdone(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_interrupt_work(FAR void *arg) +static void rx65n_interrupt_work(void *arg) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)arg; uint32_t edmasr; uint32_t regval; @@ -1902,9 +1901,9 @@ static void rx65n_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int rx65n_interrupt(int irq, FAR void *context, FAR void *arg) +static int rx65n_interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_ethmac_s *priv = &g_rx65nethmac[0]; + struct rx65n_ethmac_s *priv = &g_rx65nethmac[0]; uint32_t edmasr; /* Get the interrupt status bits (ETHERC/EDMAC interrupt status check ) */ @@ -1956,9 +1955,9 @@ static int rx65n_interrupt(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -static void rx65n_txtimeout_work(FAR void *arg) +static void rx65n_txtimeout_work(void *arg) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)arg; /* Reset the hardware.Just take the interface down, then back up again. */ @@ -2000,7 +1999,7 @@ static void rx65n_txtimeout_work(FAR void *arg) void rx65n_txtimeout_expiry(wdparm_t arg) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)arg; nerr("ERROR: Timeout!\n"); /* Disable further Ethernet interrupts. This will prevent some race @@ -2039,8 +2038,7 @@ void rx65n_txtimeout_expiry(wdparm_t arg) static int rx65n_ifup(struct net_driver_s *dev) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> - d_private; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private; int ret; #ifdef CONFIG_NET_IPv4 @@ -2095,8 +2093,7 @@ static int rx65n_ifup(struct net_driver_s *dev) static int rx65n_ifdown(struct net_driver_s *dev) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> - d_private; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private; irqstate_t flags; int ret = OK; ninfo("Taking the network down\n"); @@ -2149,9 +2146,9 @@ static int rx65n_ifdown(struct net_driver_s *dev) * ****************************************************************************/ -static void rx65n_txavail_work(FAR void *arg) +static void rx65n_txavail_work(void *arg) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)arg; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)arg; ninfo("ifup: %d\n", priv->ifup); @@ -2189,8 +2186,7 @@ static void rx65n_txavail_work(FAR void *arg) static int rx65n_txavail(struct net_driver_s *dev) { - FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> - d_private; + struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private; /* Is our single work structure available? * It may not be if there are @@ -2227,7 +2223,7 @@ static int rx65n_txavail(struct net_driver_s *dev) ****************************************************************************/ #if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6) -static int rx65n_addmac(struct net_driver_s *dev, FAR const uint8_t *mac) +static int rx65n_addmac(struct net_driver_s *dev, const uint8_t *mac) { ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); @@ -2260,7 +2256,7 @@ static int rx65n_addmac(struct net_driver_s *dev, FAR const uint8_t *mac) ****************************************************************************/ #ifdef CONFIG_NET_MCASTGROUP -static int rx65n_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) +static int rx65n_rmmac(struct net_driver_s *dev, const uint8_t *mac) { ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); @@ -2290,7 +2286,7 @@ static int rx65n_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) * ****************************************************************************/ -static void rx65n_txdescinit(FAR struct rx65n_ethmac_s *priv) +static void rx65n_txdescinit(struct rx65n_ethmac_s *priv) { struct eth_txdesc_s *txdesc; int i; @@ -2372,7 +2368,7 @@ static void rx65n_txdescinit(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_rxdescinit(FAR struct rx65n_ethmac_s *priv) +static void rx65n_rxdescinit(struct rx65n_ethmac_s *priv) { struct eth_rxdesc_s *rxdesc; int i; @@ -2626,7 +2622,7 @@ static void rx65n_phyintenable(bool enable) ****************************************************************************/ #if defined(CONFIG_ARCH_PHY_INTERRUPT) -int arch_phy_irq(FAR const char *intf, xcpt_t handler, void *arg, +int arch_phy_irq(const char *intf, xcpt_t handler, void *arg, phy_enable_t *enable) { /* Using ET0_LINKSTA for PHY interrupt line which is connected to ETHERC. @@ -2694,7 +2690,7 @@ int arch_phy_irq(FAR const char *intf, xcpt_t handler, void *arg, * Return Value : none ****************************************************************************/ -void phy_start_autonegotiate (uint8_t pause) +void phy_start_autonegotiate(uint8_t pause) { volatile uint16_t regval = 0; @@ -2829,7 +2825,7 @@ void rx65n_ether_set_phy_mode(uint8_t mode) * Return Value : none ****************************************************************************/ -static void phy_reg_read (uint16_t *pdata) +static void phy_reg_read(uint16_t *pdata) { int32_t databitcnt = 0; int32_t j; @@ -2895,8 +2891,8 @@ static void phy_reg_read (uint16_t *pdata) * Return Value : read value ****************************************************************************/ -static uint16_t rx65n_phyread (uint8_t phydevaddr, uint16_t reg_addr, - uint16_t *value) +static uint16_t rx65n_phyread(uint8_t phydevaddr, uint16_t reg_addr, + uint16_t *value) { uint16_t data; @@ -2961,7 +2957,7 @@ void rx65n_ether_enable_icu(void) * Return Value : none ****************************************************************************/ -static void rx65n_phy_trans_zto0 () +static void rx65n_phy_trans_zto0(void) { int32_t j; @@ -3004,7 +3000,7 @@ static void rx65n_phy_trans_zto0 () * Return Value : none ****************************************************************************/ -static void rx65n_phy_trans_1to0 () +static void rx65n_phy_trans_1to0(void) { /* The processing of TA (turnaround) about writing of the frame format * of MII Management Interface which is @@ -3027,8 +3023,8 @@ static void rx65n_phy_trans_1to0 () * Return Value : none ****************************************************************************/ -static void rx65n_phy_reg_set (uint8_t phydevaddr, uint16_t reg_addr, - int32_t option) +static void rx65n_phy_reg_set(uint8_t phydevaddr, uint16_t reg_addr, + int32_t option) { int32_t bitcnt = 0; uint16_t data; @@ -3079,7 +3075,7 @@ static void rx65n_phy_reg_set (uint8_t phydevaddr, uint16_t reg_addr, * Return Value : none ****************************************************************************/ -static void rx65n_phy_reg_write (uint16_t data) +static void rx65n_phy_reg_write(uint16_t data) { int32_t databitcnt = 0; @@ -3113,7 +3109,7 @@ static void rx65n_phy_reg_write (uint16_t data) * Return Value : none ****************************************************************************/ -static void rx65n_phy_mii_write1 () +static void rx65n_phy_mii_write1(void) { int32_t j; @@ -3310,7 +3306,7 @@ void rx65n_ether_interrupt_init(void) * ****************************************************************************/ -static int rx65n_phyinit(FAR struct rx65n_ethmac_s *priv) +static int rx65n_phyinit(struct rx65n_ethmac_s *priv) { uint32_t count; uint16_t reg; @@ -3418,7 +3414,7 @@ static int rx65n_phyinit(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv) +static int rx65n_ethreset(struct rx65n_ethmac_s *priv) { uint32_t regval; uint32_t retries; @@ -3498,7 +3494,7 @@ static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv) +static int rx65n_macconfig(struct rx65n_ethmac_s *priv) { uint32_t regval; uint32_t retries; @@ -3552,9 +3548,9 @@ static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv) +static void rx65n_macaddress(struct rx65n_ethmac_s *priv) { - FAR struct net_driver_s *dev = &priv->dev; + struct net_driver_s *dev = &priv->dev; uint32_t regval; regval = 0; @@ -3599,7 +3595,7 @@ static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv) * ****************************************************************************/ -static int rx65n_ethconfig(FAR struct rx65n_ethmac_s *priv) +static int rx65n_ethconfig(struct rx65n_ethmac_s *priv) { int ret; uint32_t regval; diff --git a/arch/renesas/src/rx65n/rx65n_riic.c b/arch/renesas/src/rx65n/rx65n_riic.c index 2643ea302c..f70954f3dd 100644 --- a/arch/renesas/src/rx65n/rx65n_riic.c +++ b/arch/renesas/src/rx65n/rx65n_riic.c @@ -129,76 +129,64 @@ struct rx65n_i2c_priv_s * Private Function Prototypes ****************************************************************************/ -static int rx65n_riic_iicrst(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_setclock(FAR struct rx65n_i2c_priv_s *priv, - uint32_t frequency); -static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv); -static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_restartcond(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_send_slv_addr(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_after_send_slvadr(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_master_transmit(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_master_receive(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_stopcond(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_advance(FAR struct rx65n_i2c_priv_s *priv); -static uint8_t rx65n_riic_read_data(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_wait_set(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_pre_end_set(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_end_set(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_nack(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_set_sending_data(FAR struct rx65n_i2c_priv_s *priv, \ - uint8_t data); -static int rx65n_riic_after_stop(FAR struct rx65n_i2c_priv_s *priv); -static bool rx65n_riic_check_bus_busy(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_set_icier(FAR struct rx65n_i2c_priv_s *priv, \ - uint8_t value); -static void rx65n_riic_timeout(FAR struct rx65n_i2c_priv_s *priv); +static int rx65n_riic_iicrst(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_setclock(struct rx65n_i2c_priv_s *priv, + uint32_t frequency); +static void rx65n_riic_init(struct rx65n_i2c_priv_s *priv); +static int rx65n_riic_startcond(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_restartcond(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_send_slv_addr(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_after_send_slvadr(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_master_transmit(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_master_receive(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_stopcond(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_advance(struct rx65n_i2c_priv_s *priv); +static uint8_t rx65n_riic_read_data(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_wait_set(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_pre_end_set(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_end_set(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_nack(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_set_sending_data(struct rx65n_i2c_priv_s *priv, + uint8_t data); +static int rx65n_riic_after_stop(struct rx65n_i2c_priv_s *priv); +static bool rx65n_riic_check_bus_busy(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_set_icier(struct rx65n_i2c_priv_s *priv, + uint8_t value); +static void rx65n_riic_timeout(struct rx65n_i2c_priv_s *priv); /* RIIC Interrupt Handling */ -static void rx65n_riic_int_disable(FAR struct rx65n_i2c_priv_s *priv); -static void rx65n_riic_int_enable(FAR struct rx65n_i2c_priv_s *priv); -static int rx65n_riic_irq_init(FAR struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_int_disable(struct rx65n_i2c_priv_s *priv); +static void rx65n_riic_int_enable(struct rx65n_i2c_priv_s *priv); +static int rx65n_riic_irq_init(struct rx65n_i2c_priv_s *priv); /* RIIC0 Channel Interrupt Handling */ -static int rx65n_riic_rxi0interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_txi0interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_eei0interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_tei0interrupt(int irq, - FAR void *context, FAR void *arg); +static int rx65n_riic_rxi0interrupt(int irq, void *context, void *arg); +static int rx65n_riic_txi0interrupt(int irq, oid *context, void *arg); +static int rx65n_riic_eei0interrupt(int irq, void *context, void *arg); +static int rx65n_riic_tei0interrupt(int irq, void *context, void *arg); /* RIIC1 Channel Interrupt Handling */ -static int rx65n_riic_rxi1interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_txi1interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_eei1interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_tei1interrupt(int irq, - FAR void *context, FAR void *arg); +static int rx65n_riic_rxi1interrupt(int irq, void *context, void *arg); +static int rx65n_riic_txi1interrupt(int irq, void *context, void *arg); +static int rx65n_riic_eei1interrupt(int irq, void *context, void *arg); +static int rx65n_riic_tei1interrupt(int irq, void *context, void *arg); /* RIIC2 Channel Interrupt Handling */ -static int rx65n_riic_rxi2interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_txi2interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_eei2interrupt(int irq, - FAR void *context, FAR void *arg); -static int rx65n_riic_tei2interrupt(int irq, - FAR void *context, FAR void *arg); +static int rx65n_riic_rxi2interrupt(int irq, void *context, void *arg); +static int rx65n_riic_txi2interrupt(int irq, void *context, void *arg); +static int rx65n_riic_eei2interrupt(int irq, void *context, void *arg); +static int rx65n_riic_tei2interrupt(int irq, void *context, void *arg); /* I2C operations */ -static int rx65n_i2c_transfer(FAR struct i2c_master_s *dev, \ - FAR struct i2c_msg_s *msgs, int count); +static int rx65n_i2c_transfer(struct i2c_master_s *dev, + struct i2c_msg_s *msgs, int count); #ifdef CONFIG_I2C_RESET -static int rx65n_i2c_reset(FAR struct i2c_master_s *dev); +static int rx65n_i2c_reset(struct i2c_master_s *dev); #endif /**************************************************************************** @@ -378,7 +366,7 @@ static void riic_mpc_disable(void) * Disable writing to registers ****************************************************************************/ -static int rx65n_riic_iicrst(FAR struct rx65n_i2c_priv_s *priv) +static int rx65n_riic_iicrst(struct rx65n_i2c_priv_s *priv) { uint8_t regval; @@ -432,8 +420,8 @@ static int rx65n_riic_iicrst(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_set_icier(FAR struct rx65n_i2c_priv_s *priv, \ - uint8_t value) +static void rx65n_riic_set_icier(struct rx65n_i2c_priv_s *priv, + uint8_t value) { uint8_t regval; regval = (value | RX65N_RIIC_ICIER_TMO); @@ -465,8 +453,8 @@ static void rx65n_riic_set_icier(FAR struct rx65n_i2c_priv_s *priv, \ * ****************************************************************************/ -static void rx65n_riic_setclock(FAR struct rx65n_i2c_priv_s *priv, - uint32_t frequency) +static void rx65n_riic_setclock(struct rx65n_i2c_priv_s *priv, + uint32_t frequency) { /* Divider array of RIIC clock */ @@ -498,7 +486,7 @@ static void rx65n_riic_setclock(FAR struct rx65n_i2c_priv_s *priv, */ l_time = 0.5E-6; - h_time = (((1.0 / frequency) - l_time) - SCL_RISE_TIME_FASTPLUS) \ + h_time = (((1.0 / frequency) - l_time) - SCL_RISE_TIME_FASTPLUS) - SCL_FALL_TIME_FASTPLUS; } @@ -521,7 +509,7 @@ static void rx65n_riic_setclock(FAR struct rx65n_i2c_priv_s *priv, */ l_time = 1.3E-6; - h_time = (((1.0 / frequency) - l_time) - SCL_RISE_TIME_FAST) \ + h_time = (((1.0 / frequency) - l_time) - SCL_RISE_TIME_FAST) - SCL_FALL_TIME_FAST; } @@ -660,7 +648,7 @@ static void rx65n_riic_setclock(FAR struct rx65n_i2c_priv_s *priv, * ****************************************************************************/ -static void rx65n_riic_int_enable(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_int_enable(struct rx65n_i2c_priv_s *priv) { up_enable_irq(priv->dev->txi_irq); up_enable_irq(priv->dev->rxi_irq); @@ -676,7 +664,7 @@ static void rx65n_riic_int_enable(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_int_disable(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_int_disable(struct rx65n_i2c_priv_s *priv) { up_disable_irq(priv->dev->txi_irq); up_disable_irq(priv->dev->rxi_irq); @@ -692,7 +680,7 @@ static void rx65n_riic_int_disable(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static int rx65n_riic_irq_init(FAR struct rx65n_i2c_priv_s *priv) +static int rx65n_riic_irq_init(struct rx65n_i2c_priv_s *priv) { int ret; @@ -756,7 +744,7 @@ static int rx65n_riic_irq_init(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_init(struct rx65n_i2c_priv_s *priv) { uint8_t regval; @@ -814,19 +802,19 @@ static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv) switch (CONFIG_RX65N_RIIC0_NF_STAGE) { case 1: - regval |= RX65N_RIIC_ICMR3_NF1; - break; + regval |= RX65N_RIIC_ICMR3_NF1; + break; case 2: - regval |= RX65N_RIIC_ICMR3_NF2; - break; + regval |= RX65N_RIIC_ICMR3_NF2; + break; case 3: - regval |= RX65N_RIIC_ICMR3_NF3; - break; + regval |= RX65N_RIIC_ICMR3_NF3; + break; case 4: - regval |= RX65N_RIIC_ICMR3_NF4; + regval |= RX65N_RIIC_ICMR3_NF4; break; } @@ -935,19 +923,19 @@ static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv) switch (CONFIG_RX65N_RIIC1_NF_STAGE) { case 1: - regval |= RX65N_RIIC_ICMR3_NF1; - break; + regval |= RX65N_RIIC_ICMR3_NF1; + break; case 2: - regval |= RX65N_RIIC_ICMR3_NF2; - break; + regval |= RX65N_RIIC_ICMR3_NF2; + break; case 3: - regval |= RX65N_RIIC_ICMR3_NF3; - break; + regval |= RX65N_RIIC_ICMR3_NF3; + break; case 4: - regval |= RX65N_RIIC_ICMR3_NF4; + regval |= RX65N_RIIC_ICMR3_NF4; break; } @@ -1056,21 +1044,21 @@ static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv) switch (CONFIG_RX65N_RIIC2_NF_STAGE) { case 1: - regval |= RX65N_RIIC_ICMR3_NF1; - break; + regval |= RX65N_RIIC_ICMR3_NF1; + break; case 2: - regval |= RX65N_RIIC_ICMR3_NF2; - break; + regval |= RX65N_RIIC_ICMR3_NF2; + break; case 3: - regval |= RX65N_RIIC_ICMR3_NF3; - break; + regval |= RX65N_RIIC_ICMR3_NF3; + break; case 4: - regval |= RX65N_RIIC_ICMR3_NF4; - break; - } + regval |= RX65N_RIIC_ICMR3_NF4; + break; + } rx65n_putreg(regval, RX65N_RIIC2_ICMR3); #endif @@ -1143,8 +1131,8 @@ static void rx65n_riic_init(FAR struct rx65n_i2c_priv_s *priv) * Return Value : None ****************************************************************************/ -static void rx65n_riic_set_sending_data (FAR struct rx65n_i2c_priv_s *priv, \ - uint8_t data) +static void rx65n_riic_set_sending_data(struct rx65n_i2c_priv_s *priv, + uint8_t data) { if (0 == priv->bus) { @@ -1191,7 +1179,7 @@ static void rx65n_riic_set_sending_data (FAR struct rx65n_i2c_priv_s *priv, \ * ****************************************************************************/ -static void rx65n_riic_advance(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_advance(struct rx65n_i2c_priv_s *priv) { int ret; @@ -1257,7 +1245,7 @@ static void rx65n_riic_advance(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_nack(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_nack(struct rx65n_i2c_priv_s *priv) { rx65n_riic_set_icier(priv, RX65N_RIIC_ICIER_SP_AL); @@ -1278,7 +1266,7 @@ static void rx65n_riic_nack(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_timeout(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_timeout(struct rx65n_i2c_priv_s *priv) { priv->mode = RIIC_FINISH; } @@ -1291,7 +1279,7 @@ static void rx65n_riic_timeout(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static int rx65n_riic_after_stop(FAR struct rx65n_i2c_priv_s *priv) +static int rx65n_riic_after_stop(struct rx65n_i2c_priv_s *priv) { int ret; bool bus; @@ -1327,7 +1315,7 @@ static int rx65n_riic_after_stop(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static bool rx65n_riic_check_bus_busy(FAR struct rx65n_i2c_priv_s *priv) +static bool rx65n_riic_check_bus_busy(struct rx65n_i2c_priv_s *priv) { int i; bool bus_state = RIIC_BUS_BUSY; @@ -1382,7 +1370,7 @@ static bool rx65n_riic_check_bus_busy(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv) +static int rx65n_riic_startcond(struct rx65n_i2c_priv_s *priv) { uint8_t regval; int ret = RIIC_SUCCESS; @@ -1401,7 +1389,7 @@ static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv) rx65n_putreg(regval, RX65N_RIIC0_ICSR2); regval = rx65n_getreg(RX65N_RIIC0_ICSR2); - while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || \ + while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || (regval & RX65N_RIIC_ICSR2_STOP_SET))) { regval = rx65n_getreg(RX65N_RIIC0_ICSR2); @@ -1462,7 +1450,7 @@ static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv) rx65n_putreg(regval, RX65N_RIIC1_ICSR2); regval = rx65n_getreg(RX65N_RIIC1_ICSR2); - while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || \ + while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || (regval & RX65N_RIIC_ICSR2_STOP_SET))) { regval = rx65n_getreg(RX65N_RIIC1_ICSR2); @@ -1512,7 +1500,7 @@ static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv) rx65n_putreg(regval, RX65N_RIIC2_ICSR2); regval = rx65n_getreg(RX65N_RIIC2_ICSR2); - while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || \ + while (0x00 != ((regval & RX65N_RIIC_ICSR2_START_SET) || (regval & RX65N_RIIC_ICSR2_STOP_SET))) { regval = rx65n_getreg(RX65N_RIIC2_ICSR2); @@ -1562,7 +1550,7 @@ static int rx65n_riic_startcond(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_restartcond(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_restartcond(struct rx65n_i2c_priv_s *priv) { uint8_t regval; @@ -1629,7 +1617,7 @@ static void rx65n_riic_restartcond(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_send_slv_addr(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_send_slv_addr(struct rx65n_i2c_priv_s *priv) { uint16_t bit_addr; uint8_t regval; @@ -1696,7 +1684,7 @@ static void rx65n_riic_send_slv_addr(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_after_send_slvadr(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_after_send_slvadr(struct rx65n_i2c_priv_s *priv) { uint8_t regval; uint8_t *data; @@ -1801,7 +1789,7 @@ static void rx65n_riic_after_send_slvadr(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_stopcond(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_stopcond(struct rx65n_i2c_priv_s *priv) { uint8_t regval; @@ -1869,7 +1857,7 @@ static void rx65n_riic_stopcond(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_master_transmit(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_master_transmit(struct rx65n_i2c_priv_s *priv) { uint8_t regval; uint8_t *data; @@ -1935,7 +1923,7 @@ static void rx65n_riic_master_transmit(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static uint8_t rx65n_riic_read_data(FAR struct rx65n_i2c_priv_s *priv) +static uint8_t rx65n_riic_read_data(struct rx65n_i2c_priv_s *priv) { volatile uint8_t * regval; @@ -1966,7 +1954,7 @@ static uint8_t rx65n_riic_read_data(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_wait_set(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_wait_set(struct rx65n_i2c_priv_s *priv) { uint8_t regval; @@ -2010,7 +1998,7 @@ static void rx65n_riic_wait_set(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_pre_end_set(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_pre_end_set(struct rx65n_i2c_priv_s *priv) { if (0 == priv->bus) { @@ -2058,7 +2046,7 @@ static void rx65n_riic_pre_end_set(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_end_set(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_end_set(struct rx65n_i2c_priv_s *priv) { if (0 == priv->bus) { @@ -2105,7 +2093,7 @@ static void rx65n_riic_end_set(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static void rx65n_riic_master_receive(FAR struct rx65n_i2c_priv_s *priv) +static void rx65n_riic_master_receive(struct rx65n_i2c_priv_s *priv) { uint8_t regval; priv->dev_sts = RIIC_STS_RECEIVE_DATA_WAIT; @@ -2171,10 +2159,9 @@ static void rx65n_riic_master_receive(FAR struct rx65n_i2c_priv_s *priv) * ****************************************************************************/ -static int rx65n_riic_rxi0interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_rxi0interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; priv->event = RIIC_EV_INT_RECEIVE; @@ -2195,10 +2182,9 @@ static int rx65n_riic_rxi0interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_rxi1interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_rxi1interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; priv->event = RIIC_EV_INT_RECEIVE; @@ -2219,10 +2205,9 @@ static int rx65n_riic_rxi1interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_rxi2interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_rxi2interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; priv->event = RIIC_EV_INT_RECEIVE; rx65n_riic_advance(priv); @@ -2240,10 +2225,9 @@ static int rx65n_riic_rxi2interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_txi0interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_txi0interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Ideally, should never get here as this interrupt only occurs during * Multi-master mode of operation and @@ -2267,10 +2251,9 @@ static int rx65n_riic_txi0interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_txi1interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_txi1interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Ideally, should never get here as this interrupt only occurs during * Multi-master mode of operation and @@ -2294,10 +2277,9 @@ static int rx65n_riic_txi1interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_txi2interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_txi2interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Ideally, should never get here as this interrupt only occurs during * Multi-master mode of operation and @@ -2321,10 +2303,9 @@ static int rx65n_riic_txi2interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_tei0interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_tei0interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; RIIC0.ICSR2.BIT.TEND = 0U; while (0U != RIIC0.ICSR2.BIT.TEND) @@ -2362,10 +2343,9 @@ static int rx65n_riic_tei0interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_tei1interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_tei1interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; RIIC1.ICSR2.BIT.TEND = 0U; while (0U != RIIC1.ICSR2.BIT.TEND) @@ -2399,10 +2379,9 @@ static int rx65n_riic_tei1interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_tei2interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_tei2interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; RIIC2.ICSR2.BIT.TEND = 0U; while (0U != RIIC2.ICSR2.BIT.TEND) @@ -2441,10 +2420,9 @@ static int rx65n_riic_tei2interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_eei0interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_eei0interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Check Timeout Condition */ @@ -2483,7 +2461,7 @@ static int rx65n_riic_eei0interrupt(int irq, FAR void *context, \ RIIC0.ICMR3.BIT.ACKBT = 0U; RIIC0.ICMR3.BIT.ACKWP = 0U; - while ((0U != RIIC0.ICMR3.BIT.RDRFS) || \ + while ((0U != RIIC0.ICMR3.BIT.RDRFS) || (0U != RIIC0.ICMR3.BIT.ACKBT)) { /* Do Nothing */ @@ -2515,7 +2493,7 @@ static int rx65n_riic_eei0interrupt(int irq, FAR void *context, \ RIIC0.ICIER.BIT.TIE = 0U; RIIC0.ICIER.BIT.RIE = 0U; - while (((0U != RIIC0.ICIER.BIT.TEIE) || \ + while (((0U != RIIC0.ICIER.BIT.TEIE) || (0U != RIIC0.ICIER.BIT.TIE)) || (0U != RIIC0.ICIER.BIT.RIE)) { /* Do Nothing */ @@ -2535,7 +2513,7 @@ static int rx65n_riic_eei0interrupt(int irq, FAR void *context, \ { RIIC0.ICIER.BIT.STIE = 0U; RIIC0.ICSR2.BIT.START = 0U; - while ((0U != RIIC0.ICSR2.BIT.START) || \ + while ((0U != RIIC0.ICSR2.BIT.START) || (0U != RIIC0.ICIER.BIT.STIE)) { /* Wait till reset is completed */ @@ -2566,10 +2544,9 @@ static int rx65n_riic_eei0interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_eei1interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_eei1interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Check Timeout Condition */ @@ -2607,7 +2584,7 @@ static int rx65n_riic_eei1interrupt(int irq, FAR void *context, \ RIIC1.ICMR3.BIT.ACKBT = 0U; RIIC1.ICMR3.BIT.ACKWP = 0U; - while ((0U != RIIC1.ICMR3.BIT.RDRFS) || \ + while ((0U != RIIC1.ICMR3.BIT.RDRFS) || (0U != RIIC1.ICMR3.BIT.ACKBT)) { /* Do Nothing */ @@ -2639,7 +2616,7 @@ static int rx65n_riic_eei1interrupt(int irq, FAR void *context, \ RIIC1.ICIER.BIT.TIE = 0U; RIIC1.ICIER.BIT.RIE = 0U; - while (((0U != RIIC1.ICIER.BIT.TEIE) || \ + while (((0U != RIIC1.ICIER.BIT.TEIE) || (0U != RIIC1.ICIER.BIT.TIE)) || (0U != RIIC1.ICIER.BIT.RIE)) { /* Do Nothing */ @@ -2687,10 +2664,9 @@ static int rx65n_riic_eei1interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_riic_eei2interrupt(int irq, FAR void *context, \ - FAR void *arg) +static int rx65n_riic_eei2interrupt(int irq, void *context, void *arg) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)arg; /* Check Timeout Condition */ @@ -2729,7 +2705,7 @@ static int rx65n_riic_eei2interrupt(int irq, FAR void *context, \ RIIC2.ICMR3.BIT.ACKBT = 0U; RIIC2.ICMR3.BIT.ACKWP = 0U; - while ((0U != RIIC2.ICMR3.BIT.RDRFS) || \ + while ((0U != RIIC2.ICMR3.BIT.RDRFS) || (0U != RIIC2.ICMR3.BIT.ACKBT)) { /* Do Nothing */ @@ -2761,7 +2737,7 @@ static int rx65n_riic_eei2interrupt(int irq, FAR void *context, \ RIIC2.ICIER.BIT.TIE = 0U; RIIC2.ICIER.BIT.RIE = 0U; - while (((0U != RIIC2.ICIER.BIT.TEIE) || \ + while (((0U != RIIC2.ICIER.BIT.TEIE) || (0U != RIIC2.ICIER.BIT.TIE)) || (0U != RIIC2.ICIER.BIT.RIE)) { /* Do Nothing */ @@ -2781,7 +2757,7 @@ static int rx65n_riic_eei2interrupt(int irq, FAR void *context, \ { RIIC2.ICIER.BIT.STIE = 0U; RIIC2.ICSR2.BIT.START = 0U; - while ((0U != RIIC2.ICSR2.BIT.START) || \ + while ((0U != RIIC2.ICSR2.BIT.START) || (0U != RIIC2.ICIER.BIT.STIE)) { /* Wait till reset is completed */ @@ -2802,10 +2778,10 @@ static int rx65n_riic_eei2interrupt(int irq, FAR void *context, \ * ****************************************************************************/ -static int rx65n_i2c_transfer(FAR struct i2c_master_s *dev, \ - FAR struct i2c_msg_s *msgs, int count) +static int rx65n_i2c_transfer(struct i2c_master_s *dev, + struct i2c_msg_s *msgs, int count) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; int ret = 0; DEBUGASSERT(dev != NULL && msgs != NULL && count > 0); @@ -2973,9 +2949,9 @@ static int rx65n_i2c_transfer(FAR struct i2c_master_s *dev, \ ****************************************************************************/ #ifdef CONFIG_I2C_RESET -static int rx65n_i2c_reset(FAR struct i2c_master_s *dev) +static int rx65n_i2c_reset(struct i2c_master_s *dev) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; uint8_t regval; DEBUGASSERT(dev); @@ -3032,7 +3008,7 @@ static int rx65n_i2c_reset(FAR struct i2c_master_s *dev) * ****************************************************************************/ -FAR struct i2c_master_s *rx65n_i2cbus_initialize(int channel) +struct i2c_master_s *rx65n_i2cbus_initialize(int channel) { struct rx65n_i2c_priv_s *priv = NULL; @@ -3096,9 +3072,9 @@ FAR struct i2c_master_s *rx65n_i2cbus_initialize(int channel) * ****************************************************************************/ -int rx65n_i2cbus_uninitialize(FAR struct i2c_master_s *dev) +int rx65n_i2cbus_uninitialize(struct i2c_master_s *dev) { - FAR struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; + struct rx65n_i2c_priv_s *priv = (struct rx65n_i2c_priv_s *)dev; DEBUGASSERT(dev); diff --git a/arch/renesas/src/rx65n/rx65n_riic.h b/arch/renesas/src/rx65n/rx65n_riic.h index 5896677b8e..efa4e42717 100644 --- a/arch/renesas/src/rx65n/rx65n_riic.h +++ b/arch/renesas/src/rx65n/rx65n_riic.h @@ -73,7 +73,7 @@ * ****************************************************************************/ -FAR struct i2c_master_s *rx65n_i2cbus_initialize(int channel); +struct i2c_master_s *rx65n_i2cbus_initialize(int channel); /**************************************************************************** * Name: rx65n_i2cbus_uninitialize @@ -90,6 +90,6 @@ FAR struct i2c_master_s *rx65n_i2cbus_initialize(int channel); * ****************************************************************************/ -int rx65n_i2cbus_uninitialize(FAR struct i2c_master_s *dev); +int rx65n_i2cbus_uninitialize(struct i2c_master_s *dev); #endif /* __ARCH_RENESAS_SRC_RX65N_RX65N_RIIC_H */ diff --git a/arch/renesas/src/rx65n/rx65n_rspi.c b/arch/renesas/src/rx65n/rx65n_rspi.c index c4d92ba154..1a1e25f51f 100644 --- a/arch/renesas/src/rx65n/rx65n_rspi.c +++ b/arch/renesas/src/rx65n/rx65n_rspi.c @@ -184,17 +184,17 @@ struct rx65n_rspidev_s /* Helpers */ -static inline uint32_t rspi_getreg32(FAR struct rx65n_rspidev_s *priv, +static inline uint32_t rspi_getreg32(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline uint16_t rspi_getreg16(FAR struct rx65n_rspidev_s *priv, +static inline uint16_t rspi_getreg16(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline uint8_t rspi_getreg8(FAR struct rx65n_rspidev_s *priv, +static inline uint8_t rspi_getreg8(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline void rspi_putreg32(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg32(struct rx65n_rspidev_s *priv, uint8_t offset, uint32_t value); -static inline void rspi_putreg16(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg16(struct rx65n_rspidev_s *priv, uint8_t offset, uint16_t value); -static inline void rspi_putreg8(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg8(struct rx65n_rspidev_s *priv, uint8_t offset, uint8_t value); /* SPI data transfer */ @@ -218,41 +218,39 @@ static int rspi_transfer(struct rx65n_rspidev_s *priv, const void *txbuffer, #ifndef CONFIG_SPI_POLLWAIT static inline struct rx65n_rspidev_s *rspi_mapirq(int irq); -static int rspi_idlinterrupt(int irq, void *context, FAR void *arg); -static int rspi_erinterrupt(int irq, void *context, FAR void *arg); -static int rspi_txinterrupt(int irq, void *context, FAR void *arg); -static int rspi_rxinterrupt(int irq, void *context, FAR void *arg); +static int rspi_idlinterrupt(int irq, void *context, void *arg); +static int rspi_erinterrupt(int irq, void *context, void *arg); +static int rspi_txinterrupt(int irq, void *context, void *arg); +static int rspi_rxinterrupt(int irq, void *context, void *arg); #endif /* SPI methods */ -static int rspi_lock(FAR struct spi_dev_s *dev, bool lock); -static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, +static int rspi_lock(struct spi_dev_s *dev, bool lock); +static uint32_t rspi_setfrequency(struct spi_dev_s *dev, uint32_t frequency); -static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); -static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits); +static void rspi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode); +static void rspi_setbits(struct spi_dev_s *dev, int nbits); #ifdef CONFIG_SPI_HWFEATURES -static int rspi_hwfeatures(FAR struct spi_dev_s *dev, +static int rspi_hwfeatures(struct spi_dev_s *dev, spi_hwfeatures_t features); #endif -static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd); -static void rspi_exchange(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords); +static uint32_t rspi_send(struct spi_dev_s *dev, uint32_t wd); +static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer, + void *rxbuffer, size_t nwords); #ifdef CONFIG_SPI_TRIGGER -static int rspi_trigger(FAR struct spi_dev_s *dev); +static int rspi_trigger(struct spi_dev_s *dev); #endif #ifndef CONFIG_SPI_EXCHANGE -static void rspi_sndblock(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, +static void rspi_sndblock(struct spi_dev_s *dev, const void *txbuffer, size_t nwords); -static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, +static void rspi_recvblock(struct spi_dev_s *dev, void *rxbuffer, size_t nwords); #endif /* Initialization */ -static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv); +static void rspi_bus_initialize(struct rx65n_rspidev_s *priv); /**************************************************************************** * Private Data @@ -548,57 +546,57 @@ dtc_static_transfer_data_cfg_t rx_cfg = * ****************************************************************************/ #ifdef CONFIG_RX65N_RSPI0 -void rx65n_rspi0select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi0select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi0status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi0status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } #endif #ifdef CONFIG_RX65N_RSPI1 -void rx65n_rspi1select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi1select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi1status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi1status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } #endif #ifdef CONFIG_RX65N_RSPI2 -void rx65n_rspi2select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi2select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi2status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi2status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi2cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } @@ -625,9 +623,8 @@ int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) ****************************************************************************/ #ifdef CONFIG_SPI_CALLBACK #ifdef CONFIG_RX65N_RSPI0 -int rx65n_rspi0register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi0 device\n"); return OK; @@ -635,9 +632,8 @@ int rx65n_rspi0register(FAR struct spi_dev_s *dev, #endif #ifdef CONFIG_RX65N_RSPI1 -int rx65n_rspi1register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi1 device\n"); return OK; @@ -645,9 +641,8 @@ int rx65n_rspi1register(FAR struct spi_dev_s *dev, #endif #ifdef CONFIG_RX65N_RSPI2 -int rx65n_rspi2register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi2 device\n"); return OK; @@ -1017,9 +1012,9 @@ static void rspi_startxfr(struct rx65n_rspidev_s *priv) ****************************************************************************/ #ifdef CONFIG_RX65N_RSPI_DTC_DT_MODE -static dtc_err_t rspi_dtctxsetup(FAR struct rx65n_rspidev_s *priv, - FAR const void *txbuffer, - FAR const void *txdummy, size_t nwords) +static dtc_err_t rspi_dtctxsetup(struct rx65n_rspidev_s *priv, + const void *txbuffer, + const void *txdummy, size_t nwords) { dtc_err_t ret = DTC_SUCCESS; dtc_dynamic_transfer_data_cfg_t dcfg; @@ -1093,8 +1088,8 @@ static dtc_err_t rspi_dtctxsetup(FAR struct rx65n_rspidev_s *priv, * ****************************************************************************/ -static dtc_err_t rspi_dtcrxsetup(FAR struct rx65n_rspidev_s *priv, - FAR void *rxbuffer, FAR void *rxdummy, +static dtc_err_t rspi_dtcrxsetup(struct rx65n_rspidev_s *priv, + void *rxbuffer, void *rxdummy, size_t nwords) { dtc_err_t ret = DTC_SUCCESS; @@ -1508,7 +1503,7 @@ static void rspi_errhandle(struct rx65n_rspidev_s *priv, uint8_t bus) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_idlinterrupt(int irq, void *context, FAR void *arg) +static int rspi_idlinterrupt(int irq, void *context, void *arg) { uint8_t regval8; @@ -1551,7 +1546,7 @@ static int rspi_idlinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_erinterrupt(int irq, void *context, FAR void *arg) +static int rspi_erinterrupt(int irq, void *context, void *arg) { struct rx65n_rspidev_s *priv = rspi_mapirq(irq); @@ -1594,7 +1589,7 @@ static int rspi_erinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_rxinterrupt(int irq, void *context, FAR void *arg) +static int rspi_rxinterrupt(int irq, void *context, void *arg) { #ifdef CONFIG_RX65N_RSPI_DTC_DT_MODE uint8_t regval8; @@ -1647,7 +1642,7 @@ static int rspi_rxinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_txinterrupt(int irq, void *context, FAR void *arg) +static int rspi_txinterrupt(int irq, void *context, void *arg) { struct rx65n_rspidev_s *priv = rspi_mapirq(irq); @@ -1705,7 +1700,7 @@ static int rspi_txinterrupt(int irq, void *context, FAR void *arg) * ****************************************************************************/ -static int rspi_lock(FAR struct spi_dev_s *dev, bool lock) +static int rspi_lock(struct spi_dev_s *dev, bool lock) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; int ret; @@ -1737,7 +1732,7 @@ static int rspi_lock(FAR struct spi_dev_s *dev, bool lock) * ****************************************************************************/ -static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, +static uint32_t rspi_setfrequency(struct spi_dev_s *dev, uint32_t frequency) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -1837,7 +1832,7 @@ static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, * ****************************************************************************/ -static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) +static void rspi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -1900,7 +1895,7 @@ static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) * ****************************************************************************/ -static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits) +static void rspi_setbits(struct spi_dev_s *dev, int nbits) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; uint8_t regval8; @@ -1955,7 +1950,7 @@ static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits) * ****************************************************************************/ -static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd) +static uint32_t rspi_send(struct spi_dev_s *dev, uint32_t wd) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; uint32_t response = 0; @@ -1986,9 +1981,8 @@ static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd) ****************************************************************************/ #ifdef CONFIG_SPI_EXCHANGE -static void rspi_exchange(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords) +static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer, + void *rxbuffer, size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; rspi_transfer(priv, txbuffer, rxbuffer, nwords); @@ -2016,7 +2010,7 @@ static void rspi_exchange(FAR struct spi_dev_s *dev, ****************************************************************************/ #ifndef CONFIG_SPI_EXCHANGE -static void rspi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, +static void rspi_sndblock(struct spi_dev_s *dev, const void *buffer, size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -2045,7 +2039,7 @@ static void rspi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, ****************************************************************************/ #ifndef CONFIG_SPI_EXCHANGE -static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, +static void rspi_recvblock(struct spi_dev_s *dev, void *buffer, size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -2060,7 +2054,7 @@ static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Return Value : none ****************************************************************************/ -void rspi_interrupt_init(FAR struct rx65n_rspidev_s *priv, uint8_t bus) +void rspi_interrupt_init(struct rx65n_rspidev_s *priv, uint8_t bus) { /* Enable error interrupt source bit */ @@ -2214,7 +2208,7 @@ static void rspi_reg_protect(uint8_t enable) * ****************************************************************************/ -static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) +static void rspi_bus_initialize(struct rx65n_rspidev_s *priv) { uint8_t regval8; uint16_t regval16; @@ -2278,7 +2272,7 @@ static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) /* Select a default frequency of approx. 400KHz */ - rspi_setfrequency((FAR struct spi_dev_s *)priv, 400000); + rspi_setfrequency((struct spi_dev_s *)priv, 400000); /* Configure data control register SPDCR * Four frames can be transmitted or received in one round of transmission @@ -2424,9 +2418,9 @@ static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) * ****************************************************************************/ -FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus) +struct spi_dev_s *rx65n_rspibus_initialize(int bus) { - FAR struct rx65n_rspidev_s *priv = NULL; + struct rx65n_rspidev_s *priv = NULL; irqstate_t flags = enter_critical_section(); #ifdef CONFIG_RX65N_RSPI0 @@ -2534,7 +2528,7 @@ FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus) } leave_critical_section(flags); - return (FAR struct spi_dev_s *)priv; + return (struct spi_dev_s *)priv; } #endif /* CONFIG_RX65N_RSPI0 || CONFIG_RX65N_RSPI1 || CONFIG_RX65N_RSPI2 */ diff --git a/arch/renesas/src/rx65n/rx65n_rspi.h b/arch/renesas/src/rx65n/rx65n_rspi.h index 105acdd8b4..4aaa41700e 100644 --- a/arch/renesas/src/rx65n/rx65n_rspi.h +++ b/arch/renesas/src/rx65n/rx65n_rspi.h @@ -64,7 +64,7 @@ struct spi_dev_s; * ****************************************************************************/ -FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus); +struct spi_dev_s *rx65n_rspibus_initialize(int bus); /**************************************************************************** * Name: rx65n_rspi0/1/2 select and rx65n_rspi0/1/2 status @@ -98,24 +98,24 @@ FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus); * ****************************************************************************/ #ifdef CONFIG_RX65N_RSPI0 -void rx65n_rspi0select(FAR struct spi_dev_s *dev, uint32_t devid, - bool selected); -uint8_t rx65n_rspi0status(FAR struct spi_dev_s *dev, uint32_t devid); -int rx65n_rspi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +void rx65n_rspi0select(struct spi_dev_s *dev, uint32_t devid, + bool selected); +uint8_t rx65n_rspi0status(struct spi_dev_s *dev, uint32_t devid); +int rx65n_rspi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd); #endif #ifdef CONFIG_RX65N_RSPI1 -void rx65n_rspi1select(FAR struct spi_dev_s *dev, uint32_t devid, - bool selected); -uint8_t rx65n_rspi1status(FAR struct spi_dev_s *dev, uint32_t devid); -int rx65n_rspi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +void rx65n_rspi1select(struct spi_dev_s *dev, uint32_t devid, + bool selected); +uint8_t rx65n_rspi1status(struct spi_dev_s *dev, uint32_t devid); +int rx65n_rspi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd); #endif #ifdef CONFIG_RX65N_RSPI2 -void rx65n_rspi2select(FAR struct spi_dev_s *dev, uint32_t devid, - bool selected); -uint8_t rx65n_rspi2status(FAR struct spi_dev_s *dev, uint32_t devid); -int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); +void rx65n_rspi2select(struct spi_dev_s *dev, uint32_t devid, + bool selected); +uint8_t rx65n_rspi2status(struct spi_dev_s *dev, uint32_t devid); +int rx65n_rspi2cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd); #endif /**************************************************************************** @@ -140,21 +140,18 @@ int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd); #ifdef CONFIG_SPI_CALLBACK #ifdef CONFIG_RX65N_RSPI0 -int rx65n_rspi0register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg); +int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg); #endif #ifdef CONFIG_RX65N_RSPI1 -int rx65n_rspi1register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg); +int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg); #endif #ifdef CONFIG_RX65N_RSPI2 -int rx65n_rspi2register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg); +int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg); #endif #endif diff --git a/arch/renesas/src/rx65n/rx65n_rspi_sw.c b/arch/renesas/src/rx65n/rx65n_rspi_sw.c index 136b2b1c80..26bba4004d 100644 --- a/arch/renesas/src/rx65n/rx65n_rspi_sw.c +++ b/arch/renesas/src/rx65n/rx65n_rspi_sw.c @@ -173,17 +173,17 @@ struct rx65n_rspidev_s /* Helpers */ -static inline uint32_t rspi_getreg32(FAR struct rx65n_rspidev_s *priv, +static inline uint32_t rspi_getreg32(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline uint16_t rspi_getreg16(FAR struct rx65n_rspidev_s *priv, +static inline uint16_t rspi_getreg16(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline uint8_t rspi_getreg8(FAR struct rx65n_rspidev_s *priv, +static inline uint8_t rspi_getreg8(struct rx65n_rspidev_s *priv, uint8_t offset); -static inline void rspi_putreg32(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg32(struct rx65n_rspidev_s *priv, uint8_t offset, uint32_t value); -static inline void rspi_putreg16(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg16(struct rx65n_rspidev_s *priv, uint8_t offset, uint16_t value); -static inline void rspi_putreg8(FAR struct rx65n_rspidev_s *priv, +static inline void rspi_putreg8(struct rx65n_rspidev_s *priv, uint8_t offset, uint8_t value); /* SPI data transfer */ @@ -199,47 +199,45 @@ static void rspi_rxuint8(struct rx65n_rspidev_s *priv); static void rspi_performtx(struct rx65n_rspidev_s *priv); static inline void rspi_performrx(struct rx65n_rspidev_s *priv); static int rspi_transfer(struct rx65n_rspidev_s *priv, const void *txbuffer, - void *rxbuffer, unsigned int nwords); + void *rxbuffer, unsigned int nwords); /* Interrupt handling */ #ifndef CONFIG_SPI_POLLWAIT static inline struct rx65n_rspidev_s *rspi_mapirq(int irq); -static int rspi_idlinterrupt(int irq, void *context, FAR void *arg); -static int rspi_erinterrupt(int irq, void *context, FAR void *arg); -static int rspi_txinterrupt(int irq, void *context, FAR void *arg); -static int rspi_rxinterrupt(int irq, void *context, FAR void *arg); +static int rspi_idlinterrupt(int irq, void *context, void *arg); +static int rspi_erinterrupt(int irq, void *context, void *arg); +static int rspi_txinterrupt(int irq, void *context, void *arg); +static int rspi_rxinterrupt(int irq, void *context, void *arg); #endif /* SPI methods */ -static int rspi_lock(FAR struct spi_dev_s *dev, bool lock); -static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, +static int rspi_lock(struct spi_dev_s *dev, bool lock); +static uint32_t rspi_setfrequency(struct spi_dev_s *dev, uint32_t frequency); -static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); -static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits); +static void rspi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode); +static void rspi_setbits(struct spi_dev_s *dev, int nbits); #ifdef CONFIG_SPI_HWFEATURES -static int rspi_hwfeatures(FAR struct spi_dev_s *dev, - spi_hwfeatures_t features); +static int rspi_hwfeatures(struct spi_dev_s *dev, + spi_hwfeatures_t features); #endif -static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd); -static void rspi_exchange(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords); +static uint32_t rspi_send(struct spi_dev_s *dev, uint32_t wd); +static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer, + void *rxbuffer, size_t nwords); #ifdef CONFIG_SPI_TRIGGER -static int rspi_trigger(FAR struct spi_dev_s *dev); +static int rspi_trigger(struct spi_dev_s *dev); #endif #ifndef CONFIG_SPI_EXCHANGE -static void rspi_sndblock(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - size_t nwords); -static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *rxbuffer, - size_t nwords); +static void rspi_sndblock(struct spi_dev_s *dev, const void *txbuffer, + size_t nwords); +static void rspi_recvblock(struct spi_dev_s *dev, void *rxbuffer, + size_t nwords); #endif /* Initialization */ -static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv); +static void rspi_bus_initialize(struct rx65n_rspidev_s *priv); /**************************************************************************** * Private Data @@ -439,57 +437,57 @@ static struct rx65n_rspidev_s g_rspi2dev = * ****************************************************************************/ #ifdef CONFIG_RX65N_RSPI0 -void rx65n_rspi0select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi0select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi0status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi0status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } #endif #ifdef CONFIG_RX65N_RSPI1 -void rx65n_rspi1select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi1select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi1status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi1status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } #endif #ifdef CONFIG_RX65N_RSPI2 -void rx65n_rspi2select(FAR struct spi_dev_s *dev, uint32_t devid, +void rx65n_rspi2select(struct spi_dev_s *dev, uint32_t devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); } -uint8_t rx65n_rspi2status(FAR struct spi_dev_s *dev, uint32_t devid) +uint8_t rx65n_rspi2status(struct spi_dev_s *dev, uint32_t devid) { return 0; } -int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int rx65n_rspi2cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) { return -ENODEV; } @@ -516,9 +514,8 @@ int rx65n_rspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) ****************************************************************************/ #ifdef CONFIG_SPI_CALLBACK #ifdef CONFIG_RX65N_RSPI0 -int rx65n_rspi0register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi0 device\n"); return OK; @@ -526,9 +523,8 @@ int rx65n_rspi0register(FAR struct spi_dev_s *dev, #endif #ifdef CONFIG_RX65N_RSPI1 -int rx65n_rspi1register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi1 device\n"); return OK; @@ -536,9 +532,8 @@ int rx65n_rspi1register(FAR struct spi_dev_s *dev, #endif #ifdef CONFIG_RX65N_RSPI2 -int rx65n_rspi2register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, - FAR void *arg) +int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) { spiinfo("INFO: Registering rspi2 device\n"); return OK; @@ -630,7 +625,7 @@ static inline uint8_t rspi_getreg8(struct rx65n_rspidev_s *priv, ****************************************************************************/ static inline void rspi_putreg32(struct rx65n_rspidev_s *priv, - uint8_t offset, uint32_t value) + uint8_t offset, uint32_t value) { putreg32(value, priv->rspibase + offset); } @@ -652,7 +647,7 @@ static inline void rspi_putreg32(struct rx65n_rspidev_s *priv, ****************************************************************************/ static inline void rspi_putreg16(struct rx65n_rspidev_s *priv, - uint8_t offset, uint16_t value) + uint8_t offset, uint16_t value) { putreg16(value, priv->rspibase + offset); } @@ -674,7 +669,7 @@ static inline void rspi_putreg16(struct rx65n_rspidev_s *priv, ****************************************************************************/ static inline void rspi_putreg8(struct rx65n_rspidev_s *priv, - uint8_t offset, uint8_t value) + uint8_t offset, uint8_t value) { putreg8(value, priv->rspibase + offset); } @@ -912,7 +907,7 @@ static void rspi_startxfr(struct rx65n_rspidev_s *priv) ****************************************************************************/ static int rspi_transfer(struct rx65n_rspidev_s *priv, const void *txbuffer, - void *rxbuffer, unsigned int nwords) + void *rxbuffer, unsigned int nwords) { uint8_t regval8; #ifndef CONFIG_SPI_POLLWAIT @@ -1178,7 +1173,7 @@ static void rspi_errhandle(struct rx65n_rspidev_s *priv, uint8_t bus) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_idlinterrupt(int irq, void *context, FAR void *arg) +static int rspi_idlinterrupt(int irq, void *context, void *arg) { uint8_t regval8; @@ -1221,7 +1216,7 @@ static int rspi_idlinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_erinterrupt(int irq, void *context, FAR void *arg) +static int rspi_erinterrupt(int irq, void *context, void *arg) { struct rx65n_rspidev_s *priv = rspi_mapirq(irq); @@ -1264,7 +1259,7 @@ static int rspi_erinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_rxinterrupt(int irq, void *context, FAR void *arg) +static int rspi_rxinterrupt(int irq, void *context, void *arg) { struct rx65n_rspidev_s *priv = rspi_mapirq(irq); @@ -1299,7 +1294,7 @@ static int rspi_rxinterrupt(int irq, void *context, FAR void *arg) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int rspi_txinterrupt(int irq, void *context, FAR void *arg) +static int rspi_txinterrupt(int irq, void *context, void *arg) { struct rx65n_rspidev_s *priv = rspi_mapirq(irq); @@ -1334,7 +1329,7 @@ static int rspi_txinterrupt(int irq, void *context, FAR void *arg) * ****************************************************************************/ -static int rspi_lock(FAR struct spi_dev_s *dev, bool lock) +static int rspi_lock(struct spi_dev_s *dev, bool lock) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; int ret; @@ -1366,8 +1361,8 @@ static int rspi_lock(FAR struct spi_dev_s *dev, bool lock) * ****************************************************************************/ -static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, - uint32_t frequency) +static uint32_t rspi_setfrequency(struct spi_dev_s *dev, + uint32_t frequency) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; uint32_t actual; @@ -1466,7 +1461,7 @@ static uint32_t rspi_setfrequency(FAR struct spi_dev_s *dev, * ****************************************************************************/ -static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) +static void rspi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -1529,7 +1524,7 @@ static void rspi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) * ****************************************************************************/ -static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits) +static void rspi_setbits(struct spi_dev_s *dev, int nbits) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; @@ -1585,7 +1580,7 @@ static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits) * ****************************************************************************/ -static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd) +static uint32_t rspi_send(struct spi_dev_s *dev, uint32_t wd) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; uint32_t response = 0; @@ -1616,9 +1611,8 @@ static uint32_t rspi_send(FAR struct spi_dev_s *dev, uint32_t wd) ****************************************************************************/ #ifdef CONFIG_SPI_EXCHANGE -static void rspi_exchange(FAR struct spi_dev_s *dev, - FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords) +static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer, + void *rxbuffer, size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; rspi_transfer(priv, txbuffer, rxbuffer, nwords); @@ -1646,8 +1640,8 @@ static void rspi_exchange(FAR struct spi_dev_s *dev, ****************************************************************************/ #ifndef CONFIG_SPI_EXCHANGE -static void rspi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, - size_t nwords) +static void rspi_sndblock(struct spi_dev_s *dev, const void *buffer, + size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; rspi_transfer(priv, buffer, NULL, nwords); @@ -1675,8 +1669,8 @@ static void rspi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, ****************************************************************************/ #ifndef CONFIG_SPI_EXCHANGE -static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, - size_t nwords) +static void rspi_recvblock(struct spi_dev_s *dev, void *buffer, + size_t nwords) { struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; rspi_transfer(priv, NULL, buffer, nwords); @@ -1690,7 +1684,7 @@ static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, * Return Value : none ****************************************************************************/ -void rspi_interrupt_init(FAR struct rx65n_rspidev_s *priv, uint8_t bus) +void rspi_interrupt_init(struct rx65n_rspidev_s *priv, uint8_t bus) { /* Enable error interrupt source bit */ @@ -1844,7 +1838,7 @@ static void rspi_reg_protect(uint8_t enable) * ****************************************************************************/ -static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) +static void rspi_bus_initialize(struct rx65n_rspidev_s *priv) { uint8_t regval8; uint16_t regval16; @@ -1882,7 +1876,7 @@ static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) /* Select a default frequency of approx. 400KHz */ - rspi_setfrequency((FAR struct spi_dev_s *)priv, 400000); + rspi_setfrequency((struct spi_dev_s *)priv, 400000); /* Configure data control register SPDCR * Four frames can be transmitted or received in one round of transmission @@ -2028,9 +2022,9 @@ static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv) * ****************************************************************************/ -FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus) +struct spi_dev_s *rx65n_rspibus_initialize(int bus) { - FAR struct rx65n_rspidev_s *priv = NULL; + struct rx65n_rspidev_s *priv = NULL; irqstate_t flags = enter_critical_section(); @@ -2139,7 +2133,7 @@ FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus) } leave_critical_section(flags); - return (FAR struct spi_dev_s *)priv; + return (struct spi_dev_s *)priv; } #endif /* CONFIG_RX65N_RSPI0 || CONFIG_RX65N_RSPI1 || CONFIG_RX65N_RSPI2 */ diff --git a/arch/renesas/src/rx65n/rx65n_rtc.c b/arch/renesas/src/rx65n/rx65n_rtc.c index 17164ce616..0013df17f3 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc.c +++ b/arch/renesas/src/rx65n/rx65n_rtc.c @@ -83,7 +83,7 @@ static int rtc_bcd2dec(uint32_t value); struct alm_cbinfo_s { volatile alm_callback_t ac_cb; /* Client callback function */ - volatile FAR void *ac_arg; /* Argument to pass with the callback function */ + volatile void *ac_arg; /* Argument to pass with the callback function */ }; #endif @@ -93,7 +93,7 @@ struct alm_cbinfo_s struct prd_cbinfo_s { volatile periodiccb_t prd_cb; /* Client callback function */ - volatile FAR void *prd_arg; /* Argument to pass with the callback function */ + volatile void *prd_arg; /* Argument to pass with the callback function */ }; #endif @@ -148,7 +148,7 @@ volatile bool g_rtc_enabled = false; ****************************************************************************/ #ifdef CONFIG_DEBUG_RTC_INFO -static void rtc_dumpregs(FAR const char *msg) +static void rtc_dumpregs(const char *msg) { rtcinfo("%s:\n", msg); rtcinfo(" 64-Hz Counter: %08x\n", getreg8(RX65N_RTC_R64CNT)); @@ -191,7 +191,7 @@ static void rtc_dumpregs(FAR const char *msg) ****************************************************************************/ #ifdef CONFIG_DEBUG_RTC_INFO -static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg) +static void rtc_dumptime(struct tm *tp, const char *msg) { rtcinfo("%s:\n", msg); rtcinfo(" tm_sec: %08x\n", tp->tm_sec); @@ -261,9 +261,9 @@ static int rtc_bcd2dec(uint32_t value) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rtc_alm_interrupt(int irq, void *context, FAR void *arg) +static int rtc_alm_interrupt(int irq, void *context, void *arg) { - FAR struct alm_cbinfo_s *cbinfo; + struct alm_cbinfo_s *cbinfo; alm_callback_t cb; uint8_t source = rx65n_getreg(RX65N_RTC_RCR1); if ((source & RTC_ALARM_INT_ENABLE) != 0) @@ -272,7 +272,7 @@ static int rtc_alm_interrupt(int irq, void *context, FAR void *arg) cbinfo = &g_alarmcb; cb = cbinfo->ac_cb; - arg = (FAR void *)cbinfo->ac_arg; + arg = (void *)cbinfo->ac_arg; cbinfo->ac_cb = NULL; cbinfo->ac_arg = NULL; cb(arg, 0); @@ -284,9 +284,9 @@ static int rtc_alm_interrupt(int irq, void *context, FAR void *arg) #endif #ifdef CONFIG_RTC_PERIODIC -static int rtc_periodic_interrupt(int irq, void *context, FAR void *arg) +static int rtc_periodic_interrupt(int irq, void *context, void *arg) { - FAR struct prd_cbinfo_s *cbinfo; + struct prd_cbinfo_s *cbinfo; periodiccb_t cb; uint8_t source = rx65n_getreg(RX65N_RTC_RCR1); if ((source & RTC_PERIOD_INT_ENABLE) != 0) @@ -295,7 +295,7 @@ static int rtc_periodic_interrupt(int irq, void *context, FAR void *arg) cbinfo = &g_periodiccb; cb = cbinfo->prd_cb; - arg = (FAR void *)cbinfo->prd_arg; + arg = (void *)cbinfo->prd_arg; cb(arg, 0); } @@ -304,7 +304,7 @@ static int rtc_periodic_interrupt(int irq, void *context, FAR void *arg) #endif #ifdef CONFIG_RX65N_CARRY -static int rtc_carry_interrupt(int irq, void *context, FAR void *arg) +static int rtc_carry_interrupt(int irq, void *context, void *arg) { uint8_t source = rx65n_getreg(RX65N_RTC_RCR1); if ((source & RTC_CARRY_INT_ENABLE) != 0) @@ -457,7 +457,7 @@ int up_rtc_initialize(void) ****************************************************************************/ #if defined(CONFIG_RTC_HIRES) -int up_rtc_gettime(FAR struct timespec *tp) +int up_rtc_gettime(struct timespec *tp) { uint8_t weekcnt; uint8_t daycnt; @@ -543,7 +543,7 @@ int up_rtc_gettime(FAR struct timespec *tp) } #endif -int rx65n_rtc_setdatetime(FAR const struct tm *tp) +int rx65n_rtc_setdatetime(const struct tm *tp) { int i; volatile uint8_t dummy_byte; @@ -695,9 +695,9 @@ int rx65n_rtc_setdatetime(FAR const struct tm *tp) * ****************************************************************************/ -int up_rtc_settime(FAR const struct timespec *tp) +int up_rtc_settime(const struct timespec *tp) { - FAR struct tm newtime; + struct tm newtime; int i; volatile uint8_t dummy_byte; volatile uint16_t dummy_word; @@ -845,7 +845,7 @@ int up_rtc_settime(FAR const struct timespec *tp) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rx65n_rtc_getalarmdatetime(FAR struct tm *tp) +static int rx65n_rtc_getalarmdatetime(struct tm *tp) { uint8_t bcd_years; DEBUGASSERT(tp != NULL); @@ -880,7 +880,7 @@ static int rx65n_rtc_getalarmdatetime(FAR struct tm *tp) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -int rx65n_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo) +int rx65n_rtc_rdalarm(struct alm_rdalarm_s *alminfo) { int ret = -EINVAL; DEBUGASSERT(alminfo != NULL); @@ -905,7 +905,7 @@ int rx65n_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -int rx65n_rtc_setalarm(FAR struct alm_setalarm_s *alminfo) +int rx65n_rtc_setalarm(struct alm_setalarm_s *alminfo) { irqstate_t flags; uint8_t dummy_byte; @@ -1074,7 +1074,7 @@ int rx65n_rtc_setalarm(FAR struct alm_setalarm_s *alminfo) #endif #ifdef CONFIG_RTC_PERIODIC -int rx65n_rtc_setperiodic(FAR const struct timespec *period, +int rx65n_rtc_setperiodic(const struct timespec *period, periodiccb_t callback) { irqstate_t flags; @@ -1249,7 +1249,7 @@ int rx65n_rtc_cancelcarry(void) ****************************************************************************/ #ifdef CONFIG_RTC_DATETIME -int up_rtc_getdatetime(FAR struct tm *tp) +int up_rtc_getdatetime(struct tm *tp) { uint8_t weekcnt; uint8_t daycnt; diff --git a/arch/renesas/src/rx65n/rx65n_rtc.h b/arch/renesas/src/rx65n/rx65n_rtc.h index 85507a59f1..10059b0859 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc.h +++ b/arch/renesas/src/rx65n/rx65n_rtc.h @@ -44,7 +44,7 @@ /* The form of an alarm callback */ -typedef CODE void (*alm_callback_t)(FAR void *arg, unsigned int alarmid); +typedef void (*alm_callback_t)(void *arg, unsigned int alarmid); /* Structure used to pass parameters to set an alarm */ @@ -53,7 +53,7 @@ struct alm_setalarm_s int as_id; /* enum alm_id_e */ struct tm as_time; /* Alarm expiration time */ alm_callback_t as_cb; /* Callback (if non-NULL) */ - FAR void *as_arg; /* Argument for callback */ + void *as_arg; /* Argument for callback */ }; /* Structure used to pass parameters to query an alarm */ @@ -61,17 +61,17 @@ struct alm_setalarm_s struct alm_rdalarm_s { int ar_id; /* enum alm_id_e */ - FAR struct rtc_time *ar_time; /* Argument for storing ALARM RTC time */ + struct rtc_time *ar_time; /* Argument for storing ALARM RTC time */ }; #endif /* CONFIG_RTC_ALARM */ #ifdef CONFIG_RTC_PERIODIC -typedef CODE int (*periodiccb_t)(FAR void *arg, unsigned int alarmid); +typedef int (*periodiccb_t)(void *arg, unsigned int alarmid); #endif #ifdef CONFIG_RX65N_CARRY -typedef void (*carrycb_t)(void); +typedef void (*carrycb_t)(void); #endif /**************************************************************************** @@ -109,7 +109,7 @@ extern "C" #ifdef CONFIG_RTC_DATETIME struct tm; -int rx65n_rtc_setdatetime(FAR const struct tm *tp); +int rx65n_rtc_setdatetime(const struct tm *tp); #endif /**************************************************************************** @@ -140,7 +140,7 @@ bool rx65n_rtc_havesettime(void); * ****************************************************************************/ -int rx65n_rtc_setalarm(FAR struct alm_setalarm_s *alminfo); +int rx65n_rtc_setalarm(struct alm_setalarm_s *alminfo); /**************************************************************************** * Name: rx65n_rtc_rdalarm @@ -156,7 +156,7 @@ int rx65n_rtc_setalarm(FAR struct alm_setalarm_s *alminfo); * ****************************************************************************/ -int rx65n_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo); +int rx65n_rtc_rdalarm(struct alm_rdalarm_s *alminfo); /**************************************************************************** * Name: rx65n_rtc_cancelalarm @@ -192,7 +192,7 @@ int rx65n_rtc_cancelalarm(void); * ****************************************************************************/ -int rx65n_rtc_setperiodic(FAR const struct timespec *period, +int rx65n_rtc_setperiodic(const struct timespec *period, periodiccb_t callback); /**************************************************************************** @@ -235,7 +235,7 @@ int rx65n_rtc_cancelperiodic(void); #ifdef CONFIG_RTC_DRIVER struct rtc_lowerhalf_s; -FAR struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void); +struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void); #endif #undef EXTERN diff --git a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c index d305cbd21a..3b59343972 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c +++ b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c @@ -59,7 +59,7 @@ struct rx65n_cbinfo_s { volatile rtc_alarm_callback_t cb; /* Callback when the alarm expires */ - volatile FAR void *priv; /* Private argument to accompany callback */ + volatile void *priv; /* Private argument to accompany callback */ uint8_t id; /* Identifies the alarm */ }; #endif @@ -74,7 +74,7 @@ struct rx65n_lowerhalf_s * operations vtable (which may lie in FLASH or ROM) */ - FAR const struct rtc_ops_s *ops; + const struct rtc_ops_s *ops; /* Data following is private to this driver and not visible outside of * this file. @@ -101,29 +101,27 @@ struct rx65n_lowerhalf_s /* Prototypes for static methods in struct rtc_ops_s */ -static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower, - FAR struct rtc_time *rtctime); -static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, - FAR const struct rtc_time *rtctime); -static bool rx65n_havesettime(FAR struct rtc_lowerhalf_s *lower); +static int rx65n_rdtime(struct rtc_lowerhalf_s *lower, + struct rtc_time *rtctime); +static int rx65n_settime(struct rtc_lowerhalf_s *lower, + const struct rtc_time *rtctime); +static bool rx65n_havesettime(struct rtc_lowerhalf_s *lower); #ifdef CONFIG_RTC_ALARM -static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setalarm_s *alarminfo); -static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setrelative_s - *alarminfo); -static int rx65n_cancelalarm(FAR struct rtc_lowerhalf_s *lower, - int alarmid); -static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower, - FAR struct lower_rdalarm_s *alarminfo); +static int rx65n_setalarm(struct rtc_lowerhalf_s *lower, + const struct lower_setalarm_s *alarminfo); +static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, + const struct lower_setrelative_s *alarminfo); +static int rx65n_cancelalarm(struct rtc_lowerhalf_s *lower, + int alarmid); +static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower, + struct lower_rdalarm_s *alarminfo); #endif #ifdef CONFIG_RTC_PERIODIC -static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setperiodic_s - *alarminfo); -static int rx65n_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id); +static int rx65n_setperiodic(struct rtc_lowerhalf_s *lower, + const struct lower_setperiodic_s *alarminfo); +static int rx65n_cancelperiodic(struct rtc_lowerhalf_s *lower, int id); #endif /**************************************************************************** @@ -183,12 +181,12 @@ static struct rx65n_lowerhalf_s g_rtc_lowerhalf = ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static void rx65n_alarm_callback(FAR void *arg, unsigned int alarmid) +static void rx65n_alarm_callback(void *arg, unsigned int alarmid) { - FAR struct rx65n_lowerhalf_s *lower; - FAR struct rx65n_cbinfo_s *cbinfo; + struct rx65n_lowerhalf_s *lower; + struct rx65n_cbinfo_s *cbinfo; rtc_alarm_callback_t cb; - FAR void *priv; + void *priv; DEBUGASSERT(arg != NULL); @@ -200,7 +198,7 @@ static void rx65n_alarm_callback(FAR void *arg, unsigned int alarmid) */ cb = (rtc_alarm_callback_t)cbinfo->cb; - priv = (FAR void *)cbinfo->priv; + priv = (void *)cbinfo->priv; cbinfo->cb = NULL; cbinfo->priv = NULL; @@ -230,8 +228,8 @@ static void rx65n_alarm_callback(FAR void *arg, unsigned int alarmid) * ****************************************************************************/ -static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower, - FAR struct rtc_time *rtctime) +static int rx65n_rdtime(struct rtc_lowerhalf_s *lower, + struct rtc_time *rtctime) { #if defined(CONFIG_RTC_DATETIME) /* This operation depends on the fact that struct rtc_time is cast @@ -239,10 +237,10 @@ static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower, */ int ret; - return up_rtc_getdatetime((FAR struct tm *)rtctime); + return up_rtc_getdatetime((struct tm *)rtctime); #elif defined(CONFIG_RTC_HIRES) - FAR struct timespec ts; + struct timespec ts; int ret; /* Get the higher resolution time */ @@ -258,7 +256,7 @@ static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower, * compatible. */ - if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime)) + if (!gmtime_r(&ts.tv_sec, (struct tm *)rtctime)) { ret = -get_errno(); goto errout; @@ -288,15 +286,15 @@ errout: * ****************************************************************************/ -static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, - FAR const struct rtc_time *rtctime) +static int rx65n_settime(struct rtc_lowerhalf_s *lower, + const struct rtc_time *rtctime) { #ifdef CONFIG_RTC_DATETIME /* This operation depends on the fact that struct rtc_time is cast * compatible with struct tm. */ - return rx65n_rtc_setdatetime((FAR const struct tm *)rtctime); + return rx65n_rtc_setdatetime((const struct tm *)rtctime); #else struct timespec ts; @@ -305,7 +303,7 @@ static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, * rtc_time is cast compatible with struct tm. */ - ts.tv_sec = timegm((FAR struct tm *)rtctime); + ts.tv_sec = timegm((struct tm *)rtctime); ts.tv_nsec = 0; /* Now set the time (to one second accuracy) */ @@ -328,7 +326,7 @@ static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, * ****************************************************************************/ -static bool rx65n_havesettime(FAR struct rtc_lowerhalf_s *lower) +static bool rx65n_havesettime(struct rtc_lowerhalf_s *lower) { return true ; } @@ -351,16 +349,16 @@ static bool rx65n_havesettime(FAR struct rtc_lowerhalf_s *lower) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setalarm_s *alarminfo) +static int rx65n_setalarm(struct rtc_lowerhalf_s *lower, + const struct lower_setalarm_s *alarminfo) { - FAR struct rx65n_lowerhalf_s *priv; - FAR struct rx65n_cbinfo_s *cbinfo; + struct rx65n_lowerhalf_s *priv; + struct rx65n_cbinfo_s *cbinfo; struct alm_setalarm_s lowerinfo; int ret; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); - priv = (FAR struct rx65n_lowerhalf_s *)lower; + priv = (struct rx65n_lowerhalf_s *)lower; ret = nxmutex_lock(&priv->devlock); if (ret < 0) @@ -416,9 +414,8 @@ static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower, ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setrelative_s - *alarminfo) +static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, + const struct lower_setrelative_s *alarminfo) { struct lower_setalarm_s setalarm; struct tm time; @@ -468,7 +465,7 @@ static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, /* And convert the time back to broken out format */ - gmtime_r(&seconds, (FAR struct tm *)&setalarm.time); + gmtime_r(&seconds, (struct tm *)&setalarm.time); /* The set the alarm using this absolute time */ @@ -512,14 +509,14 @@ static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rx65n_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid) +static int rx65n_cancelalarm(struct rtc_lowerhalf_s *lower, int alarmid) { - FAR struct rx65n_lowerhalf_s *priv; - FAR struct rx65n_cbinfo_s *cbinfo; + struct rx65n_lowerhalf_s *priv; + struct rx65n_cbinfo_s *cbinfo; DEBUGASSERT(lower != NULL); DEBUGASSERT(alarmid == 0); - priv = (FAR struct rx65n_lowerhalf_s *)lower; + priv = (struct rx65n_lowerhalf_s *)lower; /* Nullify callback information to reduce window for race conditions */ @@ -550,8 +547,8 @@ static int rx65n_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid) ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower, - FAR struct lower_rdalarm_s *alarminfo) +static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower, + struct lower_rdalarm_s *alarminfo) { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; @@ -596,16 +593,16 @@ static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower, #ifdef CONFIG_RTC_PERIODIC static int rx65n_periodic_callback(void) { - FAR struct rx65n_lowerhalf_s *lower; + struct rx65n_lowerhalf_s *lower; struct lower_setperiodic_s *cbinfo; periodiccb_t cb; - FAR void *priv; + void *priv; - lower = (FAR struct rx65n_lowerhalf_s *)&g_rtc_lowerhalf; + lower = (struct rx65n_lowerhalf_s *)&g_rtc_lowerhalf; cbinfo = &lower->periodic; cb = (periodiccb_t)cbinfo->cb; - priv = (FAR void *)cbinfo->priv; + priv = (void *)cbinfo->priv; /* Perform the callback */ @@ -637,15 +634,14 @@ static int rx65n_periodic_callback(void) ****************************************************************************/ #ifdef CONFIG_RTC_PERIODIC -static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower, - FAR const struct lower_setperiodic_s - *alarminfo) +static int rx65n_setperiodic(struct rtc_lowerhalf_s *lower, + const struct lower_setperiodic_s *alarminfo) { - FAR struct rx65n_lowerhalf_s *priv; + struct rx65n_lowerhalf_s *priv; int ret; DEBUGASSERT(lower != NULL && alarminfo != NULL); - priv = (FAR struct rx65n_lowerhalf_s *)lower; + priv = (struct rx65n_lowerhalf_s *)lower; ret = nxmutex_lock(&priv->devlock); if (ret < 0) @@ -679,13 +675,13 @@ static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower, ****************************************************************************/ #ifdef CONFIG_RTC_PERIODIC -static int rx65n_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id) +static int rx65n_cancelperiodic(struct rtc_lowerhalf_s *lower, int id) { - FAR struct rx65n_lowerhalf_s *priv; + struct rx65n_lowerhalf_s *priv; int ret; DEBUGASSERT(lower != NULL); - priv = (FAR struct rx65n_lowerhalf_s *)lower; + priv = (struct rx65n_lowerhalf_s *)lower; DEBUGASSERT(id == 0); @@ -728,9 +724,9 @@ static int rx65n_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id) * ****************************************************************************/ -FAR struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void) +struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void) { - return (FAR struct rtc_lowerhalf_s *)&g_rtc_lowerhalf; + return (struct rtc_lowerhalf_s *)&g_rtc_lowerhalf; } #endif /* CONFIG_RTC_DRIVER */ diff --git a/arch/renesas/src/rx65n/rx65n_sbram.c b/arch/renesas/src/rx65n/rx65n_sbram.c index 9952e51be9..41278712bb 100644 --- a/arch/renesas/src/rx65n/rx65n_sbram.c +++ b/arch/renesas/src/rx65n/rx65n_sbram.c @@ -93,28 +93,26 @@ struct rx65n_sbram_s { mutex_t lock; /* For atomic accesses to this structure */ uint8_t refs; /* Number of references */ - FAR struct sbramfh_s *bbf; /* File in bbram */ + struct sbramfh_s *bbf; /* File in bbram */ }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static int rx65n_sbram_open(FAR struct file *filep); -static int rx65n_sbram_close(FAR struct file *filep); -static off_t rx65n_sbram_seek(FAR struct file *filep, off_t offset, - int whence); -static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer, - size_t len); -static ssize_t rx65n_sbram_write(FAR struct file *filep, - FAR const char *buffer, size_t len); -static int rx65n_sbram_ioctl(FAR struct file *filep, int cmd, - unsigned long arg); -static int rx65n_sbram_poll(FAR struct file *filep, - FAR struct pollfd *fds, - bool setup); +static int rx65n_sbram_open(struct file *filep); +static int rx65n_sbram_close(struct file *filep); +static off_t rx65n_sbram_seek(struct file *filep, off_t offset, + int whence); +static ssize_t rx65n_sbram_read(struct file *filep, char *buffer, + size_t len); +static ssize_t rx65n_sbram_write(struct file *filep, const char *buffer, + size_t len); +static int rx65n_sbram_ioctl(struct file *filep, int cmd, unsigned long arg); +static int rx65n_sbram_poll(struct file *filep, struct pollfd *fds, + bool setup); #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS -static int rx65n_sbram_unlink(FAR struct inode *inode); +static int rx65n_sbram_unlink(struct inode *inode); #endif /**************************************************************************** @@ -161,7 +159,7 @@ static void rx65n_sbram_rd(void) ****************************************************************************/ #if defined(CONFIG_SBRAM_DEBUG) -static void rx65n_sbram_dump(FAR struct sbramfh_s *bbf, char *op) +static void rx65n_sbram_dump(struct sbramfh_s *bbf, char *op) { SBRAM_DEBUG_READ(); _info("%s:\n", op); @@ -190,7 +188,7 @@ static void rx65n_sbram_dump(FAR struct sbramfh_s *bbf, char *op) * ****************************************************************************/ -static uint32_t rx65n_sbram_crc(FAR struct sbramfh_s *pf) +static uint32_t rx65n_sbram_crc(struct sbramfh_s *pf) { return crc32((uint8_t *)pf + SBRAM_CRCED_OFFSET, SBRAM_CRCED_SIZE(pf->len)); @@ -203,13 +201,13 @@ static uint32_t rx65n_sbram_crc(FAR struct sbramfh_s *pf) * ****************************************************************************/ -static int rx65n_sbram_open(FAR struct file *filep) +static int rx65n_sbram_open(struct file *filep) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; /* Increment the reference count */ @@ -236,7 +234,7 @@ static int rx65n_sbram_open(FAR struct file *filep) * ****************************************************************************/ -static int rx65n_sbram_internal_close(FAR struct sbramfh_s *bbf) +static int rx65n_sbram_internal_close(struct sbramfh_s *bbf) { bbf->dirty = 0; clock_gettime(CLOCK_REALTIME, &bbf->lastwrite); @@ -253,14 +251,14 @@ static int rx65n_sbram_internal_close(FAR struct sbramfh_s *bbf) * ****************************************************************************/ -static int rx65n_sbram_close(FAR struct file *filep) +static int rx65n_sbram_close(struct file *filep) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; int ret = OK; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; nxmutex_lock(&bbr->lock); @@ -293,16 +291,16 @@ static int rx65n_sbram_close(FAR struct file *filep) * Name: rx65n_sbram_seek ****************************************************************************/ -static off_t rx65n_sbram_seek(FAR struct file *filep, off_t offset, - int whence) +static off_t rx65n_sbram_seek(struct file *filep, off_t offset, + int whence) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; off_t newpos; int ret; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; nxmutex_lock(&bbr->lock); @@ -364,14 +362,14 @@ static off_t rx65n_sbram_seek(FAR struct file *filep, off_t offset, * Name: rx65n_sbram_read ****************************************************************************/ -static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer, - size_t len) +static ssize_t rx65n_sbram_read(struct file *filep, char *buffer, + size_t len) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; nxmutex_lock(&bbr->lock); @@ -392,9 +390,9 @@ static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer, * Name: rx65n_sbram_internal_write ****************************************************************************/ -static ssize_t rx65n_sbram_internal_write(FAR struct sbramfh_s *bbf, - FAR const char *buffer, - off_t offset, size_t len) +static ssize_t rx65n_sbram_internal_write(struct sbramfh_s *bbf, + const char *buffer, + off_t offset, size_t len) { bbf->dirty = 1; memcpy(&bbf->data[offset], buffer, len); @@ -405,16 +403,15 @@ static ssize_t rx65n_sbram_internal_write(FAR struct sbramfh_s *bbf, * Name: rx65n_sbram_write ****************************************************************************/ -static ssize_t rx65n_sbram_write(FAR struct file *filep, - FAR const char *buffer, - size_t len) +static ssize_t rx65n_sbram_write(struct file *filep, const char *buffer, + size_t len) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; int ret = -EFBIG; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; /* Forbid writes past the end of the device */ @@ -445,8 +442,8 @@ static ssize_t rx65n_sbram_write(FAR struct file *filep, * Name: rx65n_sbram_poll ****************************************************************************/ -static int rx65n_sbram_poll(FAR struct file *filep, FAR struct pollfd *fds, - bool setup) +static int rx65n_sbram_poll(struct file *filep, struct pollfd *fds, + bool setup) { if (setup) { @@ -463,19 +460,18 @@ static int rx65n_sbram_poll(FAR struct file *filep, FAR struct pollfd *fds, * ****************************************************************************/ -static int rx65n_sbram_ioctl(FAR struct file *filep, int cmd, - unsigned long arg) +static int rx65n_sbram_ioctl(struct file *filep, int cmd, unsigned long arg) { - FAR struct inode *inode = filep->f_inode; - FAR struct rx65n_sbram_s *bbr; + struct inode *inode = filep->f_inode; + struct rx65n_sbram_s *bbr; int ret = -ENOTTY; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; if (cmd == RX65N_SBRAM_GETDESC_IOCTL) { - FAR struct sbramd_s *bbrr = (FAR struct sbramd_s *)((uintptr_t)arg); + struct sbramd_s *bbrr = (struct sbramd_s *)((uintptr_t)arg); nxmutex_lock(&bbr->lock); if (!bbrr) @@ -513,12 +509,12 @@ static int rx65n_sbram_ioctl(FAR struct file *filep, int cmd, ****************************************************************************/ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS -static int rx65n_sbram_unlink(FAR struct inode *inode) +static int rx65n_sbram_unlink(struct inode *inode) { - FAR struct rx65n_sbram_s *bbr; + struct rx65n_sbram_s *bbr; DEBUGASSERT(inode && inode->i_private); - bbr = (FAR struct rx65n_sbram_s *)inode->i_private; + bbr = (struct rx65n_sbram_s *)inode->i_private; nxmutex_lock(&bbr->lock); memset(bbr->bbf->data, 0, bbr->bbf->len); @@ -691,7 +687,7 @@ int rx65n_sbraminitialize(char *devpath, int *sizes) #if defined(CONFIG_RX65N_SAVE_CRASHDUMP) int rx65n_sbram_savepanic(int fileno, uint8_t *context, int length) { - FAR struct sbramfh_s *bbf; + struct sbramfh_s *bbf; int fill; int ret = -ENOSPC; @@ -737,7 +733,7 @@ int rx65n_sbram_savepanic(int fileno, uint8_t *context, int length) /* Fill with 0 if data is less then file size */ - fill = (int) bbf->len - length; + fill = (int)bbf->len - length; if (fill > 0) { diff --git a/arch/renesas/src/rx65n/rx65n_serial.c b/arch/renesas/src/rx65n/rx65n_serial.c index b6a846fc82..2a53126813 100644 --- a/arch/renesas/src/rx65n/rx65n_serial.c +++ b/arch/renesas/src/rx65n/rx65n_serial.c @@ -281,10 +281,10 @@ 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_ioctl(struct file *filep, int cmd, unsigned long arg); -static int up_xmtinterrupt(int irq, void *context, FAR void *arg); -static int up_rcvinterrupt(int irq, void *context, FAR void *arg); -static int up_eriinterrupt(int irq, void *context, FAR void *arg); -static int up_teiinterrupt(int irq, void *context, FAR void *arg); +static int up_xmtinterrupt(int irq, void *context, void *arg); +static int up_rcvinterrupt(int irq, void *context, void *arg); +static int up_eriinterrupt(int irq, void *context, void *arg); +static int up_teiinterrupt(int irq, void *context, void *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); @@ -1268,7 +1268,7 @@ static int up_rcvinterrupt(int irq, void *context, void *arg) * ****************************************************************************/ -static int up_xmtinterrupt(int irq, void *context, FAR void *arg) +static int up_xmtinterrupt(int irq, void *context, void *arg) { struct uart_dev_s *dev; dev = (struct uart_dev_s *)arg; diff --git a/arch/renesas/src/rx65n/rx65n_usbdev.c b/arch/renesas/src/rx65n/rx65n_usbdev.c index 8342f070ed..76013e91b6 100644 --- a/arch/renesas/src/rx65n/rx65n_usbdev.c +++ b/arch/renesas/src/rx65n/rx65n_usbdev.c @@ -300,21 +300,20 @@ uint8_t g_buffer[64] ; /* Request queue operations *************************************************/ -FAR struct rx65n_req_s *rx65n_rqdequeue(FAR struct rx65n_ep_s - *privep); -static void rx65n_rqenqueue(FAR struct rx65n_ep_s *privep, FAR struct +struct rx65n_req_s *rx65n_rqdequeue(struct rx65n_ep_s *privep); +static void rx65n_rqenqueue(struct rx65n_ep_s *privep, struct rx65n_req_s *req); /* Low level data transfers and request operations */ static void rx65n_epwrite(uint8_t epno, struct rx65n_usbdev_s *priv, - struct rx65n_ep_s *privep, - uint8_t *buf, uint32_t nbytes); + struct rx65n_ep_s *privep, uint8_t *buf, + uint32_t nbytes); static int rx65n_epread(uint8_t epno, struct rx65n_usbdev_s *priv, - uint8_t *buf, - uint16_t nbytes); + uint8_t *buf, uint16_t nbytes); static inline void rx65n_abortrequest(struct rx65n_ep_s *privep, - struct rx65n_req_s *privreq, int16_t result); + struct rx65n_req_s *privreq, + int16_t result); static void rx65n_reqcomplete(struct rx65n_ep_s *privep, int16_t result); static int rx65n_wrrequest(uint8_t epno, struct rx65n_usbdev_s *priv, struct rx65n_ep_s *privep); @@ -325,22 +324,20 @@ static int rx65n_rdrequest(uint8_t epno, struct rx65n_usbdev_s *priv, static void rx65n_dispatchrequest(struct rx65n_usbdev_s *priv); void rx65n_ep0setup(struct rx65n_usbdev_s *priv); -static int rx65n_usbinterrupt(int irq, FAR void *context, FAR void *arg); +static int rx65n_usbinterrupt(int irq, void *context, void *arg); /* Endpoint methods */ -static int rx65n_epconfigure(FAR struct usbdev_ep_s *ep, - const struct usb_epdesc_s *desc, bool last); -static int rx65n_epdisable(FAR struct usbdev_ep_s *ep); -static FAR struct usbdev_req_s *rx65n_epallocreq(FAR struct usbdev_ep_s *ep); -static void rx65n_epfreereq(FAR struct usbdev_ep_s *ep, - FAR struct usbdev_req_s *req); -static int rx65n_epsubmit(FAR struct usbdev_ep_s *ep, - struct usbdev_req_s - *privreq); -static int rx65n_epcancel(FAR struct usbdev_ep_s *ep, - struct usbdev_req_s - *privreq); +static int rx65n_epconfigure(struct usbdev_ep_s *ep, + const struct usb_epdesc_s *desc, bool last); +static int rx65n_epdisable(struct usbdev_ep_s *ep); +static struct usbdev_req_s *rx65n_epallocreq(struct usbdev_ep_s *ep); +static void rx65n_epfreereq(struct usbdev_ep_s *ep, + struct usbdev_req_s *req); +static int rx65n_epsubmit(struct usbdev_ep_s *ep, + struct usbdev_req_s *privreq); +static int rx65n_epcancel(struct usbdev_ep_s *ep, + struct usbdev_req_s *privreq); static void rx65n_cancelrequests(struct rx65n_ep_s *privep); /* USB device controller methods */ @@ -348,8 +345,7 @@ static void rx65n_cancelrequests(struct rx65n_ep_s *privep); static struct usbdev_ep_s *rx65n_allocep(struct usbdev_s *dev, uint8_t epno, bool in, uint8_t eptype); -static void rx65n_freeep(FAR struct usbdev_s *dev, FAR struct - usbdev_ep_s *ep); +static void rx65n_freeep(struct usbdev_s *dev, struct usbdev_ep_s *ep); static int rx65n_getframe(struct usbdev_s *dev); static int rx65n_wakeup(struct usbdev_s *dev); static int rx65n_selfpowered(struct usbdev_s *dev, bool selfpowered); @@ -357,60 +353,60 @@ int rx65n_pullup(struct usbdev_s *dev, bool enable); /* Interrupt Handler */ -static int rx65n_usbinterrupt(int irq, FAR void *context, FAR void *arg); +static int rx65n_usbinterrupt(int irq, void *context, void *arg); /* USB Helper Functions */ -void usb_pstd_attach_process (void); -uint16_t usb_pstd_chk_vbsts (void); +void usb_pstd_attach_process(void); +uint16_t usb_pstd_chk_vbsts(void); void hw_usb_pclear_dprpu(void); -static void hw_usb_clear_aclrm (uint16_t pipeno); -static void hw_usb_set_aclrm (uint16_t pipeno); -static void usb_cstd_do_aclrm (uint16_t pipe); -static void hw_usb_set_curpipe (uint16_t pipemode, uint16_t pipeno); -static void hw_usb_rmw_fifosel (uint16_t pipemode, +static void hw_usb_clear_aclrm(uint16_t pipeno); +static void hw_usb_set_aclrm(uint16_t pipeno); +static void usb_cstd_do_aclrm(uint16_t pipe); +static void hw_usb_set_curpipe(uint16_t pipemode, uint16_t pipeno); +static void hw_usb_rmw_fifosel(uint16_t pipemode, uint16_t data, uint16_t bitptn); -static void usb_cstd_chg_curpipe (uint16_t pipe, +static void usb_cstd_chg_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel); -static void *hw_usb_get_fifosel_adr (uint16_t pipemode); -static uint16_t hw_usb_read_fifosel (uint16_t pipemode); -static void hw_usb_set_trclr (uint16_t pipeno); -static void hw_usb_clear_trenb (uint16_t pipeno); -static void hw_usb_clear_bempenb (uint16_t pipeno); -static void hw_usb_clear_nrdyenb (uint16_t pipeno); -static void hw_usb_clear_brdyenb (uint16_t pipeno); -static uint16_t hw_usb_read_pipectr (uint16_t pipeno); -static void hw_usb_clear_pid (uint16_t pipeno, uint16_t data); -static void usb_cstd_set_nak (uint16_t pipe); +static void *hw_usb_get_fifosel_adr(uint16_t pipemode); +static uint16_t hw_usb_read_fifosel(uint16_t pipemode); +static void hw_usb_set_trclr(uint16_t pipeno); +static void hw_usb_clear_trenb(uint16_t pipeno); +static void hw_usb_clear_bempenb(uint16_t pipeno); +static void hw_usb_clear_nrdyenb(uint16_t pipeno); +static void hw_usb_clear_brdyenb(uint16_t pipeno); +static uint16_t hw_usb_read_pipectr(uint16_t pipeno); +static void hw_usb_clear_pid(uint16_t pipeno, uint16_t data); +static void usb_cstd_set_nak(uint16_t pipe); void usb_pstd_forced_termination(uint16_t pipe, uint16_t status); -void usb_pstd_detach_process (void); -static void usb_cstd_clr_stall (uint16_t pipe); -static void hw_usb_write_pipesel (uint16_t data); -static void hw_usb_write_pipecfg (uint16_t data); -static void hw_usb_write_pipemaxp (uint16_t data); -static void hw_usb_write_pipeperi (uint16_t data); -static void hw_usb_set_sqclr (uint16_t pipeno); -static void hw_usb_clear_sts_brdy (uint16_t pipeno); -static void hw_usb_clear_status_nrdy (uint16_t pipeno); -static void hw_usb_clear_status_bemp (uint16_t pipeno); -void usb_pstd_bus_reset (void); -void usb_pstd_suspend_process (void); -uint16_t usb_cstd_port_speed (void); -static void hw_usb_write_dcpcfg (uint16_t data); -static uint16_t hw_usb_read_dvstctr (void); -static int hw_usb_read_syssts (void); +void usb_pstd_detach_process(void); +static void usb_cstd_clr_stall(uint16_t pipe); +static void hw_usb_write_pipesel(uint16_t data); +static void hw_usb_write_pipecfg(uint16_t data); +static void hw_usb_write_pipemaxp(uint16_t data); +static void hw_usb_write_pipeperi(uint16_t data); +static void hw_usb_set_sqclr(uint16_t pipeno); +static void hw_usb_clear_sts_brdy(uint16_t pipeno); +static void hw_usb_clear_status_nrdy(uint16_t pipeno); +static void hw_usb_clear_status_bemp(uint16_t pipeno); +void usb_pstd_bus_reset(void); +void usb_pstd_suspend_process(void); +uint16_t usb_cstd_port_speed(void); +static void hw_usb_write_dcpcfg(uint16_t data); +static uint16_t hw_usb_read_dvstctr(void); +static int hw_usb_read_syssts(void); void usb_pstd_save_request(void); -static void hw_usb_set_pid (uint16_t pipeno, uint16_t data); -static void hw_usb_set_mbw (uint16_t pipemode, uint16_t data); -static uint16_t hw_usb_read_dcpmaxp (void); -static uint16_t hw_usb_read_pipemaxp (void); -static void hw_usb_write_dcpmxps (uint16_t data); +static void hw_usb_set_pid(uint16_t pipeno, uint16_t data); +static void hw_usb_set_mbw(uint16_t pipemode, uint16_t data); +static uint16_t hw_usb_read_dcpmaxp(void); +static uint16_t hw_usb_read_pipemaxp(void); +static void hw_usb_write_dcpmxps(uint16_t data); uint16_t usb_pstd_pipe2fport(uint16_t pipe); -static uint16_t usb_cstd_get_pid (uint16_t pipe); -static void usb_cstd_clr_transaction_counter (uint16_t trnreg); -static uint16_t hw_usb_read_pipecfg (void); +static uint16_t usb_cstd_get_pid(uint16_t pipe); +static void usb_cstd_clr_transaction_counter(uint16_t trnreg); +static uint16_t hw_usb_read_pipecfg(void); void usb_pstd_set_stall(uint16_t pipe); -static uint16_t hw_usb_read_frmnum (void); +static uint16_t hw_usb_read_frmnum(void); /**************************************************************************** * Private Data @@ -469,7 +465,7 @@ struct rx65n_usbdev_s g_usbdev; * ****************************************************************************/ -FAR struct rx65n_req_s *rx65n_rqdequeue(FAR struct rx65n_ep_s *privep) +struct rx65n_req_s *rx65n_rqdequeue(struct rx65n_ep_s *privep) { struct rx65n_req_s *ret = privep->head; @@ -495,8 +491,8 @@ FAR struct rx65n_req_s *rx65n_rqdequeue(FAR struct rx65n_ep_s *privep) * ****************************************************************************/ -static void rx65n_rqenqueue(FAR struct rx65n_ep_s *privep, - FAR struct rx65n_req_s *req) +static void rx65n_rqenqueue(struct rx65n_ep_s *privep, + struct rx65n_req_s *req) { req->flink = NULL; if (!privep->head) @@ -519,26 +515,26 @@ static void rx65n_rqenqueue(FAR struct rx65n_ep_s *privep, * ****************************************************************************/ -static void *hw_usb_get_fifoctr_adr (uint16_t pipemode) +static void *hw_usb_get_fifoctr_adr(uint16_t pipemode) { void *p_reg = NULL; switch (pipemode) { case USB_CUSE: - p_reg = (void *)RX65N_USB_CFIFOCTR; - break; + p_reg = (void *)RX65N_USB_CFIFOCTR; + break; case USB_D0USE: - p_reg = (void *)RX65N_USB_D0FIFOCTR; - break; + p_reg = (void *)RX65N_USB_D0FIFOCTR; + break; case USB_D1USE: - p_reg = (void *)RX65N_USB_D1FIFOCTR; - break; + p_reg = (void *)RX65N_USB_D1FIFOCTR; + break; default: - break; + break; } return p_reg; @@ -552,7 +548,7 @@ static void *hw_usb_get_fifoctr_adr (uint16_t pipemode) * ****************************************************************************/ -static void hw_usb_set_mbw (uint16_t pipemode, uint16_t data) +static void hw_usb_set_mbw(uint16_t pipemode, uint16_t data) { uint16_t *p_reg; @@ -573,11 +569,11 @@ static void hw_usb_set_mbw (uint16_t pipemode, uint16_t data) * ****************************************************************************/ -static void hw_usb_set_bclr (uint16_t pipemode) +static void hw_usb_set_bclr(uint16_t pipemode) { uint16_t *p_reg; - p_reg = (uint16_t *) hw_usb_get_fifoctr_adr(pipemode); + p_reg = (uint16_t *)hw_usb_get_fifoctr_adr(pipemode); *p_reg = USB_BCLR; } @@ -590,11 +586,11 @@ static void hw_usb_set_bclr (uint16_t pipemode) * ****************************************************************************/ -static uint16_t hw_usb_read_fifoctr (uint16_t pipemode) +static uint16_t hw_usb_read_fifoctr(uint16_t pipemode) { uint16_t *p_reg; - p_reg = (uint16_t *) hw_usb_get_fifoctr_adr(pipemode); + p_reg = (uint16_t *)hw_usb_get_fifoctr_adr(pipemode); return *p_reg; } @@ -607,9 +603,9 @@ static uint16_t hw_usb_read_fifoctr (uint16_t pipemode) * ****************************************************************************/ -static uint16_t hw_usb_read_syscfg (void) +static uint16_t hw_usb_read_syscfg(void) { - return (rx65n_getreg16(RX65N_USB_SYSCFG)); + return rx65n_getreg16(RX65N_USB_SYSCFG); } /**************************************************************************** @@ -620,8 +616,8 @@ static uint16_t hw_usb_read_syscfg (void) * ****************************************************************************/ -static uint16_t usb_cstd_is_set_frdy (uint16_t pipe, uint16_t fifosel, - uint16_t isel) +static uint16_t usb_cstd_is_set_frdy(uint16_t pipe, uint16_t fifosel, + uint16_t isel) { uint16_t buf; uint16_t i; @@ -636,16 +632,16 @@ static uint16_t usb_cstd_is_set_frdy (uint16_t pipe, uint16_t fifosel, { buf = hw_usb_read_fifoctr(fifosel); - if (USB_FRDY == (uint16_t) (buf & USB_FRDY)) + if (USB_FRDY == (uint16_t)(buf & USB_FRDY)) { - return (buf); + return buf; } buf = hw_usb_read_syscfg(); buf = hw_usb_read_syssts(); } - return (USB_ERROR); + return USB_ERROR; } /**************************************************************************** @@ -656,7 +652,7 @@ static uint16_t usb_cstd_is_set_frdy (uint16_t pipe, uint16_t fifosel, * ****************************************************************************/ -static uint16_t hw_usb_read_dcpmaxp () +static uint16_t hw_usb_read_dcpmaxp(void) { return rx65n_getreg16(RX65N_USB_DCPMAXP); } @@ -669,7 +665,7 @@ static uint16_t hw_usb_read_dcpmaxp () * ****************************************************************************/ -static uint16_t hw_usb_read_pipemaxp () +static uint16_t hw_usb_read_pipemaxp(void) { return rx65n_getreg16(RX65N_USB_PIPEMAXP); } @@ -682,7 +678,7 @@ static uint16_t hw_usb_read_pipemaxp () * ****************************************************************************/ -static uint16_t usb_cstd_get_buf_size (uint16_t pipe) +static uint16_t usb_cstd_get_buf_size(uint16_t pipe) { uint16_t size; uint16_t buf; @@ -693,7 +689,7 @@ static uint16_t usb_cstd_get_buf_size (uint16_t pipe) /* Max Packet Size */ - size = (uint16_t) (buf & USB_MAXP); + size = (uint16_t)(buf & USB_MAXP); } else { @@ -704,7 +700,7 @@ static uint16_t usb_cstd_get_buf_size (uint16_t pipe) /* Max Packet Size */ - size = (uint16_t) (buf & USB_MXPS); + size = (uint16_t)(buf & USB_MXPS); } return size; @@ -718,7 +714,7 @@ static uint16_t usb_cstd_get_buf_size (uint16_t pipe) * ****************************************************************************/ -static uint16_t usb_cstd_get_maxpacket_size (uint16_t pipe) +static uint16_t usb_cstd_get_maxpacket_size(uint16_t pipe) { uint16_t size; uint16_t buf; @@ -742,7 +738,7 @@ static uint16_t usb_cstd_get_maxpacket_size (uint16_t pipe) /* Max Packet Size */ - size = (uint16_t) (buf & USB_MXPS); + size = (uint16_t)(buf & USB_MXPS); return size; } @@ -755,21 +751,21 @@ static uint16_t usb_cstd_get_maxpacket_size (uint16_t pipe) * ****************************************************************************/ -static void hw_usb_write_fifo16 (uint16_t pipemode, uint16_t data) +static void hw_usb_write_fifo16(uint16_t pipemode, uint16_t data) { switch (pipemode) { case USB_CUSE : - USB0_CFIFO16 = data; - break; + USB0_CFIFO16 = data; + break; case USB_D0USE : - USB0_D0FIFO16 = data; - break; + USB0_D0FIFO16 = data; + break; case USB_D1USE : - USB0_D1FIFO16 = data; - break; + USB0_D1FIFO16 = data; + break; default : - break; + break; } } @@ -781,21 +777,21 @@ static void hw_usb_write_fifo16 (uint16_t pipemode, uint16_t data) * ****************************************************************************/ -static void hw_usb_write_fifo8 (uint16_t pipemode, uint8_t data) +static void hw_usb_write_fifo8(uint16_t pipemode, uint8_t data) { switch (pipemode) { case USB_CUSE : - USB0_CFIFO8 = data; - break; + USB0_CFIFO8 = data; + break; case USB_D0USE : - USB0_D0FIFO8 = data; - break; + USB0_D0FIFO8 = data; + break; case USB_D1USE : - USB0_D1FIFO8 = data; - break; + USB0_D1FIFO8 = data; + break; default : - break; + break; } } @@ -859,11 +855,11 @@ uint8_t *usb_pstd_write_fifo(uint16_t count, uint16_t pipemode, * ****************************************************************************/ -static void hw_usb_set_bval (uint16_t pipemode) +static void hw_usb_set_bval(uint16_t pipemode) { uint16_t *p_reg; - p_reg = (uint16_t *) hw_usb_get_fifoctr_adr(pipemode); + p_reg = (uint16_t *)hw_usb_get_fifoctr_adr(pipemode); (*p_reg) |= USB_BVAL; } @@ -894,7 +890,7 @@ uint16_t usb_pstd_write_data(uint16_t pipe, uint16_t pipemode) if ((USB_CUSE == pipemode) && (USB_PIPE0 == pipe)) { buf = usb_cstd_is_set_frdy(pipe, (uint16_t)USB_CUSE, - (uint16_t)USB_ISEL); + (uint16_t)USB_ISEL); } else { @@ -1006,7 +1002,7 @@ uint16_t usb_pstd_write_data(uint16_t pipe, uint16_t pipemode) * ****************************************************************************/ -static void hw_usb_set_nrdyenb (uint16_t pipeno) +static void hw_usb_set_nrdyenb(uint16_t pipeno) { uint16_t regval; regval = rx65n_getreg16(RX65N_USB_NRDYENB); @@ -1022,7 +1018,7 @@ static void hw_usb_set_nrdyenb (uint16_t pipeno) * ****************************************************************************/ -static void usb_cstd_nrdy_enable (uint16_t pipe) +static void usb_cstd_nrdy_enable(uint16_t pipe) { if (USB_MAXPIPE_NUM < pipe) { @@ -1042,7 +1038,7 @@ static void usb_cstd_nrdy_enable (uint16_t pipe) * ****************************************************************************/ -static void usb_cstd_set_buf (uint16_t pipe) +static void usb_cstd_set_buf(uint16_t pipe) { if (USB_MAXPIPE_NUM < pipe) { @@ -1062,7 +1058,7 @@ static void usb_cstd_set_buf (uint16_t pipe) * ****************************************************************************/ -static void hw_usb_set_bempenb (uint16_t pipeno) +static void hw_usb_set_bempenb(uint16_t pipeno) { uint16_t regval; regval = rx65n_getreg16(RX65N_USB_BEMPENB); @@ -1078,7 +1074,7 @@ static void hw_usb_set_bempenb (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_set_brdyenb (uint16_t pipeno) +static void hw_usb_set_brdyenb(uint16_t pipeno) { uint16_t regval; regval = rx65n_getreg16(RX65N_USB_BRDYENB); @@ -1094,13 +1090,13 @@ static void hw_usb_set_brdyenb (uint16_t pipeno) * ****************************************************************************/ -void usb_pstd_ctrl_write (uint32_t bsize, uint8_t *table) +void usb_pstd_ctrl_write(uint32_t bsize, uint8_t *table) { g_usb_pstd_data_cnt[USB_PIPE0] = bsize; gp_usb_pstd_data[USB_PIPE0] = table; usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, - (uint16_t) USB_CUSE, USB_FALSE); + (uint16_t) USB_CUSE, USB_FALSE); /* Buffer clear */ @@ -1129,7 +1125,7 @@ void usb_pstd_ctrl_write (uint32_t bsize, uint8_t *table) * ****************************************************************************/ -uint16_t usb_ctrl_read (uint32_t bsize, uint8_t *table) +uint16_t usb_ctrl_read(uint32_t bsize, uint8_t *table) { usb_pstd_ctrl_write(bsize, table); return OK; @@ -1143,7 +1139,7 @@ uint16_t usb_ctrl_read (uint32_t bsize, uint8_t *table) * ****************************************************************************/ -uint16_t usb_pstd_ctrl_read (uint32_t bsize, uint8_t *table) +uint16_t usb_pstd_ctrl_read(uint32_t bsize, uint8_t *table) { uint16_t end_flag; g_usb_pstd_data_cnt[USB_PIPE0] = bsize; @@ -1165,51 +1161,52 @@ uint16_t usb_pstd_ctrl_read (uint32_t bsize, uint8_t *table) switch (end_flag) { - /* End of data write */ + /* End of data write */ case USB_WRITESHRT : - /* Enable not ready interrupt */ + /* Enable not ready interrupt */ - usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); + usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); - /* Set PID=BUF */ + /* Set PID=BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - break; + usb_cstd_set_buf((uint16_t) USB_PIPE0); + break; - /* End of data write (not null) */ + /* End of data write (not null) */ case USB_WRITEEND : - /* Continue */ + /* Continue */ - /* Continue of data write */ + /* Continue of data write */ case USB_WRITING : - /* Enable empty interrupt */ + /* Enable empty interrupt */ - hw_usb_set_bempenb((uint16_t) USB_PIPE0); + hw_usb_set_bempenb((uint16_t) USB_PIPE0); - /* Enable not ready interrupt */ + /* Enable not ready interrupt */ - usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); + usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); - /* Set PID=BUF */ + /* Set PID=BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - break; + usb_cstd_set_buf((uint16_t) USB_PIPE0); + break; - /* FIFO access error */ + /* FIFO access error */ case USB_ERROR : - break; + break; + default : - break; + break; } - return (end_flag); /* End or error or continue */ + return end_flag; /* End or error or continue */ } /**************************************************************************** @@ -1242,45 +1239,45 @@ void usb_pstd_buf_to_fifo(uint16_t pipe, uint16_t useport) { case USB_WRITING: - /* Continue of data write */ + /* Continue of data write */ - /* Enable Ready Interrupt */ + /* Enable Ready Interrupt */ - hw_usb_set_brdyenb(pipe); + hw_usb_set_brdyenb(pipe); - /* Enable Not Ready Interrupt */ + /* Enable Not Ready Interrupt */ - usb_cstd_nrdy_enable(pipe); + usb_cstd_nrdy_enable(pipe); break; - case USB_WRITEEND: + case USB_WRITEEND: - /* End of data write */ + /* End of data write */ - /* continue */ + /* continue */ - case USB_WRITESHRT: + case USB_WRITESHRT: - /* End of data write */ + /* End of data write */ - /* Enable Empty Interrupt */ + /* Enable Empty Interrupt */ - hw_usb_set_bempenb(pipe); + hw_usb_set_bempenb(pipe); - /* Enable Not Ready Interrupt */ + /* Enable Not Ready Interrupt */ - usb_cstd_nrdy_enable(pipe); + usb_cstd_nrdy_enable(pipe); break; - case USB_ERROR: + case USB_ERROR: - /* FIFO access error */ + /* FIFO access error */ - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); break; - default: - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); + default: + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); break; } } @@ -1337,10 +1334,10 @@ void usb_pstd_data_end(uint16_t pipe, uint16_t status) /* CFIFO use */ case USB_CUSE: - break; + break; default: - break; + break; } } @@ -1399,7 +1396,7 @@ void usb_pstd_send_start(uint16_t pipe, uint8_t *buf, uint32_t size) * ****************************************************************************/ -static uint16_t hw_usb_read_pipecfg () +static uint16_t hw_usb_read_pipecfg(void) { return rx65n_getreg16(RX65N_USB_PIPECFG); } @@ -1412,7 +1409,7 @@ static uint16_t hw_usb_read_pipecfg () * ****************************************************************************/ -static uint16_t usb_cstd_get_pipe_dir (uint16_t pipe) +static uint16_t usb_cstd_get_pipe_dir(uint16_t pipe) { uint16_t buf; @@ -1428,7 +1425,7 @@ static uint16_t usb_cstd_get_pipe_dir (uint16_t pipe) /* Read Pipe direction */ buf = hw_usb_read_pipecfg(); - return (uint16_t) (buf & USB_DIRFIELD); + return (uint16_t)(buf & USB_DIRFIELD); } /**************************************************************************** @@ -1439,7 +1436,7 @@ static uint16_t usb_cstd_get_pipe_dir (uint16_t pipe) * ****************************************************************************/ -static uint16_t usb_cstd_get_pipe_type (uint16_t pipe) +static uint16_t usb_cstd_get_pipe_type(uint16_t pipe) { uint16_t buf; @@ -1455,7 +1452,7 @@ static uint16_t usb_cstd_get_pipe_type (uint16_t pipe) /* Read Pipe direction */ buf = hw_usb_read_pipecfg(); - return (uint16_t) (buf & USB_TYPFIELD); + return (uint16_t)(buf & USB_TYPFIELD); } /**************************************************************************** @@ -1496,7 +1493,7 @@ uint16_t usb_pstd_chk_configured(void) * ****************************************************************************/ -static void hw_usb_set_trenb (uint16_t pipeno) +static void hw_usb_set_trenb(uint16_t pipeno) { uint16_t *p_reg; @@ -1513,7 +1510,7 @@ static void hw_usb_set_trenb (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_write_pipetrn (uint16_t pipeno, uint16_t data) +static void hw_usb_write_pipetrn(uint16_t pipeno, uint16_t data) { uint16_t *p_reg; @@ -1530,12 +1527,12 @@ static void hw_usb_write_pipetrn (uint16_t pipeno, uint16_t data) * ****************************************************************************/ -static void usb_cstd_set_transaction_counter (uint16_t trnreg, - uint16_t trncnt) +static void usb_cstd_set_transaction_counter(uint16_t trnreg, + uint16_t trncnt) { - hw_usb_set_trclr(trnreg); - hw_usb_write_pipetrn(trnreg, trncnt); - hw_usb_set_trenb(trnreg); + hw_usb_set_trclr(trnreg); + hw_usb_write_pipetrn(trnreg, trncnt); + hw_usb_set_trenb(trnreg); } /**************************************************************************** @@ -1574,53 +1571,53 @@ void usb_pstd_receive_start(uint16_t pipe) switch (useport) { - /* CFIFO use */ + /* CFIFO use */ case USB_CUSE: - /* Changes the FIFO port by the pipe. */ + /* Changes the FIFO port by the pipe. */ - usb_cstd_chg_curpipe(pipe, useport, USB_FALSE); + usb_cstd_chg_curpipe(pipe, useport, USB_FALSE); - /* Max Packet Size */ + /* Max Packet Size */ - mxps = usb_cstd_get_maxpacket_size(pipe); - if ((uint32_t)0u != length) - { - /* Data length check */ + mxps = usb_cstd_get_maxpacket_size(pipe); + if ((uint32_t)0u != length) + { + /* Data length check */ - if ((uint32_t)0u == (length % mxps)) - { - /* Set Transaction counter */ + if ((uint32_t)0u == (length % mxps)) + { + /* Set Transaction counter */ - usb_cstd_set_transaction_counter(pipe, (uint16_t)(length / - mxps)); - } - else - { - /* Set Transaction counter */ + usb_cstd_set_transaction_counter(pipe, (uint16_t)(length / + mxps)); + } + else + { + /* Set Transaction counter */ - usb_cstd_set_transaction_counter(pipe, (uint16_t)((length - / mxps) + (uint32_t)1u)); - } - } + usb_cstd_set_transaction_counter(pipe, (uint16_t)((length + / mxps) + (uint32_t)1u)); + } + } - /* Set BUF */ + /* Set BUF */ - usb_cstd_set_buf(pipe); + usb_cstd_set_buf(pipe); - /* Enable Ready Interrupt */ + /* Enable Ready Interrupt */ - hw_usb_set_brdyenb(pipe); + hw_usb_set_brdyenb(pipe); - /* Enable Not Ready Interrupt */ + /* Enable Not Ready Interrupt */ - usb_cstd_nrdy_enable(pipe); - break; + usb_cstd_nrdy_enable(pipe); + break; - default: - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); - break; + default: + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); + break; } } @@ -1632,7 +1629,7 @@ void usb_pstd_receive_start(uint16_t pipe) * ****************************************************************************/ -void usb_pstd_set_submitutr (struct usb_utr *utrmsg) +void usb_pstd_set_submitutr(struct usb_utr *utrmsg) { uint16_t pipenum; @@ -1678,7 +1675,7 @@ uint8_t usb_pstd_transfer_start(struct usb_utr *ptr) * ****************************************************************************/ -long usb_data_write (uint8_t epno, uint8_t *buf, uint32_t size) +long usb_data_write(uint8_t epno, uint8_t *buf, uint32_t size) { uint8_t pipe; if (epno == BULK_IN_EPNUM) @@ -1738,8 +1735,8 @@ void usb_data_read(uint8_t *buf, uint32_t size) ****************************************************************************/ static void rx65n_epwrite(uint8_t epno, struct rx65n_usbdev_s *priv, - struct rx65n_ep_s *privep, - uint8_t *buf, uint32_t nbytes) + struct rx65n_ep_s *privep, uint8_t *buf, + uint32_t nbytes) { uint8_t type; uint8_t g_buf[RX65N_USB_MAXP]; @@ -1752,19 +1749,19 @@ static void rx65n_epwrite(uint8_t epno, struct rx65n_usbdev_s *priv, if (type == ACM_GET_LINE_CODING) { usb_pstd_ctrl_read(nbytes, buf); - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); usb_data_read(g_buf, RX65N_USB_MAXP); } - else - { - usb_pstd_ctrl_read(nbytes, buf); - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } + else + { + usb_pstd_ctrl_read(nbytes, buf); + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } } else { usb_pstd_ctrl_read(nbytes, buf); - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } } @@ -1814,7 +1811,7 @@ static inline void rx65n_abortrequest(struct rx65n_ep_s *privep, int16_t result) { usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_REQABORTED), - (uint16_t)USB_EPNO(privep->ep.eplog)); + (uint16_t)USB_EPNO(privep->ep.eplog)); /* Save the result in the request structure */ @@ -1918,8 +1915,8 @@ static int rx65n_wrrequest(uint8_t epno, struct rx65n_usbdev_s *priv, for (; ; ) { - bytesleft = privreq->req.len - privreq->req.xfrd; - nbytes = bytesleft; + bytesleft = privreq->req.len - privreq->req.xfrd; + nbytes = bytesleft; /* Either (1) we are committed to sending the null packet * (because txnullpkt == 1 && nbytes == 0), or @@ -1977,7 +1974,7 @@ static int rx65n_wrrequest(uint8_t epno, struct rx65n_usbdev_s *priv, /* Return the write request to the class driver */ usbtrace(TRACE_COMPLETE(USB_EPNO(privep->ep.eplog)), - privreq->req.xfrd); + privreq->req.xfrd); privep->txnullpkt = 0; rx65n_reqcomplete(privep, OK); return OK; @@ -2078,7 +2075,7 @@ static void rx65n_dispatchrequest(struct rx65n_usbdev_s *priv) * ****************************************************************************/ -uint8_t usb_pstd_get_current_power (void) +uint8_t usb_pstd_get_current_power(void) { uint8_t currentpower; @@ -2115,7 +2112,7 @@ uint16_t usb_pstd_epadr2pipe(uint16_t dir_ep) /* WAIT_LOOP */ - for (i = USB_MIN_PIPE_NO; i < (USB_MAXPIPE_NUM +1); i++) + for (i = USB_MIN_PIPE_NO; i < (USB_MAXPIPE_NUM + 1); i++) { /* PIPECFG register will be set if PIPESEL register is set first */ @@ -2222,11 +2219,11 @@ void rx65n_ep0setup(struct rx65n_usbdev_s *priv) priv->ctrl.len[1] = MSBYTE(rx65n_getreg16(RX65N_USB_USBLENG)); uinfo("SETUP: type=%02x req=%02x value[0]=%02x value[1] =%02x \ - index[0]=%02x index[1] =%02x len[0]=%02x len[1]=%02x\n", - priv->ctrl.type, priv->ctrl.req, priv->ctrl.value[0], - priv->ctrl.value[1], priv->ctrl.index[0], - priv->ctrl.index[1], priv->ctrl.len[0], - priv->ctrl.len[1]); + index[0]=%02x index[1] =%02x len[0]=%02x len[1]=%02x\n", + priv->ctrl.type, priv->ctrl.req, priv->ctrl.value[0], + priv->ctrl.value[1], priv->ctrl.index[0], + priv->ctrl.index[1], priv->ctrl.len[0], + priv->ctrl.len[1]); /* And extract the little-endian 16-bit values to host order */ @@ -2281,440 +2278,440 @@ void rx65n_ep0setup(struct rx65n_usbdev_s *priv) switch (priv->ctrl.type & USB_REQ_RECIPIENT_MASK) { - case USB_REQ_RECIPIENT_ENDPOINT: - { - /* Endpoint number */ - - ep = (uint16_t) (index.w & USB_EPNUMFIELD); - - /* Endpoint 0 */ - - if (0 == ep) + case USB_REQ_RECIPIENT_ENDPOINT: { - buf = hw_usb_read_dcpctr(); - if ((uint16_t) 0 != (buf & USB_PID_STALL)) - { - /* Halt set */ + /* Endpoint number */ - tbl[0] = USB_GS_HALT; + ep = (uint16_t)(index.w & USB_EPNUMFIELD); + + /* Endpoint 0 */ + + if (0 == ep) + { + buf = hw_usb_read_dcpctr(); + if ((uint16_t)0 != (buf & USB_PID_STALL)) + { + /* Halt set */ + + tbl[0] = USB_GS_HALT; + } + + /* Control read start */ + + usb_pstd_ctrl_read((uint32_t)2, tbl); } - /* Control read start */ + /* EP1 to max */ - usb_pstd_ctrl_read((uint32_t) 2, tbl); - } + else if (ep <= USB_MAX_EP_NO) + { + if (USB_TRUE == usb_pstd_chk_configured()) + { + pipe = usb_pstd_epadr2pipe(g_usb_pstd_req_index); + if (USB_ERROR == pipe) + { + /* Set pipe USB_PID_STALL */ - /* EP1 to max */ + usb_pstd_set_stall_pipe0(); + } + else + { + buf = usb_cstd_get_pid(pipe); + if ((uint16_t)0 != (buf & USB_PID_STALL)) + { + /* Halt set */ - else if (ep <= USB_MAX_EP_NO) - { - if (USB_TRUE == usb_pstd_chk_configured()) - { - pipe = usb_pstd_epadr2pipe(g_usb_pstd_req_index); - if (USB_ERROR == pipe) + tbl[0] = USB_GS_HALT; + } + + /* Control read start */ + + usb_pstd_ctrl_read((uint32_t)2, tbl); + } + } + else { /* Set pipe USB_PID_STALL */ usb_pstd_set_stall_pipe0(); } - else - { - buf = usb_cstd_get_pid(pipe); - if ((uint16_t) 0 != (buf & USB_PID_STALL)) - { - /* Halt set */ + } + else + { + /* Set pipe USB_PID_STALL */ - tbl[0] = USB_GS_HALT; + usb_pstd_set_stall_pipe0(); + } + break; + + case USB_REQ_RECIPIENT_DEVICE: + { + if (0 == index.w) + { + /* Self powered / Bus powered */ + + tbl[0] = usb_pstd_get_current_power(); + + /* Support remote wakeup ? */ + + if (USB_TRUE == g_usb_pstd_remote_wakeup) + { + tbl[0] |= USB_GS_REMOTEWAKEUP; } - /* Control read start */ + /* Control read start */ - usb_pstd_ctrl_read((uint32_t) 2, tbl); - } - } - else - { - /* Set pipe USB_PID_STALL */ + usb_pstd_ctrl_read((uint32_t)2, tbl); + } + else + { + /* Request error */ - usb_pstd_set_stall_pipe0(); - } - } - else - { - /* Set pipe USB_PID_STALL */ + usb_pstd_set_stall_pipe0(); + } + } + break; - usb_pstd_set_stall_pipe0(); + case USB_REQ_RECIPIENT_INTERFACE: + { + if (USB_TRUE == usb_pstd_chk_configured()) + { + /* 2 is number of interfaces, + * as configured by class driver + */ + + if (g_usb_pstd_req_index < 2) + + { + /* Control read start */ + + usb_pstd_ctrl_read((uint32_t)2, tbl); + } + else + { + /* Request error (not exist interface) */ + + usb_pstd_set_stall_pipe0(); + } + } + else + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + } + break; + + default: + { + usb_pstd_set_stall_pipe0(); + } + break; + } } - break; + } + } + break; + case USB_REQ_CLEARFEATURE: + { + /* type: host-to-device; recipient = device, interface or endpoint + * value: feature selector + * index: zero interface endpoint; + * len: zero, data = none + */ - case USB_REQ_RECIPIENT_DEVICE: - { - if (0 == index.w) - { - /* Self powered / Bus powered */ + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_CLEARFEATURE), + priv->ctrl.type); + if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) != + USB_REQ_RECIPIENT_ENDPOINT) + { + /* Let the class implementation handle all recipients + * (except for the endpoint recipient) + */ - tbl[0] = usb_pstd_get_current_power(); + rx65n_dispatchrequest(priv); + } + else + { + /* Endpoint recipient */ - /* Support remote wakeup ? */ - - if (USB_TRUE == g_usb_pstd_remote_wakeup) - { - tbl[0] |= USB_GS_REMOTEWAKEUP; - } - - /* Control read start */ - - usb_pstd_ctrl_read((uint32_t) 2, tbl); - } - else - { - /* Request error */ - - usb_pstd_set_stall_pipe0(); - } - } - break; - - case USB_REQ_RECIPIENT_INTERFACE: - { - if (USB_TRUE == usb_pstd_chk_configured()) - { - /* 2 is number of interfaces, - * as configured by class driver - */ - - if (g_usb_pstd_req_index < 2) - - { - /* Control read start */ - - usb_pstd_ctrl_read((uint32_t) 2, tbl); - } - else - { - /* Request error (not exist interface) */ - - usb_pstd_set_stall_pipe0(); - } - } - else - { - /* Request error */ - - usb_pstd_set_stall_pipe0(); - } - } - break; - - default: - { - usb_pstd_set_stall_pipe0(); - } - break; - } - } - } - } - break; - case USB_REQ_CLEARFEATURE: - { - /* type: host-to-device; recipient = device, interface or endpoint - * value: feature selector - * index: zero interface endpoint; - * len: zero, data = none - */ - - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_CLEARFEATURE), - priv->ctrl.type); - if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) != - USB_REQ_RECIPIENT_ENDPOINT) - { - /* Let the class implementation handle all recipients - * (except for the endpoint recipient) - */ - - rx65n_dispatchrequest(priv); - } - else - { - /* Endpoint recipient */ - - epno = USB_EPNO(index.b[LSB]); - if (USB_ENDPOINT_HALT == value.w) + epno = USB_EPNO(index.b[LSB]); + if (USB_ENDPOINT_HALT == value.w) { - /* EP0 */ + /* EP0 */ - if (0 == epno) + if (0 == epno) { - /* Stall clear */ + /* Stall clear */ - usb_cstd_clr_stall((uint16_t) USB_PIPE0); + usb_cstd_clr_stall((uint16_t)USB_PIPE0); - /* Set pipe PID_BUF */ + /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } - /* EP1 to max */ + /* EP1 to max */ - else if (epno <= USB_MAX_EP_NO) - { - pipe = usb_pstd_epadr2pipe(index.w); - if (USB_ERROR == pipe) - { - /* Request error */ + else if (epno <= USB_MAX_EP_NO) + { + pipe = usb_pstd_epadr2pipe(index.w); + if (USB_ERROR == pipe) + { + /* Request error */ - usb_pstd_set_stall_pipe0(); - } - else - { - if (USB_PID_BUF == usb_cstd_get_pid(pipe)) - { - usb_cstd_set_nak(pipe); + usb_pstd_set_stall_pipe0(); + } + else + { + if (USB_PID_BUF == usb_cstd_get_pid (pipe)) + { + usb_cstd_set_nak(pipe); - /* SQCLR=1 */ + /* SQCLR=1 */ - hw_usb_set_sqclr(pipe); + hw_usb_set_sqclr(pipe); - /* Set pipe PID_BUF */ + /* Set pipe PID_BUF */ - usb_cstd_set_buf(pipe); - } - else - { - usb_cstd_clr_stall(pipe); + usb_cstd_set_buf(pipe); + } + else + { + usb_cstd_clr_stall(pipe); - /* SQCLR=1 */ + /* SQCLR=1 */ - hw_usb_set_sqclr(pipe); - } + hw_usb_set_sqclr(pipe); + } /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - } - else + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + } + else { - /* Request error */ + /* Request error */ - usb_pstd_set_stall_pipe0(); + usb_pstd_set_stall_pipe0(); } } - } - } - break; + } + } + break; - case USB_REQ_SETFEATURE: - { - /* type: host-to-device; recipient = device, interface, endpoint - * value: feature selector - * index: zero interface endpoint; + case USB_REQ_SETFEATURE: + { + /* type: host-to-device; recipient = device, interface, endpoint + * value: feature selector + * index: zero interface endpoint; + * len: 0; data = none + */ + + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SETFEATURE), + priv->ctrl.type); + if (((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) == + USB_REQ_RECIPIENT_DEVICE) && value.w == USB_FEATURE_TESTMODE) + { + /* Special case recipient=device test mode */ + + uinfo ("test mode: %d\n", index.w); + } + else if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) != + USB_REQ_RECIPIENT_ENDPOINT) + { + /* The class driver handles all recipients + * except recipient=endpoint + */ + + rx65n_dispatchrequest (priv); + } + else + { + /* Handler recipient=endpoint */ + + epno = USB_EPNO(index.b[LSB]); + if (USB_ENDPOINT_HALT == value.w) + { + /* EP0 */ + + if (0 == epno) + { + /* Set pipe PID_BUF */ + + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + + /* EP1 to max */ + + else if (epno <= USB_MAX_EP_NO) + { + pipe = usb_pstd_epadr2pipe(index.w); + if (USB_ERROR == pipe) + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + else + { + /* Set pipe USB_PID_STALL */ + + usb_pstd_set_stall(pipe); + + /* Set pipe PID_BUF */ + + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + } + else + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + } + else + { + /* Not specification */ + + usb_pstd_set_stall_pipe0(); + } + } + } + break; + + case USB_REQ_SETADDRESS: + { + /* type: host-to-device; recipient = device + * value: device address + * index: 0 + * len: 0; data = none + */ + + if ((0 == index.w) && (0 == len.w)) + { + if (value.w <= 127) + { + /* Set pipe PID_BUF */ + + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + else + { + /* Not specification */ + + usb_pstd_set_stall_pipe0(); + } + } + else + { + /* Not specification */ + + usb_pstd_set_stall_pipe0(); + } + } + break; + + case USB_REQ_GETDESCRIPTOR: + case USB_REQ_SETDESCRIPTOR: + /* type: host-to-device; recipient = device + * value: descriptor type and index + * index: 0 or language ID; + * len: descriptor len; data = descriptor + */ + + { + uinfo("Get Descriptor Request Got from Host"); + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_GETCONFIG), + priv->ctrl.type); + /* The request seems valid... let the class + * implementation handle it + */ + + rx65n_dispatchrequest(priv); + } + break; + + case USB_REQ_GETCONFIGURATION: + + /* type: device-to-host; recipient = device + * value: 0; + * index: 0; + * len: 1; data = configuration value + */ + + case USB_REQ_SETCONFIGURATION: + + /* type: host-to-device; recipient = device + * value: configuration value + * index: 0; * len: 0; data = none */ - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SETFEATURE), - priv->ctrl.type); - if (((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) == - USB_REQ_RECIPIENT_DEVICE) && value.w == USB_FEATURE_TESTMODE) - { - /* Special case recipient=device test mode */ - - uinfo("test mode: %d\n", index.w); - } - else if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) != - USB_REQ_RECIPIENT_ENDPOINT) - { - /* The class driver handles all recipients - * except recipient=endpoint - */ - - rx65n_dispatchrequest(priv); - } - else - { - /* Handler recipient=endpoint */ - - epno = USB_EPNO(index.b[LSB]); - if (USB_ENDPOINT_HALT == value.w) - { - /* EP0 */ - - if (0 == epno) - { - /* Set pipe PID_BUF */ - - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - - /* EP1 to max */ - - else if (epno <= USB_MAX_EP_NO) - { - pipe = usb_pstd_epadr2pipe(index.w); - if (USB_ERROR == pipe) - { - /* Request error */ - - usb_pstd_set_stall_pipe0(); - } - else - { - /* Set pipe USB_PID_STALL */ - - usb_pstd_set_stall(pipe); - - /* Set pipe PID_BUF */ - - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - } - else - { - /* Request error */ - - usb_pstd_set_stall_pipe0(); - } - } - else - { - /* Not specification */ - - usb_pstd_set_stall_pipe0(); - } - } - } - break; - - case USB_REQ_SETADDRESS: - { - /* type: host-to-device; recipient = device - * value: device address - * index: 0 - * len: 0; data = none - */ - - if ((0 == index.w) && (0 == len.w)) - { - if (value.w <= 127) - { - /* Set pipe PID_BUF */ - - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - else - { - /* Not specification */ - - usb_pstd_set_stall_pipe0(); - } - } - else - { - /* Not specification */ - - usb_pstd_set_stall_pipe0(); - } - } - break; - - case USB_REQ_GETDESCRIPTOR: - case USB_REQ_SETDESCRIPTOR: - /* type: host-to-device; recipient = device - * value: descriptor type and index - * index: 0 or language ID; - * len: descriptor len; data = descriptor - */ - - { - uinfo("Get Descriptor Request Got from Host"); - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_GETCONFIG), - priv->ctrl.type); - /* The request seems valid... let the class - * implementation handle it - */ - - rx65n_dispatchrequest(priv); - } - break; - - case USB_REQ_GETCONFIGURATION: - - /* type: device-to-host; recipient = device - * value: 0; - * index: 0; - * len: 1; data = configuration value - */ - - case USB_REQ_SETCONFIGURATION: - - /* type: host-to-device; recipient = device - * value: configuration value - * index: 0; - * len: 0; data = none - */ - - { - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SETCONFIG), 0); - if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) == - USB_REQ_RECIPIENT_DEVICE) - { - rx65n_dispatchrequest(priv); - } - else - { - usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_BADSETCONFIG), 0); - priv->stalled = 1; - } - } - break; - - case USB_REQ_GETINTERFACE: - - /* type: device-to-host; recipient = interface - * value: 0 - * index: interface; - * len: 1; data = alt interface - */ - - case USB_REQ_SETINTERFACE: - - /* type: host-to-device; recipient = interface - * value: alternate setting - * index: interface; - * len: 0; data = none - */ - - { - /* Let the class implementation handle the request */ - - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_GETSETIF), - priv->ctrl.type); - rx65n_dispatchrequest(priv); - } - break; - - case USB_REQ_SYNCHFRAME: - - /* type: device-to-host; recipient = endpoint - * value: 0 - * index: endpoint; - * len: 2; data = frame number - */ - - { - usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SYNCHFRAME), 0); - } - break; - - default: - { - usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_INVALIDCTRLREQ), - priv->ctrl.req); - priv->ep0state = EP0STATE_STALLED; - } - break; + { + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SETCONFIG), 0); + if ((priv->ctrl.type & USB_REQ_RECIPIENT_MASK) == + USB_REQ_RECIPIENT_DEVICE) + { + rx65n_dispatchrequest(priv); + } + else + { + usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_BADSETCONFIG), 0); + priv->stalled = 1; + } } + break; + + case USB_REQ_GETINTERFACE: + + /* type: device-to-host; recipient = interface + * value: 0 + * index: interface; + * len: 1; data = alt interface + */ + + case USB_REQ_SETINTERFACE: + + /* type: host-to-device; recipient = interface + * value: alternate setting + * index: interface; + * len: 0; data = none + */ + + { + /* Let the class implementation handle the request */ + + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_GETSETIF), + priv->ctrl.type); + rx65n_dispatchrequest(priv); + } + break; + + case USB_REQ_SYNCHFRAME: + + /* type: device-to-host; recipient = endpoint + * value: 0 + * index: endpoint; + * len: 2; data = frame number + */ + + { + usbtrace(TRACE_INTDECODE(RX65N_TRACEINTID_SYNCHFRAME), 0); + } + break; + + default: + { + usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_INVALIDCTRLREQ), + priv->ctrl.req); + priv->ep0state = EP0STATE_STALLED; + } + break; + } } /**************************************************************************** @@ -2745,7 +2742,7 @@ uint16_t usb_pstd_pipe2fport(uint16_t pipe) * ****************************************************************************/ -static void hw_usb_write_pipeperi (uint16_t data) +static void hw_usb_write_pipeperi(uint16_t data) { rx65n_putreg16(data, RX65N_USB_PIPEPERI); } @@ -2758,8 +2755,8 @@ static void hw_usb_write_pipeperi (uint16_t data) * ****************************************************************************/ -static void usb_cstd_pipe_init (uint16_t pipe, uint16_t pipe_cfg, - uint16_t maxpacket) +static void usb_cstd_pipe_init(uint16_t pipe, uint16_t pipe_cfg, + uint16_t maxpacket) { uint16_t pipe_peri = 0; @@ -2825,9 +2822,9 @@ static void usb_cstd_pipe_init (uint16_t pipe, uint16_t pipe_cfg, * ****************************************************************************/ -void usb_pstd_set_pipe_reg (uint16_t pipe_no, uint16_t pipe_cfgint, - uint16_t pipe_cfgbulkin, - uint16_t pipe_cfgbulkout, uint16_t maxpacket) +void usb_pstd_set_pipe_reg(uint16_t pipe_no, uint16_t pipe_cfgint, + uint16_t pipe_cfgbulkin, + uint16_t pipe_cfgbulkout, uint16_t maxpacket) { /* Search use pipe block */ @@ -2840,12 +2837,12 @@ void usb_pstd_set_pipe_reg (uint16_t pipe_no, uint16_t pipe_cfgint, usb_cstd_pipe_init (pipe_no, pipe_cfgbulkin, maxpacket); } - if (pipe_no == INT_IN_PIPE) + else if (pipe_no == INT_IN_PIPE) { usb_cstd_pipe_init (pipe_no, pipe_cfgint, maxpacket); } - if (pipe_no == BULK_OUT_PIPE) + else sif (pipe_no == BULK_OUT_PIPE) { usb_cstd_pipe_init (pipe_no, pipe_cfgbulkout, maxpacket); } @@ -2870,13 +2867,12 @@ void usb_pstd_set_pipe_reg (uint16_t pipe_no, uint16_t pipe_cfgint, * ****************************************************************************/ -static int rx65n_epconfigure(FAR struct usbdev_ep_s *ep, - FAR const struct usb_epdesc_s *desc, - bool last) +static int rx65n_epconfigure(struct usbdev_ep_s *ep, + const struct usb_epdesc_s *desc, bool last) { uint16_t maxpacket; uint8_t epno; - uint16_t pipe_no = 0 ; + uint16_t pipe_no = 0; uint16_t pipe_cfg_int = 0; uint16_t pipe_cfg_bulkin = 0; uint16_t pipe_cfg_bulkout = 0; @@ -2902,63 +2898,63 @@ static int rx65n_epconfigure(FAR struct usbdev_ep_s *ep, switch (desc->attr & USB_EP_ATTR_XFERTYPE_MASK) { case USB_EP_ATTR_XFER_INT: /* Interrupt endpoint */ - if (USB_ISEPIN(desc->addr) && epno == INT_IN_EPNUM) - { - /* The full, logical EP number includes direction */ + if (USB_ISEPIN(desc->addr) && epno == INT_IN_EPNUM) + { + /* The full, logical EP number includes direction */ - ep->eplog = USB_EPIN(epno); - pipe_no = INT_IN_PIPE; - pipe_cfg_int = (uint16_t)(USB_TYPFIELD_INT | USB_DIR_P_IN | epno); - } + ep->eplog = USB_EPIN(epno); + pipe_no = INT_IN_PIPE; + pipe_cfg_int = (uint16_t)(USB_TYPFIELD_INT | USB_DIR_P_IN | epno); + } - if (USB_ISEPOUT(desc->addr)) - { - /* The full, logical EP number includes direction */ + if (USB_ISEPOUT(desc->addr)) + { + /* The full, logical EP number includes direction */ - ep->eplog = USB_EPOUT(epno); - pipe_no = INT_OUT_PIPE; - pipe_cfg_int = (uint16_t)(USB_TYPFIELD_INT | USB_DIR_P_OUT | epno); - } - break; + ep->eplog = USB_EPOUT(epno); + pipe_no = INT_OUT_PIPE; + pipe_cfg_int = (uint16_t)(USB_TYPFIELD_INT | USB_DIR_P_OUT | epno); + } + break; case USB_EP_ATTR_XFER_BULK: /* Bulk endpoint */ - if (USB_ISEPIN(desc->addr) && epno == BULK_IN_EPNUM) - { - /* The full, logical EP number includes direction */ + if (USB_ISEPIN(desc->addr) && epno == BULK_IN_EPNUM) + { + /* The full, logical EP number includes direction */ - ep->eplog = USB_EPIN(epno); - pipe_no = BULK_IN_PIPE; - pipe_cfg_bulkin = (uint16_t)(USB_TYPFIELD_BULK | USB_CFG_DBLB | - USB_DIR_P_IN | epno); - } + ep->eplog = USB_EPIN(epno); + pipe_no = BULK_IN_PIPE; + pipe_cfg_bulkin = (uint16_t)(USB_TYPFIELD_BULK | USB_CFG_DBLB | + USB_DIR_P_IN | epno); + } - if (USB_ISEPOUT(desc->addr)) - { - /* The full, logical EP number includes direction */ + if (USB_ISEPOUT(desc->addr)) + { + /* The full, logical EP number includes direction */ - ep->eplog = USB_EPOUT(epno); - pipe_no = BULK_OUT_PIPE; - pipe_cfg_bulkout = (uint16_t)(USB_TYPFIELD_BULK | USB_CFG_DBLB | - USB_SHTNAKFIELD | USB_DIR_P_OUT | epno); - } + ep->eplog = USB_EPOUT(epno); + pipe_no = BULK_OUT_PIPE; + pipe_cfg_bulkout= (uint16_t)(USB_TYPFIELD_BULK | USB_CFG_DBLB | + USB_SHTNAKFIELD | USB_DIR_P_OUT | epno); + } - break; + break; case USB_EP_ATTR_XFER_ISOC: /* Isochronous endpoint */ - /* Not Supported */ + /* Not Supported */ - break; + break; case USB_EP_ATTR_XFER_CONTROL: /* Control endpoint */ - hw_usb_write_dcpcfg(0); - hw_usb_write_dcpmxps(USB_DCPMAXP); - break; + hw_usb_write_dcpcfg(0); + hw_usb_write_dcpmxps(USB_DCPMAXP); + break; default: - usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_BADEPTYPE), - (uint16_t)desc->type); - return -EINVAL; + usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_BADEPTYPE), + (uint16_t)desc->type); + return -EINVAL; } maxpacket = GETUINT16(desc->mxpacketsize); @@ -3012,7 +3008,7 @@ static int rx65n_epdisable(struct usbdev_ep_s *ep) * ****************************************************************************/ -static FAR struct usbdev_req_s *rx65n_epallocreq(FAR struct usbdev_ep_s *ep) +static struct usbdev_req_s *rx65n_epallocreq(struct usbdev_ep_s *ep) { struct rx65n_req_s *privreq; @@ -3045,8 +3041,7 @@ static FAR struct usbdev_req_s *rx65n_epallocreq(FAR struct usbdev_ep_s *ep) * ****************************************************************************/ -static void rx65n_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct - usbdev_req_s *req) +static void rx65n_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req) { struct rx65n_req_s *privreq = (struct rx65n_req_s *)req; #ifdef CONFIG_DEBUG_FEATURES @@ -3069,8 +3064,7 @@ static void rx65n_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct * ****************************************************************************/ -static int rx65n_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct - usbdev_req_s *req) +static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req) { struct rx65n_req_s *privreq = (struct rx65n_req_s *)req; struct rx65n_ep_s *privep = (struct rx65n_ep_s *)ep; @@ -3241,8 +3235,8 @@ static int rx65n_epcancel(struct usbdev_ep_s *ep, struct usbdev_req_s *req) * Name: rx65n_epreserve ****************************************************************************/ -static inline struct rx65n_ep_s * -rx65n_epreserve(struct rx65n_usbdev_s *priv, uint8_t epset) +static inline struct rx65n_ep_s *rx65n_epreserve(struct rx65n_usbdev_s *priv, + uint8_t epset) { struct rx65n_ep_s *privep = NULL; irqstate_t flags; @@ -3298,9 +3292,8 @@ rx65n_epreserve(struct rx65n_usbdev_s *priv, uint8_t epset) * ****************************************************************************/ -static FAR struct usbdev_ep_s *rx65n_allocep(FAR struct usbdev_s *dev, - uint8_t epno, bool in, - uint8_t eptype) +static struct usbdev_ep_s *rx65n_allocep(struct usbdev_s *dev, uint8_t epno, + bool in, uint8_t eptype) { struct rx65n_usbdev_s *priv = (struct rx65n_usbdev_s *)dev; struct rx65n_ep_s *privep = NULL; @@ -3366,11 +3359,10 @@ errout: ****************************************************************************/ static inline void -rx65n_epunreserve(struct rx65n_usbdev_s *priv, - struct rx65n_ep_s *privep) +rx65n_epunreserve(struct rx65n_usbdev_s *priv, struct rx65n_ep_s *privep) { irqstate_t flags = enter_critical_section(); - priv->epavail |= RX65N_ENDP_BIT(USB_EPNO(privep->ep.eplog)); + priv->epavail |= RX65N_ENDP_BIT(USB_EPNO(privep->ep.eplog)); leave_critical_section(flags); } @@ -3382,7 +3374,7 @@ rx65n_epunreserve(struct rx65n_usbdev_s *priv, * ****************************************************************************/ -static void rx65n_freeep(FAR struct usbdev_s *dev, FAR struct +static void rx65n_freeep(struct usbdev_s *dev, struct usbdev_ep_s *ep) { struct rx65n_usbdev_s *priv; @@ -3503,7 +3495,7 @@ int rx65n_pullup(struct usbdev_s *dev, bool enable) * ****************************************************************************/ -void usb_pstd_attach_process (void) +void usb_pstd_attach_process(void) { uint16_t regval; @@ -3537,7 +3529,7 @@ void hw_usb_pclear_dprpu(void) * ****************************************************************************/ -static void hw_usb_clear_aclrm (uint16_t pipeno) +static void hw_usb_clear_aclrm(uint16_t pipeno) { uint16_t *p_reg; @@ -3554,13 +3546,13 @@ static void hw_usb_clear_aclrm (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_set_aclrm (uint16_t pipeno) +static void hw_usb_set_aclrm(uint16_t pipeno) { uint16_t *p_reg; - p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); + p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); - (*p_reg) |= USB_ACLRM; + (*p_reg) |= USB_ACLRM; } /**************************************************************************** @@ -3571,7 +3563,7 @@ static void hw_usb_set_aclrm (uint16_t pipeno) * ****************************************************************************/ -static void usb_cstd_do_aclrm (uint16_t pipe) +static void usb_cstd_do_aclrm(uint16_t pipe) { if (USB_MAXPIPE_NUM < pipe) { @@ -3593,7 +3585,7 @@ static void usb_cstd_do_aclrm (uint16_t pipe) * ****************************************************************************/ -static void hw_usb_set_curpipe (uint16_t pipemode, uint16_t pipeno) +static void hw_usb_set_curpipe(uint16_t pipemode, uint16_t pipeno) { uint16_t *p_reg; uint16_t reg; @@ -3629,13 +3621,13 @@ static void hw_usb_set_curpipe (uint16_t pipemode, uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_rmw_fifosel (uint16_t pipemode, - uint16_t data, uint16_t bitptn) +static void hw_usb_rmw_fifosel(uint16_t pipemode, uint16_t data, + uint16_t bitptn) { uint16_t buf; uint16_t *p_reg; - p_reg = (uint16_t *) hw_usb_get_fifosel_adr(pipemode); + p_reg = (uint16_t *)hw_usb_get_fifosel_adr(pipemode); buf = *p_reg; buf &= (~bitptn); @@ -3651,49 +3643,49 @@ static void hw_usb_rmw_fifosel (uint16_t pipemode, * ****************************************************************************/ -static void usb_cstd_chg_curpipe (uint16_t pipe, - uint16_t fifosel, uint16_t isel) +static void usb_cstd_chg_curpipe(uint16_t pipe, uint16_t fifosel, + uint16_t isel) { uint16_t buf; /* Select FIFO */ switch (fifosel) - { - /* CFIFO use */ + { + /* CFIFO use */ - case USB_CUSE : + case USB_CUSE: - /* ISEL=1, CURPIPE=0 */ + /* ISEL=1, CURPIPE=0 */ - hw_usb_rmw_fifosel(USB_CUSE, ((USB_RCNT | isel) | pipe), - ((USB_RCNT | USB_ISEL) | USB_CURPIPE)); - break; + hw_usb_rmw_fifosel(USB_CUSE, ((USB_RCNT | isel) | pipe), + ((USB_RCNT | USB_ISEL) | USB_CURPIPE)); + break; - /* D0FIFO use */ + /* D0FIFO use */ - case USB_D0USE : + case USB_D0USE: - /* D1FIFO use */ + /* D1FIFO use */ - case USB_D1USE : + case USB_D1USE: - /* DxFIFO pipe select */ + /* DxFIFO pipe select */ - hw_usb_set_curpipe (fifosel, pipe); + hw_usb_set_curpipe(fifosel, pipe); - /* WAIT_LOOP */ + /* WAIT_LOOP */ - do - { - buf = hw_usb_read_fifosel (fifosel); - } - while ((uint16_t)(buf & USB_CURPIPE) != pipe); - break; + do + { + buf = hw_usb_read_fifosel(fifosel); + } + while ((uint16_t)(buf & USB_CURPIPE) != pipe); + break; - default : - break; - } + default: + break; + } } /**************************************************************************** @@ -3704,26 +3696,26 @@ static void usb_cstd_chg_curpipe (uint16_t pipe, * ****************************************************************************/ -static void *hw_usb_get_fifosel_adr (uint16_t pipemode) +static void *hw_usb_get_fifosel_adr(uint16_t pipemode) { void *p_reg = NULL; - switch (pipemode) - { - case USB_CUSE: - p_reg = (void *)RX65N_USB_CFIFOSEL; - break; + switch (pipemode) + { + case USB_CUSE: + p_reg = (void *)RX65N_USB_CFIFOSEL; + break; - case USB_D0USE: - p_reg = (void *)RX65N_USB_D0FIFOSEL; - break; + case USB_D0USE: + p_reg = (void *)RX65N_USB_D0FIFOSEL; + break; - case USB_D1USE: - p_reg = (void *)RX65N_USB_D1FIFOSEL; - break; + case USB_D1USE: + p_reg = (void *)RX65N_USB_D1FIFOSEL; + break; - default: - break; + default: + break; } return p_reg; @@ -3737,7 +3729,7 @@ static void *hw_usb_get_fifosel_adr (uint16_t pipemode) * ****************************************************************************/ -static uint16_t hw_usb_read_fifosel (uint16_t pipemode) +static uint16_t hw_usb_read_fifosel(uint16_t pipemode) { uint16_t *p_reg; @@ -3754,13 +3746,13 @@ static uint16_t hw_usb_read_fifosel (uint16_t pipemode) * ****************************************************************************/ -static void hw_usb_set_trclr (uint16_t pipeno) +static void hw_usb_set_trclr(uint16_t pipeno) { uint16_t *p_reg; - p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + ((pipeno - 1) * 2); + p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + ((pipeno - 1) * 2); - (*p_reg) |= USB_TRCLR; + (*p_reg) |= USB_TRCLR; } /**************************************************************************** @@ -3771,7 +3763,7 @@ static void hw_usb_set_trclr (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_trenb (uint16_t pipeno) +static void hw_usb_clear_trenb(uint16_t pipeno) { uint16_t *p_reg; @@ -3787,10 +3779,10 @@ static void hw_usb_clear_trenb (uint16_t pipeno) * ****************************************************************************/ -static void usb_cstd_clr_transaction_counter (uint16_t trnreg) +static void usb_cstd_clr_transaction_counter(uint16_t trnreg) { - hw_usb_clear_trenb(trnreg); - hw_usb_set_trclr(trnreg); + hw_usb_clear_trenb(trnreg); + hw_usb_set_trclr(trnreg); } /**************************************************************************** @@ -3801,7 +3793,7 @@ static void usb_cstd_clr_transaction_counter (uint16_t trnreg) * ****************************************************************************/ -static void hw_usb_clear_bempenb (uint16_t pipeno) +static void hw_usb_clear_bempenb(uint16_t pipeno) { uint16_t regval; @@ -3818,13 +3810,13 @@ static void hw_usb_clear_bempenb (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_nrdyenb (uint16_t pipeno) +static void hw_usb_clear_nrdyenb(uint16_t pipeno) { uint16_t regval; - regval = rx65n_getreg16(RX65N_USB_NRDYENB); - regval &= (~(1 << pipeno)); - rx65n_putreg16(regval, RX65N_USB_NRDYENB); + regval = rx65n_getreg16(RX65N_USB_NRDYENB); + regval &= (~(1 << pipeno)); + rx65n_putreg16(regval, RX65N_USB_NRDYENB); } /**************************************************************************** @@ -3835,13 +3827,13 @@ static void hw_usb_clear_nrdyenb (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_brdyenb (uint16_t pipeno) +static void hw_usb_clear_brdyenb(uint16_t pipeno) { - uint16_t regval; + uint16_t regval; - regval = rx65n_getreg16(RX65N_USB_BRDYENB); - regval &= (~(1 << pipeno)); - rx65n_putreg16(regval, RX65N_USB_BRDYENB); + regval = rx65n_getreg16(RX65N_USB_BRDYENB); + regval &= (~(1 << pipeno)); + rx65n_putreg16(regval, RX65N_USB_BRDYENB); } /**************************************************************************** @@ -3852,18 +3844,18 @@ static void hw_usb_clear_brdyenb (uint16_t pipeno) * ****************************************************************************/ -static uint16_t hw_usb_read_pipectr (uint16_t pipeno) +static uint16_t hw_usb_read_pipectr(uint16_t pipeno) { uint16_t *p_reg; - if (USB_PIPE0 == pipeno) - { - p_reg = (uint16_t *)RX65N_USB_DCPCTR; - } - else - { - p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); - } + if (USB_PIPE0 == pipeno) + { + p_reg = (uint16_t *)RX65N_USB_DCPCTR; + } + else + { + p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); + } return *p_reg; } @@ -3876,18 +3868,18 @@ static uint16_t hw_usb_read_pipectr (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_pid (uint16_t pipeno, uint16_t data) +static void hw_usb_clear_pid(uint16_t pipeno, uint16_t data) { uint16_t *p_reg; - if (USB_PIPE0 == pipeno) - { - p_reg = (uint16_t *)RX65N_USB_DCPCTR; - } - else - { - p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); - } + if (USB_PIPE0 == pipeno) + { + p_reg = (uint16_t *)RX65N_USB_DCPCTR; + } + else + { + p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR) + (pipeno - 1); + } (*p_reg) &= (~data); } @@ -3900,14 +3892,14 @@ static void hw_usb_clear_pid (uint16_t pipeno, uint16_t data) * ****************************************************************************/ -static void usb_cstd_set_nak (uint16_t pipe) +static void usb_cstd_set_nak(uint16_t pipe) { uint16_t buf; uint16_t n; /* Set NAK */ - hw_usb_clear_pid(pipe, (uint16_t) USB_PID_BUF); + hw_usb_clear_pid(pipe, (uint16_t)USB_PID_BUF); /* The state of PBUSY continues while transmitting * the packet when it is a detach. @@ -3928,7 +3920,7 @@ static void usb_cstd_set_nak (uint16_t pipe) /* PIPE control reg read */ buf = hw_usb_read_pipectr(pipe); - if (0 == (uint16_t) (buf & USB_PBUSY)) + if (0 == (uint16_t)(buf & USB_PBUSY)) { n = 0xfffe; } @@ -3977,8 +3969,8 @@ void usb_pstd_forced_termination(uint16_t pipe, uint16_t status) { /* Changes the FIFO port by the pipe. */ - usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, - (uint16_t) USB_CUSE, USB_FALSE); + usb_cstd_chg_curpipe((uint16_t)USB_PIPE0, (uint16_t)USB_CUSE, + USB_FALSE); } /* Do Aclr */ @@ -3994,7 +3986,7 @@ void usb_pstd_forced_termination(uint16_t pipe, uint16_t status) * ****************************************************************************/ -static void usb_cstd_clr_stall (uint16_t pipe) +static void usb_cstd_clr_stall(uint16_t pipe) { if (USB_MAXPIPE_NUM < pipe) { @@ -4018,7 +4010,7 @@ static void usb_cstd_clr_stall (uint16_t pipe) * ****************************************************************************/ -static void hw_usb_write_pipesel (uint16_t data) +static void hw_usb_write_pipesel(uint16_t data) { rx65n_putreg16(data, RX65N_USB_PIPESEL); } @@ -4044,7 +4036,7 @@ static void hw_usb_write_pipecfg (uint16_t data) * ****************************************************************************/ -static void hw_usb_write_pipemaxp (uint16_t data) +static void hw_usb_write_pipemaxp(uint16_t data) { rx65n_putreg16(data, RX65N_USB_PIPEMAXP); } @@ -4065,7 +4057,7 @@ static void hw_usb_write_pipemaxp (uint16_t data) * ****************************************************************************/ -static void hw_usb_set_sqclr (uint16_t pipeno) +static void hw_usb_set_sqclr(uint16_t pipeno) { uint16_t *p_reg; uint16_t regval; @@ -4091,10 +4083,10 @@ static void hw_usb_set_sqclr (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_sts_brdy (uint16_t pipeno) +static void hw_usb_clear_sts_brdy(uint16_t pipeno) { rx65n_putreg16((~(1 << pipeno)) & RX65N_USB_PIPE_ALL, - RX65N_USB_BRDYSTS); + RX65N_USB_BRDYSTS); } /**************************************************************************** @@ -4105,10 +4097,10 @@ static void hw_usb_clear_sts_brdy (uint16_t pipeno) * ****************************************************************************/ -static void hw_usb_clear_status_nrdy (uint16_t pipeno) +static void hw_usb_clear_status_nrdy(uint16_t pipeno) { rx65n_putreg16((~(1 << pipeno)) & RX65N_USB_PIPE_ALL, - RX65N_USB_NRDYSTS); + RX65N_USB_NRDYSTS); } /**************************************************************************** @@ -4119,7 +4111,7 @@ static void hw_usb_clear_status_nrdy (uint16_t pipeno) * ****************************************************************************/ -static void usb_cstd_clr_pipe_cnfg (uint16_t pipe_no) +static void usb_cstd_clr_pipe_cnfg(uint16_t pipe_no) { /* PID=NAK & clear STALL */ @@ -4141,7 +4133,7 @@ static void usb_cstd_clr_pipe_cnfg (uint16_t pipe_no) /* PIPE Configuration */ - usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, (uint16_t) USB_CUSE, USB_FALSE); + usb_cstd_chg_curpipe((uint16_t)USB_PIPE0, (uint16_t)USB_CUSE, USB_FALSE); hw_usb_write_pipesel(pipe_no); hw_usb_write_pipecfg(0); @@ -4183,10 +4175,10 @@ static void usb_cstd_clr_pipe_cnfg (uint16_t pipe_no) * ****************************************************************************/ -static void hw_usb_clear_status_bemp (uint16_t pipeno) +static void hw_usb_clear_status_bemp(uint16_t pipeno) { rx65n_putreg16((~(1 << pipeno)) & RX65N_USB_PIPE_ALL, - RX65N_USB_BEMPSTS); + RX65N_USB_BEMPSTS); } /**************************************************************************** @@ -4197,7 +4189,7 @@ static void hw_usb_clear_status_bemp (uint16_t pipeno) * ****************************************************************************/ -void usb_pstd_detach_process (void) +void usb_pstd_detach_process(void) { int i; @@ -4222,7 +4214,7 @@ void usb_pstd_detach_process (void) * ****************************************************************************/ -uint16_t usb_pstd_chk_vbsts (void) +uint16_t usb_pstd_chk_vbsts(void) { uint16_t buf1; uint16_t buf2; @@ -4246,7 +4238,7 @@ uint16_t usb_pstd_chk_vbsts (void) ((buf2 & RX65N_USB_INTSTS0_VBSTS) != (buf3 & RX65N_USB_INTSTS0_VBSTS))); - if ((uint16_t) 0 != (buf1 & RX65N_USB_INTSTS0_VBSTS)) + if ((uint16_t)0 != (buf1 & RX65N_USB_INTSTS0_VBSTS)) { /* Attach */ @@ -4271,7 +4263,7 @@ uint16_t usb_pstd_chk_vbsts (void) * ****************************************************************************/ -static uint16_t hw_usb_read_dvstctr () +static uint16_t hw_usb_read_dvstctr(void) { uint16_t regval; @@ -4288,7 +4280,7 @@ static uint16_t hw_usb_read_dvstctr () * ****************************************************************************/ -uint16_t usb_cstd_port_speed () +uint16_t usb_cstd_port_speed(void) { uint16_t buf; uint16_t conn_inf; @@ -4297,30 +4289,30 @@ uint16_t usb_cstd_port_speed () /* Reset handshake status get */ - buf = (uint16_t) (buf & USB_RHST); + buf = (uint16_t)(buf & USB_RHST); switch (buf) { /* Get port speed */ - case USB_HSMODE : - conn_inf = USB_HSCONNECT; - break; - case USB_FSMODE : - conn_inf = USB_FSCONNECT; - break; - case USB_LSMODE : - conn_inf = USB_LSCONNECT; - break; - case USB_HSPROC : - conn_inf = USB_NOCONNECT; - break; - default : - conn_inf = USB_NOCONNECT; - break; + case USB_HSMODE: + conn_inf = USB_HSCONNECT; + break; + case USB_FSMODE: + conn_inf = USB_FSCONNECT; + break; + case USB_LSMODE: + conn_inf = USB_LSCONNECT; + break; + case USB_HSPROC: + conn_inf = USB_NOCONNECT; + break; + default: + conn_inf = USB_NOCONNECT; + break; } - return (conn_inf); + return conn_inf; } /**************************************************************************** @@ -4331,7 +4323,7 @@ uint16_t usb_cstd_port_speed () * ****************************************************************************/ -static void hw_usb_write_dcpcfg (uint16_t data) +static void hw_usb_write_dcpcfg(uint16_t data) { rx65n_putreg16(data, RX65N_USB_DCPCFG); } @@ -4344,7 +4336,7 @@ static void hw_usb_write_dcpcfg (uint16_t data) * ****************************************************************************/ -static void hw_usb_write_dcpmxps (uint16_t data) +static void hw_usb_write_dcpmxps(uint16_t data) { rx65n_putreg16(data, RX65N_USB_DCPMAXP); } @@ -4357,7 +4349,7 @@ static void hw_usb_write_dcpmxps (uint16_t data) * ****************************************************************************/ -void usb_pstd_bus_reset (void) +void usb_pstd_bus_reset(void) { struct rx65n_usbdev_s *priv = &g_usbdev; priv->usbdev.speed = USB_SPEED_FULL; @@ -4393,7 +4385,7 @@ void hw_usb_pset_enb_rsme(void) * ****************************************************************************/ -static int hw_usb_read_syssts () +static int hw_usb_read_syssts(void) { uint16_t regval; @@ -4442,7 +4434,7 @@ void hw_usb_pclear_sts_resm(void) * ****************************************************************************/ -void usb_pstd_suspend_process (void) +void usb_pstd_suspend_process(void) { /* Resume interrupt enable */ @@ -4581,7 +4573,7 @@ void usb_pstd_set_stall(uint16_t pipe) * ****************************************************************************/ -static void hw_usb_set_pid (uint16_t pipeno, uint16_t data) +static void hw_usb_set_pid(uint16_t pipeno, uint16_t data) { uint16_t *p_reg; @@ -4623,21 +4615,21 @@ void hw_usb_pset_ccpl(void) * ****************************************************************************/ -void usb_pstd_ctrl_end (uint16_t status) +void usb_pstd_ctrl_end(uint16_t status) { /* Interrupt disable */ /* BEMP0 disable */ - hw_usb_clear_bempenb((uint16_t) USB_PIPE0); + hw_usb_clear_bempenb((uint16_t)USB_PIPE0); /* BRDY0 disable */ - hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); + hw_usb_clear_brdyenb((uint16_t)USB_PIPE0); /* NRDY0 disable */ - hw_usb_clear_nrdyenb((uint16_t) USB_PIPE0); + hw_usb_clear_nrdyenb((uint16_t)USB_PIPE0); hw_usb_set_mbw(USB_CUSE, USB0_CFIFO_MBW); @@ -4652,7 +4644,7 @@ void usb_pstd_ctrl_end (uint16_t status) { /* Pipe stop */ - usb_cstd_set_nak((uint16_t) USB_PIPE0); + usb_cstd_set_nak((uint16_t)USB_PIPE0); } else @@ -4671,7 +4663,7 @@ void usb_pstd_ctrl_end (uint16_t status) * ****************************************************************************/ -static void usb_pstd_set_feature3 (void) +static void usb_pstd_set_feature3(void) { uint16_t pipe; uint16_t ep; @@ -4682,66 +4674,66 @@ static void usb_pstd_set_feature3 (void) switch ((g_usb_pstd_req_type & USB_BMREQUESTTYPERECIP)) { - case USB_DEVICE : - switch (g_usb_pstd_req_value) - { - case USB_DEV_REMOTE_WAKEUP : - if (0 == g_usb_pstd_req_index) - { - /* Set pipe PID_BUF */ - - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - else - { - /* Not specification */ - - usb_pstd_set_stall_pipe0(); - } - break; - case USB_TEST_MODE : - if (USB_HSCONNECT == usb_cstd_port_speed()) - { - if ((g_usb_pstd_req_index < USB_TEST_RESERVED) - || (USB_TEST_VSTMODES <= g_usb_pstd_req_index)) + case USB_DEVICE: + switch (g_usb_pstd_req_value) + { + case USB_DEV_REMOTE_WAKEUP: + if (0 == g_usb_pstd_req_index) { - g_usb_pstd_test_mode_flag = USB_TRUE; - g_usb_pstd_test_mode_select = g_usb_pstd_req_index; - /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } else { /* Not specification */ usb_pstd_set_stall_pipe0(); - } } - else - { - /* Not specification */ + break; + case USB_TEST_MODE: + if (USB_HSCONNECT == usb_cstd_port_speed()) + { + if ((g_usb_pstd_req_index < USB_TEST_RESERVED) || + (USB_TEST_VSTMODES <= g_usb_pstd_req_index)) + { + g_usb_pstd_test_mode_flag = USB_TRUE; + g_usb_pstd_test_mode_select = g_usb_pstd_req_index; + /* Set pipe PID_BUF */ + + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + else + { + /* Not specification */ + + usb_pstd_set_stall_pipe0(); + } + } + else + { + /* Not specification */ + + usb_pstd_set_stall_pipe0(); + } + break; + default: usb_pstd_set_stall_pipe0(); - } - break; - default : - usb_pstd_set_stall_pipe0(); - break; - } + break; + } break; - case USB_INTERFACE : + case USB_INTERFACE: /* Set pipe USB_PID_STALL */ usb_pstd_set_stall_pipe0(); break; - case USB_ENDPOINT : + case USB_ENDPOINT: /* Endpoint number */ - ep = (uint16_t) (g_usb_pstd_req_index & USB_EPNUMFIELD); + ep = (uint16_t)(g_usb_pstd_req_index & USB_EPNUMFIELD); if (USB_ENDPOINT_HALT == g_usb_pstd_req_value) { /* EP0 */ @@ -4750,7 +4742,7 @@ static void usb_pstd_set_feature3 (void) { /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } /* EP1 to max */ @@ -4772,37 +4764,37 @@ static void usb_pstd_set_feature3 (void) /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } } + else + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + } else { - /* Request error */ + /* Not specification */ usb_pstd_set_stall_pipe0(); } - } - else - { - /* Not specification */ - - usb_pstd_set_stall_pipe0(); - } break; - default : + default: - /* Request error */ + /* Request error */ - usb_pstd_set_stall_pipe0(); + usb_pstd_set_stall_pipe0(); break; } } else { - /* Request error */ + /* Request error */ - usb_pstd_set_stall_pipe0(); + usb_pstd_set_stall_pipe0(); } } @@ -4814,7 +4806,7 @@ static void usb_pstd_set_feature3 (void) * ****************************************************************************/ -static void usb_pstd_clr_feature3 (void) +static void usb_pstd_clr_feature3(void) { uint16_t pipe; uint16_t ep; @@ -4825,106 +4817,106 @@ static void usb_pstd_clr_feature3 (void) switch ((g_usb_pstd_req_type & USB_BMREQUESTTYPERECIP)) { - case USB_DEVICE : - if ((USB_DEV_REMOTE_WAKEUP == g_usb_pstd_req_value) - && (0 == g_usb_pstd_req_index)) - { - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } - else - { - /* Not specification */ + case USB_DEVICE: + if ((USB_DEV_REMOTE_WAKEUP == g_usb_pstd_req_value) + && (0 == g_usb_pstd_req_index)) + { + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } + else + { + /* Not specification */ - usb_pstd_set_stall_pipe0(); - } - break; - case USB_INTERFACE : + usb_pstd_set_stall_pipe0(); + } + break; + case USB_INTERFACE: /* Request error */ usb_pstd_set_stall_pipe0(); break; - case USB_ENDPOINT : + case USB_ENDPOINT: - /* Endpoint number */ + /* Endpoint number */ - ep = (uint16_t) (g_usb_pstd_req_index & USB_EPNUMFIELD); - if (USB_ENDPOINT_HALT == g_usb_pstd_req_value) - { - /* EP0 */ + ep = (uint16_t)(g_usb_pstd_req_index & USB_EPNUMFIELD); + if (USB_ENDPOINT_HALT == g_usb_pstd_req_value) + { + /* EP0 */ - if (0 == ep) - { - /* Stall clear */ + if (0 == ep) + { + /* Stall clear */ - usb_cstd_clr_stall((uint16_t) USB_PIPE0); + usb_cstd_clr_stall((uint16_t)USB_PIPE0); - /* Set pipe PID_BUF */ + /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - } + usb_cstd_set_buf((uint16_t)USB_PIPE0); + } - /* EP1 to max */ + /* EP1 to max */ - else if (ep <= USB_MAX_EP_NO) - { - pipe = usb_pstd_epadr2pipe(g_usb_pstd_req_index); - if (USB_ERROR == pipe) - { - /* Request error */ + else if (ep <= USB_MAX_EP_NO) + { + pipe = usb_pstd_epadr2pipe(g_usb_pstd_req_index); + if (USB_ERROR == pipe) + { + /* Request error */ - usb_pstd_set_stall_pipe0(); - } - else - { - if (USB_PID_BUF == usb_cstd_get_pid(pipe)) - { - usb_cstd_set_nak(pipe); + usb_pstd_set_stall_pipe0(); + } + else + { + if (USB_PID_BUF == usb_cstd_get_pid(pipe)) + { + usb_cstd_set_nak(pipe); - /* SQCLR=1 */ + /* SQCLR=1 */ - hw_usb_set_sqclr(pipe); + hw_usb_set_sqclr(pipe); - /* Set pipe PID_BUF */ + /* Set pipe PID_BUF */ - usb_cstd_set_buf(pipe); - } - else - { - usb_cstd_clr_stall(pipe); + usb_cstd_set_buf(pipe); + } + else + { + usb_cstd_clr_stall(pipe); - /* SQCLR=1 */ + /* SQCLR=1 */ - hw_usb_set_sqclr(pipe); - } - - /* Set pipe PID_BUF */ - - usb_cstd_set_buf((uint16_t) USB_PIPE0); - if (USB_TRUE == g_usb_pstd_stall_pipe[pipe]) - { - g_usb_pstd_stall_pipe[pipe] = USB_FALSE; + hw_usb_set_sqclr(pipe); } - } - } - else - { - /* Request error */ - usb_pstd_set_stall_pipe0(); - } - } - else - { - /* Request error */ + /* Set pipe PID_BUF */ - usb_pstd_set_stall_pipe0(); - } - break; - default : - usb_pstd_set_stall_pipe0(); - break; + usb_cstd_set_buf((uint16_t)USB_PIPE0); + if (USB_TRUE == g_usb_pstd_stall_pipe[pipe]) + { + g_usb_pstd_stall_pipe[pipe] = USB_FALSE; + } + } + } + else + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + } + else + { + /* Request error */ + + usb_pstd_set_stall_pipe0(); + } + break; + default: + usb_pstd_set_stall_pipe0(); + break; } } else @@ -4943,7 +4935,7 @@ static void usb_pstd_clr_feature3 (void) * ****************************************************************************/ -static void usb_pstd_set_address3 (void) +static void usb_pstd_set_address3(void) { if (USB_DEVICE == (g_usb_pstd_req_type & USB_BMREQUESTTYPERECIP)) { @@ -4953,7 +4945,7 @@ static void usb_pstd_set_address3 (void) { /* Set pipe PID_BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); + usb_cstd_set_buf((uint16_t)USB_PIPE0); } else { @@ -4985,7 +4977,7 @@ static void usb_pstd_set_address3 (void) * ****************************************************************************/ -void usb_pstd_stand_req3 (void) +void usb_pstd_stand_req3(void) { uint16_t regval; struct rx65n_usbdev_s *priv = &g_usbdev; @@ -4993,36 +4985,36 @@ void usb_pstd_stand_req3 (void) switch (regval) { - case USB_REQ_CLEARFEATURE : - usb_pstd_clr_feature3(); + case USB_REQ_CLEARFEATURE: + usb_pstd_clr_feature3(); + break; + + case USB_REQ_SETFEATURE: + usb_pstd_set_feature3(); + break; + + case USB_REQ_SETADDRESS: + usb_pstd_set_address3(); + break; + + case USB_REQ_SETCONFIGURATION: + usb_cstd_set_buf((uint16_t)USB_PIPE0); /* SetConfiguration3 */ + break; + + case USB_REQ_SETINTERFACE: + /* Let the class implementation handle + * as it requires access and updation of + * Configuration descriptor + */ + + rx65n_dispatchrequest(priv); + break; + + default: break; - - case USB_REQ_SETFEATURE : - usb_pstd_set_feature3(); - break; - - case USB_REQ_SETADDRESS : - usb_pstd_set_address3(); - break; - - case USB_REQ_SETCONFIGURATION : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* SetConfiguration3 */ - break; - - case USB_REQ_SETINTERFACE : - /* Let the class implementation handle - * as it requires access and updation of - * Configuration descriptor - */ - - rx65n_dispatchrequest(priv); - break; - - default : - break; } - usb_pstd_ctrl_end((uint16_t) USB_CTRL_END); /* Control transfer stop(end) */ + usb_pstd_ctrl_end((uint16_t)USB_CTRL_END); /* Control transfer stop(end) */ } /**************************************************************************** @@ -5033,38 +5025,38 @@ void usb_pstd_stand_req3 (void) * ****************************************************************************/ -void usb_pstd_stand_req4 (void) +void usb_pstd_stand_req4(void) { uint16_t regval; regval = MSBYTE(g_usb_pstd_req_type); switch (regval) { - case USB_REQ_GETSTATUS : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetStatus4 */ - break; + case USB_REQ_GETSTATUS: + usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetStatus4 */ + break; - case USB_REQ_GETDESCRIPTOR : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetDescriptor4 */ - break; + case USB_REQ_GETDESCRIPTOR: + usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetDescriptor4 */ + break; - case USB_REQ_GETCONFIGURATION : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetConfiguration4 */ - break; + case USB_REQ_GETCONFIGURATION: + usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetConfiguration4 */ + break; - case USB_REQ_GETINTERFACE : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetInterface4 */ - break; + case USB_REQ_GETINTERFACE: + usb_cstd_set_buf((uint16_t) USB_PIPE0); /* GetInterface4 */ + break; - case USB_REQ_SYNCHFRAME : - usb_cstd_set_buf((uint16_t) USB_PIPE0); /* SynchFrame4 */ - break; + case USB_REQ_SYNCHFRAME: + usb_cstd_set_buf((uint16_t) USB_PIPE0); /* SynchFrame4 */ + break; - default : - break; + default: + break; } - usb_pstd_ctrl_end((uint16_t) USB_CTRL_END); + usb_pstd_ctrl_end((uint16_t)USB_CTRL_END); } /**************************************************************************** @@ -5077,39 +5069,39 @@ void usb_pstd_stand_req4 (void) void usb_peri_class_request(uint8_t type, uint16_t ctsq) { - if ((USB_CLASS == (type & USB_BMREQUESTTYPETYPE)) || - (USB_VENDOR == (type & USB_BMREQUESTTYPETYPE))) + if ((USB_CLASS == (type & USB_BMREQUESTTYPETYPE)) + || (USB_VENDOR == (type & USB_BMREQUESTTYPETYPE))) { switch (ctsq) { - case USB_CS_IDST : - case USB_CS_RDDS : - case USB_CS_WRDS : + case USB_CS_IDST: + case USB_CS_RDDS: + case USB_CS_WRDS: - /* Do Nothing */ + /* Do Nothing */ - break; - case USB_CS_WRND : - usb_pstd_ctrl_end((uint16_t) USB_CTRL_END); /* class request (control write nodata status stage) */ - break; + break; + case USB_CS_WRND: + usb_pstd_ctrl_end ((uint16_t)USB_CTRL_END); /* class request (control write nodata status stage) */ + break; - case USB_CS_RDSS : - usb_cstd_set_buf((uint16_t) USB_PIPE0); - usb_pstd_ctrl_end((uint16_t) USB_CTRL_END); /* class request (control read status stage) */ - break; + case USB_CS_RDSS: + usb_cstd_set_buf ((uint16_t)USB_PIPE0); + usb_pstd_ctrl_end ((uint16_t)USB_CTRL_END); /* class request (control read status stage) */ + break; - case USB_CS_WRSS : - usb_cstd_set_buf((uint16_t) USB_PIPE0); - usb_pstd_ctrl_end((uint16_t) USB_CTRL_END); /* class request (control write status stage) */ - break; + case USB_CS_WRSS: + usb_cstd_set_buf ((uint16_t)USB_PIPE0); + usb_pstd_ctrl_end ((uint16_t)USB_CTRL_END); /* class request (control write status stage) */ + break; - case USB_CS_SQER : - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); /* End control transfer. */ - break; + case USB_CS_SQER: + usb_pstd_ctrl_end ((uint16_t)USB_DATA_ERR); /* End control transfer. */ + break; - default : - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); /* End control transfer. */ - break; + default: + usb_pstd_ctrl_end ((uint16_t)USB_DATA_ERR); /* End control transfer. */ + break; } } } @@ -5122,17 +5114,18 @@ void usb_peri_class_request(uint8_t type, uint16_t ctsq) * ****************************************************************************/ -static uint16_t hw_usb_read_fifo16 (uint16_t pipemode) +static uint16_t hw_usb_read_fifo16(uint16_t pipemode) { uint16_t data = 0; + switch (pipemode) { case USB_CUSE: - data = USB0.CFIFO.WORD; - break; + data = USB0.CFIFO.WORD; + break; default: - break; + break; } return data; @@ -5210,7 +5203,7 @@ uint16_t usb_pstd_read_data(uint16_t pipe, uint16_t pipemode) { /* FIFO access error */ - return (USB_ERROR); + return USB_ERROR; } dtln = (uint16_t)(buf & USB_DTLN); @@ -5303,7 +5296,7 @@ uint16_t usb_pstd_read_data(uint16_t pipe, uint16_t pipemode) /* End or Err or Continue */ - return (end_flag); + return end_flag; } /**************************************************************************** @@ -5333,41 +5326,41 @@ void usb_pstd_fifo_to_buf(uint16_t pipe, uint16_t useport) { case USB_READING: - /* Continue of data read */ + /* Continue of data read */ - break; + break; - case USB_READEND: + case USB_READEND: - /* End of data read */ + /* End of data read */ - usb_pstd_data_end(pipe, (uint16_t)USB_DATA_OK); - break; + usb_pstd_data_end(pipe, (uint16_t)USB_DATA_OK); + break; case USB_READSHRT: - /* End of data read */ + /* End of data read */ - usb_pstd_data_end(pipe, (uint16_t)USB_DATA_SHT); - break; + usb_pstd_data_end(pipe, (uint16_t)USB_DATA_SHT); + break; case USB_READOVER: - /* Buffer over */ + /* Buffer over */ - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_OVR); - break; + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_OVR); + break; case USB_ERROR: - /* FIFO access error */ + /* FIFO access error */ - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); - break; + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); + break; default: - usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); - break; + usb_pstd_forced_termination(pipe, (uint16_t)USB_DATA_ERR); + break; } } @@ -5429,8 +5422,8 @@ void usb_pstd_brdy_pipe_process(uint16_t bitsts) * ****************************************************************************/ -void usb_pstd_brdy_pipe (uint16_t bitsts, struct rx65n_usbdev_s *priv, - struct rx65n_ep_s *privep, uint16_t epno) +void usb_pstd_brdy_pipe(uint16_t bitsts, struct rx65n_usbdev_s *priv, + struct rx65n_ep_s *privep, uint16_t epno) { uint32_t nbytes; @@ -5443,82 +5436,82 @@ void usb_pstd_brdy_pipe (uint16_t bitsts, struct rx65n_usbdev_s *priv, { /* End of data read */ - case USB_READEND : + case USB_READEND: - /* Continue */ + /* Continue */ - /* End of data read */ + /* End of data read */ - case USB_READSHRT : - hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); - break; + case USB_READSHRT: + hw_usb_clear_brdyenb((uint16_t)USB_PIPE0); + break; - /* Continue of data read */ + /* Continue of data read */ - case USB_READING : + case USB_READING: - /* PID = BUF */ + /* PID = BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - break; + usb_cstd_set_buf((uint16_t)USB_PIPE0); + break; - /* FIFO access error */ + /* FIFO access error */ - case USB_READOVER : + case USB_READOVER: - /* Clear BVAL */ + /* Clear BVAL */ - hw_usb_set_bclr(USB_CUSE); + hw_usb_set_bclr(USB_CUSE); - /* Control transfer stop(end) */ + /* Control transfer stop(end) */ - usb_pstd_ctrl_end((uint16_t) USB_DATA_OVR); - break; + usb_pstd_ctrl_end((uint16_t)USB_DATA_OVR); + break; - /* FIFO access error */ + /* FIFO access error */ - case USB_ERROR : + case USB_ERROR: - /* Control transfer stop(end) */ + /* Control transfer stop(end) */ - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); - break; - default : - break; + usb_pstd_ctrl_end((uint16_t)USB_DATA_ERR); + break; + default: + break; } } - else + else { - /* not PIPE0 */ + /* not PIPE0 */ - usb_pstd_brdy_pipe_process(bitsts); - epno = BULK_IN_EPNUM; - nbytes = (RX65N_USB_MAXP) - g_usb_pstd_data_cnt[BULK_OUT_PIPE]; - usb_data_write(epno, g_buffer, nbytes); - rx65n_putreg16(0, RX65N_USB_BRDYSTS); - privep->head->req.buf = g_buffer; + usb_pstd_brdy_pipe_process (bitsts); + epno = BULK_IN_EPNUM; + nbytes = RX65N_USB_MAXP - g_usb_pstd_data_cnt[BULK_OUT_PIPE]; + usb_data_write (epno, g_buffer, nbytes); + rx65n_putreg16(0, RX65N_USB_BRDYSTS); + privep->head->req.buf = g_buffer; - /* EP3 is passed, because for read(), - * the endpoint list should - * always point to bulk out endpoint - */ + /* EP3 is passed, because for read(), + * the endpoint list should + * always point to bulk out endpoint + */ - privep = &priv->eplist[EP3]; - usb_data_read(g_buffer, RX65N_MAXPACKET_SIZE); - bytesread = nbytes; + privep = &priv->eplist[EP3]; + usb_data_read(g_buffer, RX65N_MAXPACKET_SIZE); + bytesread = nbytes; - /* The rx65n_rdrequest() function is invoked here - * to handle application specific read() - * and invoke the reqcomplete() function - * which further, unblocks the semaphore waiting - * on read() - * Failing to invoke this function will result, - * in failiure of application specific read - * - */ + /* The rx65n_rdrequest() function is invoked here + * to handle application specific read() + * and invoke the reqcomplete() function + * which further, unblocks the semaphore waiting + * on read() + * Failing to invoke this function will result, + * in failiure of application specific read + * + */ - rx65n_rdrequest(epno, priv, privep); - bytesread = 0; + rx65n_rdrequest(epno, priv, privep); + bytesread = 0; } } @@ -5530,7 +5523,7 @@ void usb_pstd_brdy_pipe (uint16_t bitsts, struct rx65n_usbdev_s *priv, * ****************************************************************************/ -static uint16_t usb_cstd_get_pid (uint16_t pipe) +static uint16_t usb_cstd_get_pid(uint16_t pipe) { uint16_t buf; @@ -5542,7 +5535,7 @@ static uint16_t usb_cstd_get_pid (uint16_t pipe) /* PIPE control reg read */ buf = hw_usb_read_pipectr(pipe); - return (uint16_t) (buf & USB_PID); + return (uint16_t)(buf & USB_PID); } /**************************************************************************** @@ -5564,7 +5557,7 @@ void usb_pstd_bemp_pipe_process(uint16_t bitsts) { if (0 != (bitsts & USB_BITSET(i))) { - hw_usb_clear_status_bemp (i); + hw_usb_clear_status_bemp(i); /* Interrupt check */ @@ -5632,54 +5625,54 @@ void usb_pstd_bemp_pipe_process(uint16_t bitsts) * ****************************************************************************/ -void usb_pstd_bemp_pipe (uint16_t bitsts) +void usb_pstd_bemp_pipe(uint16_t bitsts) { if (USB_BEMP0 == (bitsts & USB_BEMP0)) { - switch (usb_pstd_write_data(USB_PIPE0, USB_CUSE)) + switch (usb_pstd_write_data (USB_PIPE0, USB_CUSE)) { /* End of data write (not null) */ - case USB_WRITEEND : + case USB_WRITEEND: - /* Continue */ + /* Continue */ - /* End of data write */ + /* End of data write */ - case USB_WRITESHRT : + case USB_WRITESHRT: - /* Enable empty interrupt */ + /* Enable empty interrupt */ - hw_usb_clear_bempenb((uint16_t) USB_PIPE0); - break; + hw_usb_clear_bempenb ((uint16_t) USB_PIPE0); + break; - /* Continue of data write */ + /* Continue of data write */ - case USB_WRITING : + case USB_WRITING: - /* PID = BUF */ + /* PID = BUF */ - usb_cstd_set_buf((uint16_t) USB_PIPE0); - break; + usb_cstd_set_buf ((uint16_t) USB_PIPE0); + break; - /* FIFO access error */ + /* FIFO access error */ - case USB_ERROR : + case USB_ERROR: - /* Control transfer stop(end) */ + /* Control transfer stop(end) */ - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); - break; + usb_pstd_ctrl_end ((uint16_t) USB_DATA_ERR); + break; - default : - break; + default: + break; } } else { /* BEMP interrupt */ - usb_pstd_bemp_pipe_process(bitsts); + usb_pstd_bemp_pipe_process (bitsts); } } @@ -5691,7 +5684,7 @@ void usb_pstd_bemp_pipe (uint16_t bitsts) * ****************************************************************************/ -static uint16_t hw_usb_read_frmnum () +static uint16_t hw_usb_read_frmnum(void) { return rx65n_getreg16(RX65N_USB_FRMNUM); } @@ -5719,18 +5712,18 @@ void usb_pstd_nrdy_pipe_process(uint16_t bitsts) if (USB_NULL != g_p_usb_pstd_pipe[i]) { - if (USB_TYPFIELD_ISO == usb_cstd_get_pipe_type(i)) + if (USB_TYPFIELD_ISO == usb_cstd_get_pipe_type (i)) { /* Wait for About 60ns */ - buf = hw_usb_read_frmnum(); + buf = hw_usb_read_frmnum (); if (USB_OVRN == (buf & USB_OVRN)) { /* @1 */ /* End of data transfer */ - usb_pstd_forced_termination(i, (uint16_t)USB_DATA_OVR); + usb_pstd_forced_termination (i, (uint16_t)USB_DATA_OVR); } else { @@ -5738,13 +5731,13 @@ void usb_pstd_nrdy_pipe_process(uint16_t bitsts) /* End of data transfer */ - usb_pstd_forced_termination(i, (uint16_t)USB_DATA_ERR); + usb_pstd_forced_termination (i, (uint16_t)USB_DATA_ERR); } } - else - { - /* Non processing. */ - } + else + { + /* Non processing. */ + } } } } @@ -5802,7 +5795,7 @@ void usb_pstd_nrdy_pipe (uint16_t bitsts) * ****************************************************************************/ -static int rx65n_usbinterrupt(int irq, FAR void *context, FAR void *arg) +static int rx65n_usbinterrupt(int irq, void *context, void *arg) { struct rx65n_usbdev_s *priv = &g_usbdev; @@ -5827,31 +5820,31 @@ static int rx65n_usbinterrupt(int irq, FAR void *context, FAR void *arg) if ((intsts0 & RX65N_USB_INTSTS0_VBINT) == RX65N_USB_INTSTS0_VBINT) { - rx65n_putreg16 - (((~RX65N_USB_INTSTS0_VBINT) & INTSTS0_BIT_VALUES_TO_DETECT), - RX65N_USB_INTSTS0); + rx65n_putreg16( + ((~RX65N_USB_INTSTS0_VBINT) & INTSTS0_BIT_VALUES_TO_DETECT), + RX65N_USB_INTSTS0); - if (USB_ATTACH == usb_pstd_chk_vbsts()) + if (USB_ATTACH == usb_pstd_chk_vbsts ()) { priv->attached = 1; connected_times++; syslog (LOG_INFO, "NuttX: USB Device Connected. %d\n", connected_times); - uinfo("Device attached\n"); - usb_pstd_attach_process(); /* USB attach */ + uinfo ("Device attached\n"); + usb_pstd_attach_process (); /* USB attach */ } else { priv->attached = 0; syslog (LOG_INFO, "NuttX: USB Device Disconnected. %d\n", connected_times); - usb_pstd_detach_process(); /* USB detach */ + usb_pstd_detach_process (); /* USB detach */ if (priv->driver) { CLASS_DISCONNECT(priv->driver, &priv->usbdev); } } -} + } intsts0 = (rx65n_getreg16(RX65N_USB_INTSTS0)); if ((intsts0 & RX65N_USB_INTSTS0_DVST) == RX65N_USB_INTSTS0_DVST) @@ -5860,138 +5853,138 @@ static int rx65n_usbinterrupt(int irq, FAR void *context, FAR void *arg) (((~RX65N_USB_INTSTS0_DVST) & INTSTS0_BIT_VALUES_TO_DETECT), RX65N_USB_INTSTS0); - switch ((uint16_t) (intsts0 & USB_DVSQ)) - { - /* Power state */ + switch ((uint16_t)(intsts0 & USB_DVSQ)) + { + /* Power state */ - case USB_DS_POWR : - break; + case USB_DS_POWR: + break; - /* Default state */ + /* Default state */ - case USB_DS_DFLT : - uinfo("USB-reset int peri\n"); - usb_pstd_bus_reset(); - break; + case USB_DS_DFLT: + uinfo ("USB-reset int peri\n"); + usb_pstd_bus_reset(); + break; - /* Address state */ + /* Address state */ - case USB_DS_ADDS : - break; + case USB_DS_ADDS: + break; - /* Configured state */ + /* Configured state */ - case USB_DS_CNFG : - uinfo("Device configuration int peri\n"); - break; + case USB_DS_CNFG: + uinfo ("Device configuration int peri\n"); + break; - /* Power suspend state */ + /* Power suspend state */ - case USB_DS_SPD_POWR : + case USB_DS_SPD_POWR: - /* Continue */ + /* Continue */ - /* Default suspend state */ + /* Default suspend state */ - case USB_DS_SPD_DFLT : + case USB_DS_SPD_DFLT: - /* Continue */ + /* Continue */ - /* Address suspend state */ + /* Address suspend state */ - case USB_DS_SPD_ADDR : + case USB_DS_SPD_ADDR: - /* Continue */ + /* Continue */ - /* Configured Suspend state */ + /* Configured Suspend state */ - case USB_DS_SPD_CNFG : - uinfo("SUSPEND int peri\n"); - usb_pstd_suspend_process(); - break; + case USB_DS_SPD_CNFG: + uinfo ("SUSPEND int peri\n"); + usb_pstd_suspend_process(); + break; - /* Error */ + /* Error */ - default : - break; - } - } + default: + break; + } + } - intsts0 = (rx65n_getreg16(RX65N_USB_INTSTS0)); + intsts0 = rx65n_getreg16(RX65N_USB_INTSTS0); if ((intsts0 & RX65N_USB_INTSTS0_CTRT) == RX65N_USB_INTSTS0_CTRT) { - rx65n_putreg16 - (((~RX65N_USB_INTSTS0_CTRT) & INTSTS0_BIT_VALUES_TO_DETECT), - RX65N_USB_INTSTS0); + rx65n_putreg16(((~RX65N_USB_INTSTS0_CTRT) & INTSTS0_BIT_VALUES_TO_DETECT), + RX65N_USB_INTSTS0); - stginfo = (uint16_t) ((rx65n_getreg16(RX65N_USB_INTSTS0) & USB_CTSQ)); + stginfo = (uint16_t)(rx65n_getreg16(RX65N_USB_INTSTS0) & USB_CTSQ); - if (((USB_CS_RDDS == stginfo) || (USB_CS_WRDS == stginfo)) - || (USB_CS_WRND == stginfo)) - { - /* Save request register */ + if (((USB_CS_RDDS == stginfo) || (USB_CS_WRDS == stginfo)) + || (USB_CS_WRND == stginfo)) + { + /* Save request register */ - usb_pstd_save_request(); - } + usb_pstd_save_request(); + } - if (USB_REQ_TYPE_STANDARD == (g_usb_pstd_req_type & USB_BMREQUESTTYPETYPE)) - { - /* Switch on the control transfer stage (CTSQ). */ + if (USB_REQ_TYPE_STANDARD == + (g_usb_pstd_req_type & USB_BMREQUESTTYPETYPE)) + { + /* Switch on the control transfer stage (CTSQ). */ - switch (stginfo) - { - /* Idle or setup stage */ + switch (stginfo) + { + /* Idle or setup stage */ - uinfo("stginfo =%d\n", stginfo); - case USB_CS_IDST : - case USB_CS_RDDS : - case USB_CS_WRDS : - case USB_CS_WRSS : + uinfo ("stginfo =%d\n", stginfo); + case USB_CS_IDST: + case USB_CS_RDDS: + case USB_CS_WRDS: + case USB_CS_WRSS: - rx65n_ep0setup(priv); - break; + rx65n_ep0setup(priv); + break; - case USB_CS_RDSS : - usb_pstd_stand_req4(); - break; + case USB_CS_RDSS: + usb_pstd_stand_req4(); + break; - case USB_CS_WRND : - usb_pstd_stand_req3(); - break; + case USB_CS_WRND: + usb_pstd_stand_req3(); + break; - /* Control sequence error */ + /* Control sequence error */ - case USB_CS_SQER : - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); - break; + case USB_CS_SQER: + usb_pstd_ctrl_end((uint16_t)USB_DATA_ERR); + break; - /* Illegal */ + /* Illegal */ - default : - usb_pstd_ctrl_end((uint16_t) USB_DATA_ERR); - break; - } - } + default: + usb_pstd_ctrl_end ((uint16_t) USB_DATA_ERR); + break; + } + } else { /* Vender Specific */ type = LSBYTE(rx65n_getreg16(RX65N_USB_USBREQ)); - rx65n_ep0setup(priv); - usb_peri_class_request(type, stginfo); + rx65n_ep0setup (priv); + usb_peri_class_request (type, stginfo); } - } + } ists0 = (uint16_t)(intsts0 & intenb0); /* BRDY Interrupt Check */ if (USB_BRDY == (ists0 & USB_BRDY)) - { - DEBUGVERIFY(work_queue(HPWORK, &g_usbdev.rx65n_interrupt_bhalf, - rx65n_usbdev_bottomhalf, - (void *)USB_INT_BRDY, 0)); - } + { + DEBUGVERIFY(work_queue(HPWORK, &g_usbdev.rx65n_interrupt_bhalf, + rx65n_usbdev_bottomhalf, + (void *)USB_INT_BRDY, 0)); + } /* BEMP Interrupt Check */ @@ -6037,10 +6030,10 @@ void renesas_usbinitialize(void) /* Enable write to System registers */ - regval = rx65n_getreg16 (RX65N_PRCR_ADDR); + regval = rx65n_getreg16(RX65N_PRCR_ADDR); rx65n_putreg16(RX65N_PRCR_VALUE, RX65N_PRCR_ADDR); - regval = rx65n_getreg16 (RX65N_PRCR_ADDR); + regval = rx65n_getreg16(RX65N_PRCR_ADDR); /* Clear bit 19 - so that USB module is released from stop state */ @@ -6049,9 +6042,9 @@ void renesas_usbinitialize(void) putreg32(reg32, RX65N_MSTPCRB_ADDR); memset(priv, 0, sizeof(struct rx65n_usbdev_s)); - priv->usbdev.ops = &g_devops; - priv->usbdev.ep0 = &priv->eplist[EP0].ep; - priv->epavail = RX65N_ENDP_ALLSET & ~RX65N_ENDP_BIT(EP0); + priv->usbdev.ops = &g_devops; + priv->usbdev.ep0 = &priv->eplist[EP0].ep; + priv->epavail = RX65N_ENDP_ALLSET & ~RX65N_ENDP_BIT(EP0); /* Initialize the endpoint list */ @@ -6063,9 +6056,9 @@ void renesas_usbinitialize(void) * endpoint. */ - priv->eplist[epno].ep.ops = &g_epops; - priv->eplist[epno].dev = priv; - priv->eplist[epno].ep.eplog = epno; + priv->eplist[epno].ep.ops = &g_epops; + priv->eplist[epno].dev = priv; + priv->eplist[epno].ep.eplog = epno; /* We will use a fixed maxpacket size for all endpoints (perhaps * ISOC endpoints could have larger maxpacket???). A smaller @@ -6083,41 +6076,41 @@ void renesas_usbinitialize(void) /* Set SCKE bit in SYSCFG Register */ - regval = rx65n_getreg16 (RX65N_USB_SYSCFG); + regval = rx65n_getreg16(RX65N_USB_SYSCFG); regval |= (RX65N_USB_SYSCFG_SCKE); rx65n_putreg16(regval, RX65N_USB_SYSCFG); - regval = rx65n_getreg16 (RX65N_USB_PHYSLEW); + regval = rx65n_getreg16(RX65N_USB_PHYSLEW); regval |= (RX65N_PHYSLEW_VALUE); rx65n_putreg16(regval, RX65N_USB_PHYSLEW); /* Set USBE bit in SYSCFG register */ - regval = rx65n_getreg16 (RX65N_USB_SYSCFG); + regval = rx65n_getreg16(RX65N_USB_SYSCFG); regval |= (RX65N_USB_SYSCFG_USBE); rx65n_putreg16(regval, RX65N_USB_SYSCFG); /* Set MBW bit in CFIFOSEL register */ - regval = rx65n_getreg16 (RX65N_USB_CFIFOSEL); + regval = rx65n_getreg16(RX65N_USB_CFIFOSEL); regval |= (RX65N_USB_CFIFOSEL_MBW_16); rx65n_putreg16(regval, RX65N_USB_CFIFOSEL); /* Set MBW bit in D0FIFOSEL register */ - regval = rx65n_getreg16 (RX65N_USB_D0FIFOSEL); + regval = rx65n_getreg16(RX65N_USB_D0FIFOSEL); regval |= (RX65N_USB_D0FIFOSEL_MBW_16); rx65n_putreg16(regval, RX65N_USB_D0FIFOSEL); /* Set MBW bit in D1FIFOSEL register */ - regval = rx65n_getreg16 (RX65N_USB_D1FIFOSEL); + regval = rx65n_getreg16(RX65N_USB_D1FIFOSEL); regval |= (RX65N_USB_D1FIFOSEL_MBW_16); rx65n_putreg16(regval, RX65N_USB_D1FIFOSEL); /* Set the Interrupt enable bits in INTENB0 register */ - regval = rx65n_getreg16 (RX65N_USB_INTENB0); + regval = rx65n_getreg16(RX65N_USB_INTENB0); regval |= (RX65N_USB_INTENB0_BEMPE | RX65N_USB_INTENB0_BRDYE | RX65N_USB_INTENB0_VBSE | RX65N_USB_INTENB0_DVSE | RX65N_USB_INTENB0_CTRE); @@ -6129,14 +6122,14 @@ void renesas_usbinitialize(void) if (irq_attach(RX65N_INTB185_IRQ, rx65n_usbinterrupt, NULL) != 0) { - usbtrace(TRACE_DEVERROR(RX65N_TRACEERR_IRQREGISTRATION), + usbtrace (TRACE_DEVERROR(RX65N_TRACEERR_IRQREGISTRATION), (uint16_t)RX65N_INTB185_IRQ); } priv->usbdev.speed = USB_SPEED_FULL; - syslog (LOG_INFO, "Debug:USB Device Initialized, Device connected:%s\n", - priv->attached ? "YES" : "NO"); + syslog(LOG_INFO, "Debug:USB Device Initialized, Device connected:%s\n", + priv->attached ? "YES" : "NO"); } /**************************************************************************** @@ -6181,7 +6174,7 @@ void renesas_usbuninitialize(void) * ****************************************************************************/ -int usbdev_register(FAR struct usbdevclass_driver_s *driver) +int usbdev_register(struct usbdevclass_driver_s *driver) { int ret; @@ -6235,7 +6228,7 @@ int usbdev_register(FAR struct usbdevclass_driver_s *driver) * ****************************************************************************/ -int usbdev_unregister(FAR struct usbdevclass_driver_s *driver) +int usbdev_unregister(struct usbdevclass_driver_s *driver) { usbtrace(TRACE_DEVUNREGISTER, 0); diff --git a/arch/renesas/src/rx65n/rx65n_usbhost.c b/arch/renesas/src/rx65n/rx65n_usbhost.c index f0da8cd926..ee1cd6691f 100644 --- a/arch/renesas/src/rx65n/rx65n_usbhost.c +++ b/arch/renesas/src/rx65n/rx65n_usbhost.c @@ -301,7 +301,7 @@ static inline uint16_t rx65n_usbhost_getle16(const uint8_t *val); /* OHCI memory pool helper functions ****************************************/ static inline void rx65n_usbhost_edfree(struct rx65n_usbhost_ed_s *ed); -static struct rx65n_usbhost_gtd_s *rx65n_usbhost_tdalloc(uint8_t epnum); +static struct rx65n_usbhost_gtd_s *rx65n_usbhost_tdalloc(uint8_t epnum); static void rx65n_usbhost_tdfree(struct rx65n_usbhost_gtd_s *buffer); static uint8_t *rx65n_usbhost_tballoc(void); static void rx65n_usbhost_tbfree(uint8_t *buffer); @@ -316,9 +316,9 @@ static void rx65n_usbhost_free_xfrinfo /* ED list helper functions *************************************************/ static inline int rx65n_usbhost_addctrled(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed); + struct rx65n_usbhost_ed_s *ed); static inline int rx65n_usbhost_remctrled(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed); + struct rx65n_usbhost_ed_s *ed); static inline int rx65n_usbhost_addbulked(struct rx65n_usbhost_s *priv, const struct usbhost_epdesc_s @@ -326,12 +326,12 @@ static inline int rx65n_usbhost_addbulked(struct rx65n_usbhost_s *priv, *ed); static inline int rx65n_usbhost_rembulked(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed); + struct rx65n_usbhost_ed_s *ed); #if !defined(CONFIG_USBHOST_INT_DISABLE) || !defined(CONFIG_USBHOST_ISOC_DISABLE) static unsigned int rx65n_usbhost_getinterval(uint8_t interval); static void rx65n_usbhost_setinttab(uint32_t value, unsigned int interval, - unsigned int offset); + unsigned int offset); #endif static inline int rx65n_usbhost_addinted(struct rx65n_usbhost_s *priv, @@ -358,71 +358,74 @@ static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv, /* Interrupt handling *******************************************************/ -static int rx65n_usbhost_usbinterrupt(int irq, void *context, FAR void *arg); +static int rx65n_usbhost_usbinterrupt(int irq, void *context, void *arg); /* USB host controller operations *******************************************/ static int rx65n_usbhost_wait(struct usbhost_connection_s *conn, - struct usbhost_hubport_s **hport); + struct usbhost_hubport_s **hport); static int rx65n_usbhost_rh_enumerate(struct usbhost_connection_s *conn, - struct usbhost_hubport_s *hport); + struct usbhost_hubport_s *hport); static int rx65n_usbhost_enumerate(struct usbhost_connection_s *conn, - struct usbhost_hubport_s *hport); + struct usbhost_hubport_s *hport); static int rx65n_usbhost_ep0configure(struct usbhost_driver_s *drvr, - usbhost_ep_t ep0, uint8_t funcaddr, uint8_t speed, - uint16_t maxpacketsize); + usbhost_ep_t ep0, uint8_t funcaddr, + uint8_t speed, uint16_t maxpacketsize); static int rx65n_usbhost_epalloc(struct usbhost_driver_s *drvr, - const struct usbhost_epdesc_s *epdesc, - usbhost_ep_t *ep); + const struct usbhost_epdesc_s *epdesc, + usbhost_ep_t *ep); static int rx65n_usbhost_epfree(struct usbhost_driver_s *drvr, - usbhost_ep_t ep); + usbhost_ep_t ep); static int rx65n_usbhost_alloc(struct usbhost_driver_s *drvr, - uint8_t **buffer, size_t *maxlen); + uint8_t **buffer, size_t *maxlen); static int rx65n_usbhost_free(struct usbhost_driver_s *drvr, - uint8_t *buffer); + uint8_t *buffer); static int rx65n_usbhost_ioalloc(struct usbhost_driver_s *drvr, - uint8_t **buffer, size_t buflen); + uint8_t **buffer, size_t buflen); static int rx65n_usbhost_iofree(struct usbhost_driver_s *drvr, - uint8_t *buffer); + uint8_t *buffer); static int rx65n_usbhost_ctrlin(struct usbhost_driver_s *drvr, - usbhost_ep_t ep0, - const struct usb_ctrlreq_s *req, - uint8_t *buffer); + usbhost_ep_t ep0, + const struct usb_ctrlreq_s *req, + uint8_t *buffer); static int rx65n_usbhost_ctrlout(struct usbhost_driver_s *drvr, - usbhost_ep_t ep0, - const struct usb_ctrlreq_s *req, - const uint8_t *buffer); + usbhost_ep_t ep0, + const struct usb_ctrlreq_s *req, + const uint8_t *buffer); static int rx65n_usbhost_transfer_common(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed, uint8_t *buffer, - size_t buflen); + struct rx65n_usbhost_ed_s *ed, + uint8_t *buffer, size_t buflen); #if RX65N_USBHOST_IOBUFFERS > 0 static int rx65n_usbhost_dma_alloc(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed, uint8_t *userbuffer, - size_t buflen, uint8_t **alloc); + struct rx65n_usbhost_ed_s *ed, + uint8_t *userbuffer, + size_t buflen, uint8_t **alloc); static void rx65n_usbhost_dma_free(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed, uint8_t *userbuffer, - size_t buflen, uint8_t *alloc); + struct rx65n_usbhost_ed_s *ed, + uint8_t *userbuffer, + size_t buflen, uint8_t *alloc); #endif static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr, - usbhost_ep_t ep, - uint8_t *buffer, size_t buflen); + usbhost_ep_t ep, + uint8_t *buffer, size_t buflen); #ifdef CONFIG_USBHOST_ASYNCH static void rx65n_usbhost_asynch_completion(struct rx65n_usbhost_s *priv, - struct rx65n_usbhost_ed_s *ed); -static int rx65n_usbhost_asynch(FAR struct usbhost_driver_s *drvr, - usbhost_ep_t ep, FAR uint8_t *buffer, size_t buflen, - usbhost_asynch_t callback, FAR void *arg); + struct rx65n_usbhost_ed_s *ed); +static int rx65n_usbhost_asynch(struct usbhost_driver_s *drvr, + usbhost_ep_t ep, uint8_t *buffer, + size_t buflen, usbhost_asynch_t callback, + void *arg); #endif -static int rx65n_usbhost_cancel(FAR struct usbhost_driver_s *drvr, - usbhost_ep_t ep); +static int rx65n_usbhost_cancel(struct usbhost_driver_s *drvr, + usbhost_ep_t ep); #ifdef CONFIG_USBHOST_HUB -static int rx65n_usbhost_connect(FAR struct usbhost_driver_s *drvr, - FAR struct usbhost_hubport_s *hport, - bool connected); +static int rx65n_usbhost_connect(struct usbhost_driver_s *drvr, + struct usbhost_hubport_s *hport, + bool connected); #endif static void rx65n_usbhost_disconnect(struct usbhost_driver_s *drvr, - struct usbhost_hubport_s *hport); + struct usbhost_hubport_s *hport); /* Initialization ***********************************************************/ @@ -5937,7 +5940,7 @@ errout_with_xfrinfo: * ****************************************************************************/ -static int rx65n_usbhost_usbinterrupt(int irq, void *context, FAR void *arg) +static int rx65n_usbhost_usbinterrupt(int irq, void *context, void *arg) { uint16_t intenb0; uint16_t intenb1; @@ -6476,8 +6479,8 @@ static int rx65n_usbhost_rh_enumerate(struct usbhost_connection_s *conn, * ****************************************************************************/ -static int rx65n_usbhost_enumerate(FAR struct usbhost_connection_s *conn, - FAR struct usbhost_hubport_s *hport) +static int rx65n_usbhost_enumerate(struct usbhost_connection_s *conn, + struct usbhost_hubport_s *hport) { int ret; @@ -6969,13 +6972,13 @@ static int rx65n_usbhost_free(struct usbhost_driver_s *drvr, uint8_t *buffer) static int rx65n_usbhost_ioalloc(struct usbhost_driver_s *drvr, uint8_t **buffer, size_t buflen) { - FAR uint8_t *alloc; + uint8_t *alloc; DEBUGASSERT(drvr && buffer && buflen > 0); /* There is no special memory requirement */ - alloc = (FAR uint8_t *)kmm_malloc(buflen); + alloc = (uint8_t *)kmm_malloc(buflen); if (!alloc) { return -ENOMEM; @@ -7854,7 +7857,7 @@ errout_with_lock: * ****************************************************************************/ -static int rx65n_usbhost_cancel(FAR struct usbhost_driver_s *drvr, +static int rx65n_usbhost_cancel(struct usbhost_driver_s *drvr, usbhost_ep_t ep) { #ifdef CONFIG_USBHOST_ASYNCH @@ -7975,8 +7978,8 @@ static int rx65n_usbhost_cancel(FAR struct usbhost_driver_s *drvr, ****************************************************************************/ #ifdef CONFIG_USBHOST_HUB -static int rx65n_usbhost_connect(FAR struct usbhost_driver_s *drvr, - FAR struct usbhost_hubport_s *hport, +static int rx65n_usbhost_connect(struct usbhost_driver_s *drvr, + struct usbhost_hubport_s *hport, bool connected) { struct rx65n_usbhost_s *priv = (struct rx65n_usbhost_s *)drvr; diff --git a/arch/renesas/src/rx65n/rx65n_usbhost.h b/arch/renesas/src/rx65n/rx65n_usbhost.h index 0e455992d7..1226023a05 100644 --- a/arch/renesas/src/rx65n/rx65n_usbhost.h +++ b/arch/renesas/src/rx65n/rx65n_usbhost.h @@ -235,7 +235,7 @@ extern "C" #ifdef CONFIG_USBHOST struct usbhost_connection_s; -FAR struct usbhost_connection_s *rx65n_usbhost_initialize(int controller); +struct usbhost_connection_s *rx65n_usbhost_initialize(int controller); #endif #undef EXTERN diff --git a/arch/renesas/src/sh1/sh1_dumpstate.c b/arch/renesas/src/sh1/sh1_dumpstate.c index 3cb68cf845..2276dc140b 100644 --- a/arch/renesas/src/sh1/sh1_dumpstate.c +++ b/arch/renesas/src/sh1/sh1_dumpstate.c @@ -112,7 +112,7 @@ static inline void sh1_registerdump(void) void renesas_dumpstate(void) { - FAR struct tcb_s *rtcb = running_task(); + struct tcb_s *rtcb = running_task(); uint32_t sp = up_getsp(); uint32_t ustackbase; uint32_t ustacksize; diff --git a/arch/renesas/src/sh1/sh1_serial.c b/arch/renesas/src/sh1/sh1_serial.c index 293d3e972e..cce3ce5173 100644 --- a/arch/renesas/src/sh1/sh1_serial.c +++ b/arch/renesas/src/sh1/sh1_serial.c @@ -141,7 +141,7 @@ 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, FAR void *arg); +static int up_interrupt(int irq, void *context, void *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); @@ -556,7 +556,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv;