arch/renesas: remove FAR and apply formatting

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2022-12-15 00:53:03 +02:00
committed by Xiang Xiao
parent 5b4e12774c
commit e9fe00c573
25 changed files with 1845 additions and 1900 deletions
@@ -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); 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; *heap_size = CONFIG_RAM_END - g_idle_topstack;
} }
@@ -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 #ifdef CONFIG_TLS_ALIGNED
/* The allocated stack size must not exceed the maximum possible for the /* The allocated stack size must not exceed the maximum possible for the
+2 -2
View File
@@ -61,9 +61,9 @@
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_DUMP_ON_EXIT #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 i;
int j; int j;
@@ -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? */ /* Is there a stack allocated? */
+3 -3
View File
@@ -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 */ /* 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 */ /* 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; tcb->adj_stack_size -= frame_size;
/* And return a pointer to allocated memory */ /* And return a pointer to allocated memory */
+1 -1
View File
@@ -125,7 +125,7 @@ static inline void m16c_registerdump(void)
void renesas_dumpstate(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 sp = up_getsp();
uint16_t ustackbase; uint16_t ustackbase;
uint16_t ustacksize; uint16_t ustacksize;
+3 -3
View File
@@ -49,10 +49,10 @@
* *
****************************************************************************/ ****************************************************************************/
void up_initial_state(FAR struct tcb_s *tcb) void up_initial_state(struct tcb_s *tcb)
{ {
FAR struct xcptcontext *xcp = &tcb->xcp; struct xcptcontext *xcp = &tcb->xcp;
FAR uint8_t *regs = xcp->regs; uint8_t *regs = xcp->regs;
uintptr_t sp; uintptr_t sp;
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
+1 -1
View File
@@ -42,7 +42,7 @@
* DTC channel. * DTC channel.
*/ */
typedef FAR void *DTC_HANDLE; typedef void *DTC_HANDLE;
/* Configurable options for DTC Transfer mode */ /* Configurable options for DTC Transfer mode */
+1 -1
View File
@@ -135,7 +135,7 @@ static inline void rx65n_registerdump(void)
void renesas_dumpstate(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 sp = up_getsp();
uint32_t ustackbase; uint32_t ustackbase;
uint32_t ustacksize; uint32_t ustacksize;
+87 -91
View File
@@ -195,7 +195,7 @@
* header * 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 */ /* PHY return definitions */
@@ -450,52 +450,52 @@ static void rx65n_checksetup(void);
/* Free buffer management */ /* Free buffer management */
static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv); static void rx65n_initbuffer(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);
static inline void rx65n_freebuffer(FAR struct rx65n_ethmac_s *priv, static inline void rx65n_freebuffer(struct rx65n_ethmac_s *priv,
uint8_t *buffer); uint8_t *buffer);
static inline bool rx65n_isfreebuffer(FAR struct rx65n_ethmac_s *priv); static inline bool rx65n_isfreebuffer(struct rx65n_ethmac_s *priv);
/* Common TX logic */ /* 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 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 */ /* Interrupt handling */
static void rx65n_enableint(FAR struct rx65n_ethmac_s *priv, static void rx65n_enableint(struct rx65n_ethmac_s *priv,
uint32_t ierbit); uint32_t ierbit);
static void rx65n_disableint(FAR struct rx65n_ethmac_s *priv, static void rx65n_disableint(struct rx65n_ethmac_s *priv,
uint32_t ierbit); uint32_t ierbit);
static void rx65n_freesegment(FAR struct rx65n_ethmac_s *priv, static void rx65n_freesegment(struct rx65n_ethmac_s *priv,
FAR struct eth_rxdesc_s *rxfirst, int segments); struct eth_rxdesc_s *rxfirst, int segments);
static int rx65n_recvframe(FAR struct rx65n_ethmac_s *priv); static int rx65n_recvframe(struct rx65n_ethmac_s *priv);
static void rx65n_receive(FAR struct rx65n_ethmac_s *priv); static void rx65n_receive(struct rx65n_ethmac_s *priv);
static void rx65n_freeframe(FAR struct rx65n_ethmac_s *priv); static void rx65n_freeframe(struct rx65n_ethmac_s *priv);
static void rx65n_txdone(FAR struct rx65n_ethmac_s *priv); static void rx65n_txdone(struct rx65n_ethmac_s *priv);
static void rx65n_interrupt_work(FAR void *arg); static void rx65n_interrupt_work(void *arg);
static int rx65n_interrupt(int irq, FAR void *context, FAR void *arg); static int rx65n_interrupt(int irq, void *context, void *arg);
/* Timer expirations */ /* Timer expirations */
static void rx65n_txtimeout_work(FAR void *arg); static void rx65n_txtimeout_work(void *arg);
/* NuttX callback functions */ /* NuttX callback functions */
static int rx65n_ifup(struct net_driver_s *dev); static int rx65n_ifup(struct net_driver_s *dev);
static int rx65n_ifdown(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); static int rx65n_txavail(struct net_driver_s *dev);
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6) #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 #endif
#ifdef CONFIG_NET_MCASTGROUP #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 #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int rx65n_ioctl(struct net_driver_s *dev, int cmd, static int rx65n_ioctl(struct net_driver_s *dev, int cmd,
@@ -504,8 +504,8 @@ static int rx65n_ioctl(struct net_driver_s *dev, int cmd,
/* Descriptor Initialization */ /* Descriptor Initialization */
static void rx65n_txdescinit(FAR struct rx65n_ethmac_s *priv); static void rx65n_txdescinit(struct rx65n_ethmac_s *priv);
static void rx65n_rxdescinit(FAR struct rx65n_ethmac_s *priv); static void rx65n_rxdescinit(struct rx65n_ethmac_s *priv);
/* PHY Initialization */ /* PHY Initialization */
@@ -513,35 +513,35 @@ static void rx65n_rxdescinit(FAR struct rx65n_ethmac_s *priv);
static void rx65n_phyintenable(bool enable); static void rx65n_phyintenable(bool enable);
#endif #endif
#if defined(CONFIG_ARCH_PHY_INTERRUPT) #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); phy_enable_t *enable);
#endif #endif
static int rx65n_phyinit(FAR struct rx65n_ethmac_s *priv); static int rx65n_phyinit(struct rx65n_ethmac_s *priv);
/* MAC/DMA Initialization */ /* MAC/DMA Initialization */
static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv); static int rx65n_ethreset(struct rx65n_ethmac_s *priv);
static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv); static int rx65n_macconfig(struct rx65n_ethmac_s *priv);
static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv); static void rx65n_macaddress(struct rx65n_ethmac_s *priv);
static int rx65n_ethconfig(FAR struct rx65n_ethmac_s *priv); static int rx65n_ethconfig(struct rx65n_ethmac_s *priv);
static void rx65n_phy_preamble (void); static void rx65n_phy_preamble(void);
static void rx65n_phy_trans_zto0 (void); static void rx65n_phy_trans_zto0(void);
static void rx65n_phy_trans_1to0 (void); static void rx65n_phy_trans_1to0(void);
static void rx65n_phy_reg_set(uint8_t phydevaddr, uint16_t reg_addr, static void rx65n_phy_reg_set(uint8_t phydevaddr, uint16_t reg_addr,
int32_t option); int32_t option);
static void rx65n_phy_reg_write (uint16_t data); static void rx65n_phy_reg_write(uint16_t data);
static void rx65n_phy_mii_write1 (void); static void rx65n_phy_mii_write1(void);
static void rx65n_phy_mii_write0 (void); static void rx65n_phy_mii_write0(void);
void rx65n_ether_enable_icu(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_set_phy_mode(uint8_t mode);
void rx65n_ether_interrupt_init(void); void rx65n_ether_interrupt_init(void);
static int rx65n_phywrite (uint8_t phydevaddr, uint16_t reg_addr, static int rx65n_phywrite(uint8_t phydevaddr, uint16_t reg_addr,
uint16_t data); uint16_t data);
static uint16_t rx65n_phyread (uint8_t phydevaddr, uint16_t reg_addr, static uint16_t rx65n_phyread(uint8_t phydevaddr, uint16_t reg_addr,
uint16_t *value); uint16_t *value);
void up_enable_irq(int irq); void up_enable_irq(int irq);
@@ -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; uint8_t *buffer;
int i; int i;
@@ -719,7 +719,7 @@ static void rx65n_initbuffer(FAR struct rx65n_ethmac_s *priv)
i < RX65N_ETH_NFREEBUFFERS; i < RX65N_ETH_NFREEBUFFERS;
i++, buffer += CONFIG_RX65N_ETH_BUFSIZE) 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 */ /* 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) uint8_t *buffer)
{ {
/* Free the buffer by adding it to the end of the free buffer list */ /* 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 */ /* 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 *txdesc;
struct eth_txdesc_s *txfirst; 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) static int rx65n_txpoll(struct net_driver_s *dev)
{ {
FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private;
d_private;
DEBUGASSERT(priv->dev.d_buf != NULL); 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 /* 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 * 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 * 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; uint32_t regval;
@@ -1199,7 +1198,7 @@ static void rx65n_enableint(FAR struct rx65n_ethmac_s *priv, uint32_t ierbit)
* None * 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 ierbit)
{ {
uint32_t regval; 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, static void rx65n_freesegment(struct rx65n_ethmac_s *priv,
FAR struct eth_rxdesc_s *rxfirst, int segments) struct eth_rxdesc_s *rxfirst, int segments)
{ {
struct eth_rxdesc_s *rxdesc; struct eth_rxdesc_s *rxdesc;
int i; 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 *rxdesc;
struct eth_rxdesc_s *rxcurr; struct eth_rxdesc_s *rxcurr;
@@ -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; struct net_driver_s *dev = &priv->dev;
@@ -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; struct eth_txdesc_s *txdesc;
int i; 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); DEBUGASSERT(priv->txtail != NULL);
@@ -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 edmasr;
uint32_t regval; 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; uint32_t edmasr;
/* Get the interrupt status bits (ETHERC/EDMAC interrupt status check ) */ /* 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. */ /* 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) 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"); nerr("ERROR: Timeout!\n");
/* Disable further Ethernet interrupts. This will prevent some race /* 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) static int rx65n_ifup(struct net_driver_s *dev)
{ {
FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private;
d_private;
int ret; int ret;
#ifdef CONFIG_NET_IPv4 #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) static int rx65n_ifdown(struct net_driver_s *dev)
{ {
FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private;
d_private;
irqstate_t flags; irqstate_t flags;
int ret = OK; int ret = OK;
ninfo("Taking the network down\n"); 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); 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) static int rx65n_txavail(struct net_driver_s *dev)
{ {
FAR struct rx65n_ethmac_s *priv = (FAR struct rx65n_ethmac_s *)dev-> struct rx65n_ethmac_s *priv = (struct rx65n_ethmac_s *)dev->d_private;
d_private;
/* Is our single work structure available? /* Is our single work structure available?
* It may not be if there are * 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) #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", ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 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 #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", ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 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; struct eth_txdesc_s *txdesc;
int i; 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; struct eth_rxdesc_s *rxdesc;
int i; int i;
@@ -2626,7 +2622,7 @@ static void rx65n_phyintenable(bool enable)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_ARCH_PHY_INTERRUPT) #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) phy_enable_t *enable)
{ {
/* Using ET0_LINKSTA for PHY interrupt line which is connected to ETHERC. /* 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 * Return Value : none
****************************************************************************/ ****************************************************************************/
void phy_start_autonegotiate (uint8_t pause) void phy_start_autonegotiate(uint8_t pause)
{ {
volatile uint16_t regval = 0; volatile uint16_t regval = 0;
@@ -2829,7 +2825,7 @@ void rx65n_ether_set_phy_mode(uint8_t mode)
* Return Value : none * 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 databitcnt = 0;
int32_t j; int32_t j;
@@ -2895,7 +2891,7 @@ static void phy_reg_read (uint16_t *pdata)
* Return Value : read value * Return Value : read value
****************************************************************************/ ****************************************************************************/
static uint16_t rx65n_phyread (uint8_t phydevaddr, uint16_t reg_addr, static uint16_t rx65n_phyread(uint8_t phydevaddr, uint16_t reg_addr,
uint16_t *value) uint16_t *value)
{ {
uint16_t data; uint16_t data;
@@ -2961,7 +2957,7 @@ void rx65n_ether_enable_icu(void)
* Return Value : none * Return Value : none
****************************************************************************/ ****************************************************************************/
static void rx65n_phy_trans_zto0 () static void rx65n_phy_trans_zto0(void)
{ {
int32_t j; int32_t j;
@@ -3004,7 +3000,7 @@ static void rx65n_phy_trans_zto0 ()
* Return Value : none * 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 /* The processing of TA (turnaround) about writing of the frame format
* of MII Management Interface which is * of MII Management Interface which is
@@ -3027,7 +3023,7 @@ static void rx65n_phy_trans_1to0 ()
* Return Value : none * Return Value : none
****************************************************************************/ ****************************************************************************/
static void rx65n_phy_reg_set (uint8_t phydevaddr, uint16_t reg_addr, static void rx65n_phy_reg_set(uint8_t phydevaddr, uint16_t reg_addr,
int32_t option) int32_t option)
{ {
int32_t bitcnt = 0; int32_t bitcnt = 0;
@@ -3079,7 +3075,7 @@ static void rx65n_phy_reg_set (uint8_t phydevaddr, uint16_t reg_addr,
* Return Value : none * 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; int32_t databitcnt = 0;
@@ -3113,7 +3109,7 @@ static void rx65n_phy_reg_write (uint16_t data)
* Return Value : none * Return Value : none
****************************************************************************/ ****************************************************************************/
static void rx65n_phy_mii_write1 () static void rx65n_phy_mii_write1(void)
{ {
int32_t j; 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; uint32_t count;
uint16_t reg; 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 regval;
uint32_t retries; 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 regval;
uint32_t retries; 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; uint32_t regval;
regval = 0; 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; int ret;
uint32_t regval; uint32_t regval;
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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 * 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 */ #endif /* __ARCH_RENESAS_SRC_RX65N_RX65N_RIIC_H */
+61 -67
View File
@@ -184,17 +184,17 @@ struct rx65n_rspidev_s
/* Helpers */ /* 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); 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); 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); 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); 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); 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); uint8_t offset, uint8_t value);
/* SPI data transfer */ /* SPI data transfer */
@@ -218,41 +218,39 @@ static int rspi_transfer(struct rx65n_rspidev_s *priv, const void *txbuffer,
#ifndef CONFIG_SPI_POLLWAIT #ifndef CONFIG_SPI_POLLWAIT
static inline struct rx65n_rspidev_s *rspi_mapirq(int irq); static inline struct rx65n_rspidev_s *rspi_mapirq(int irq);
static int rspi_idlinterrupt(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, FAR void *arg); static int rspi_erinterrupt(int irq, void *context, void *arg);
static int rspi_txinterrupt(int irq, void *context, FAR void *arg); static int rspi_txinterrupt(int irq, void *context, void *arg);
static int rspi_rxinterrupt(int irq, void *context, FAR void *arg); static int rspi_rxinterrupt(int irq, void *context, void *arg);
#endif #endif
/* SPI methods */ /* SPI methods */
static int rspi_lock(FAR struct spi_dev_s *dev, bool lock); static int rspi_lock(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); uint32_t frequency);
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);
static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits); static void rspi_setbits(struct spi_dev_s *dev, int nbits);
#ifdef CONFIG_SPI_HWFEATURES #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); spi_hwfeatures_t features);
#endif #endif
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);
static void rspi_exchange(FAR struct spi_dev_s *dev, static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer, void *rxbuffer, size_t nwords);
FAR void *rxbuffer, size_t nwords);
#ifdef CONFIG_SPI_TRIGGER #ifdef CONFIG_SPI_TRIGGER
static int rspi_trigger(FAR struct spi_dev_s *dev); static int rspi_trigger(struct spi_dev_s *dev);
#endif #endif
#ifndef CONFIG_SPI_EXCHANGE #ifndef CONFIG_SPI_EXCHANGE
static void rspi_sndblock(FAR struct spi_dev_s *dev, static void rspi_sndblock(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer,
size_t nwords); 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); size_t nwords);
#endif #endif
/* Initialization */ /* Initialization */
static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv); static void rspi_bus_initialize(struct rx65n_rspidev_s *priv);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -548,57 +546,57 @@ dtc_static_transfer_data_cfg_t rx_cfg =
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RX65N_RSPI0 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; return -ENODEV;
} }
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; return -ENODEV;
} }
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; 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_SPI_CALLBACK
#ifdef CONFIG_RX65N_RSPI0 #ifdef CONFIG_RX65N_RSPI0
int rx65n_rspi0register(FAR struct spi_dev_s *dev, int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi0 device\n"); spiinfo("INFO: Registering rspi0 device\n");
return OK; return OK;
@@ -635,9 +632,8 @@ int rx65n_rspi0register(FAR struct spi_dev_s *dev,
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #ifdef CONFIG_RX65N_RSPI1
int rx65n_rspi1register(FAR struct spi_dev_s *dev, int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi1 device\n"); spiinfo("INFO: Registering rspi1 device\n");
return OK; return OK;
@@ -645,9 +641,8 @@ int rx65n_rspi1register(FAR struct spi_dev_s *dev,
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #ifdef CONFIG_RX65N_RSPI2
int rx65n_rspi2register(FAR struct spi_dev_s *dev, int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi2 device\n"); spiinfo("INFO: Registering rspi2 device\n");
return OK; return OK;
@@ -1017,9 +1012,9 @@ static void rspi_startxfr(struct rx65n_rspidev_s *priv)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RX65N_RSPI_DTC_DT_MODE #ifdef CONFIG_RX65N_RSPI_DTC_DT_MODE
static dtc_err_t rspi_dtctxsetup(FAR struct rx65n_rspidev_s *priv, static dtc_err_t rspi_dtctxsetup(struct rx65n_rspidev_s *priv,
FAR const void *txbuffer, const void *txbuffer,
FAR const void *txdummy, size_t nwords) const void *txdummy, size_t nwords)
{ {
dtc_err_t ret = DTC_SUCCESS; dtc_err_t ret = DTC_SUCCESS;
dtc_dynamic_transfer_data_cfg_t dcfg; 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, static dtc_err_t rspi_dtcrxsetup(struct rx65n_rspidev_s *priv,
FAR void *rxbuffer, FAR void *rxdummy, void *rxbuffer, void *rxdummy,
size_t nwords) size_t nwords)
{ {
dtc_err_t ret = DTC_SUCCESS; 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 #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; uint8_t regval8;
@@ -1551,7 +1546,7 @@ static int rspi_idlinterrupt(int irq, void *context, FAR void *arg)
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_POLLWAIT #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); 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 #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 #ifdef CONFIG_RX65N_RSPI_DTC_DT_MODE
uint8_t regval8; uint8_t regval8;
@@ -1647,7 +1642,7 @@ static int rspi_rxinterrupt(int irq, void *context, FAR void *arg)
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_POLLWAIT #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); 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; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
int ret; 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) uint32_t frequency)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; 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; 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; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
uint8_t regval8; 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; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
uint32_t response = 0; 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 #ifdef CONFIG_SPI_EXCHANGE
static void rspi_exchange(FAR struct spi_dev_s *dev, static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer, void *rxbuffer, size_t nwords)
FAR void *rxbuffer, size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
rspi_transfer(priv, txbuffer, rxbuffer, nwords); rspi_transfer(priv, txbuffer, rxbuffer, nwords);
@@ -2016,7 +2010,7 @@ static void rspi_exchange(FAR struct spi_dev_s *dev,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_EXCHANGE #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) size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; 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 #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) size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; 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 * 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 */ /* 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; uint8_t regval8;
uint16_t regval16; 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 */ /* 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 /* Configure data control register SPDCR
* Four frames can be transmitted or received in one round of transmission * 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(); irqstate_t flags = enter_critical_section();
#ifdef CONFIG_RX65N_RSPI0 #ifdef CONFIG_RX65N_RSPI0
@@ -2534,7 +2528,7 @@ FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus)
} }
leave_critical_section(flags); 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 */ #endif /* CONFIG_RX65N_RSPI0 || CONFIG_RX65N_RSPI1 || CONFIG_RX65N_RSPI2 */
+16 -19
View File
@@ -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 * 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 #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); bool selected);
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);
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);
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #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); bool selected);
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);
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);
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #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); bool selected);
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);
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);
#endif #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_SPI_CALLBACK
#ifdef CONFIG_RX65N_RSPI0 #ifdef CONFIG_RX65N_RSPI0
int rx65n_rspi0register(FAR struct spi_dev_s *dev, int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg);
FAR void *arg);
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #ifdef CONFIG_RX65N_RSPI1
int rx65n_rspi1register(FAR struct spi_dev_s *dev, int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg);
FAR void *arg);
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #ifdef CONFIG_RX65N_RSPI2
int rx65n_rspi2register(FAR struct spi_dev_s *dev, int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg);
FAR void *arg);
#endif #endif
#endif #endif
+56 -62
View File
@@ -173,17 +173,17 @@ struct rx65n_rspidev_s
/* Helpers */ /* 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); 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); 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); 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); 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); 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); uint8_t offset, uint8_t value);
/* SPI data transfer */ /* SPI data transfer */
@@ -205,41 +205,39 @@ static int rspi_transfer(struct rx65n_rspidev_s *priv, const void *txbuffer,
#ifndef CONFIG_SPI_POLLWAIT #ifndef CONFIG_SPI_POLLWAIT
static inline struct rx65n_rspidev_s *rspi_mapirq(int irq); static inline struct rx65n_rspidev_s *rspi_mapirq(int irq);
static int rspi_idlinterrupt(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, FAR void *arg); static int rspi_erinterrupt(int irq, void *context, void *arg);
static int rspi_txinterrupt(int irq, void *context, FAR void *arg); static int rspi_txinterrupt(int irq, void *context, void *arg);
static int rspi_rxinterrupt(int irq, void *context, FAR void *arg); static int rspi_rxinterrupt(int irq, void *context, void *arg);
#endif #endif
/* SPI methods */ /* SPI methods */
static int rspi_lock(FAR struct spi_dev_s *dev, bool lock); static int rspi_lock(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); uint32_t frequency);
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);
static void rspi_setbits(FAR struct spi_dev_s *dev, int nbits); static void rspi_setbits(struct spi_dev_s *dev, int nbits);
#ifdef CONFIG_SPI_HWFEATURES #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); spi_hwfeatures_t features);
#endif #endif
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);
static void rspi_exchange(FAR struct spi_dev_s *dev, static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer, void *rxbuffer, size_t nwords);
FAR void *rxbuffer, size_t nwords);
#ifdef CONFIG_SPI_TRIGGER #ifdef CONFIG_SPI_TRIGGER
static int rspi_trigger(FAR struct spi_dev_s *dev); static int rspi_trigger(struct spi_dev_s *dev);
#endif #endif
#ifndef CONFIG_SPI_EXCHANGE #ifndef CONFIG_SPI_EXCHANGE
static void rspi_sndblock(FAR struct spi_dev_s *dev, static void rspi_sndblock(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer,
size_t nwords); 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); size_t nwords);
#endif #endif
/* Initialization */ /* Initialization */
static void rspi_bus_initialize(FAR struct rx65n_rspidev_s *priv); static void rspi_bus_initialize(struct rx65n_rspidev_s *priv);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -439,57 +437,57 @@ static struct rx65n_rspidev_s g_rspi2dev =
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RX65N_RSPI0 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; return -ENODEV;
} }
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; return -ENODEV;
} }
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #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) bool selected)
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
"de-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; 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; 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_SPI_CALLBACK
#ifdef CONFIG_RX65N_RSPI0 #ifdef CONFIG_RX65N_RSPI0
int rx65n_rspi0register(FAR struct spi_dev_s *dev, int rx65n_rspi0register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi0 device\n"); spiinfo("INFO: Registering rspi0 device\n");
return OK; return OK;
@@ -526,9 +523,8 @@ int rx65n_rspi0register(FAR struct spi_dev_s *dev,
#endif #endif
#ifdef CONFIG_RX65N_RSPI1 #ifdef CONFIG_RX65N_RSPI1
int rx65n_rspi1register(FAR struct spi_dev_s *dev, int rx65n_rspi1register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi1 device\n"); spiinfo("INFO: Registering rspi1 device\n");
return OK; return OK;
@@ -536,9 +532,8 @@ int rx65n_rspi1register(FAR struct spi_dev_s *dev,
#endif #endif
#ifdef CONFIG_RX65N_RSPI2 #ifdef CONFIG_RX65N_RSPI2
int rx65n_rspi2register(FAR struct spi_dev_s *dev, int rx65n_rspi2register(struct spi_dev_s *dev, spi_mediachange_t callback,
spi_mediachange_t callback, void *arg)
FAR void *arg)
{ {
spiinfo("INFO: Registering rspi2 device\n"); spiinfo("INFO: Registering rspi2 device\n");
return OK; return OK;
@@ -1178,7 +1173,7 @@ static void rspi_errhandle(struct rx65n_rspidev_s *priv, uint8_t bus)
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_POLLWAIT #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; uint8_t regval8;
@@ -1221,7 +1216,7 @@ static int rspi_idlinterrupt(int irq, void *context, FAR void *arg)
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_POLLWAIT #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); 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 #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); 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 #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); 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; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
int ret; int ret;
@@ -1366,7 +1361,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) uint32_t frequency)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
@@ -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; 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; 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; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
uint32_t response = 0; 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 #ifdef CONFIG_SPI_EXCHANGE
static void rspi_exchange(FAR struct spi_dev_s *dev, static void rspi_exchange(struct spi_dev_s *dev, const void *txbuffer,
FAR const void *txbuffer, void *rxbuffer, size_t nwords)
FAR void *rxbuffer, size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
rspi_transfer(priv, txbuffer, rxbuffer, nwords); rspi_transfer(priv, txbuffer, rxbuffer, nwords);
@@ -1646,7 +1640,7 @@ static void rspi_exchange(FAR struct spi_dev_s *dev,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_EXCHANGE #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) size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
@@ -1675,7 +1669,7 @@ static void rspi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SPI_EXCHANGE #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) size_t nwords)
{ {
struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev; struct rx65n_rspidev_s *priv = (struct rx65n_rspidev_s *)dev;
@@ -1690,7 +1684,7 @@ static void rspi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
* Return Value : none * 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 */ /* 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; uint8_t regval8;
uint16_t regval16; 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 */ /* 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 /* Configure data control register SPDCR
* Four frames can be transmitted or received in one round of transmission * 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(); irqstate_t flags = enter_critical_section();
@@ -2139,7 +2133,7 @@ FAR struct spi_dev_s *rx65n_rspibus_initialize(int bus)
} }
leave_critical_section(flags); 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 */ #endif /* CONFIG_RX65N_RSPI0 || CONFIG_RX65N_RSPI1 || CONFIG_RX65N_RSPI2 */
+20 -20
View File
@@ -83,7 +83,7 @@ static int rtc_bcd2dec(uint32_t value);
struct alm_cbinfo_s struct alm_cbinfo_s
{ {
volatile alm_callback_t ac_cb; /* Client callback function */ 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 #endif
@@ -93,7 +93,7 @@ struct alm_cbinfo_s
struct prd_cbinfo_s struct prd_cbinfo_s
{ {
volatile periodiccb_t prd_cb; /* Client callback function */ 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 #endif
@@ -148,7 +148,7 @@ volatile bool g_rtc_enabled = false;
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC_INFO #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("%s:\n", msg);
rtcinfo(" 64-Hz Counter: %08x\n", getreg8(RX65N_RTC_R64CNT)); 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 #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("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec); rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
@@ -261,9 +261,9 @@ static int rtc_bcd2dec(uint32_t value)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #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; alm_callback_t cb;
uint8_t source = rx65n_getreg(RX65N_RTC_RCR1); uint8_t source = rx65n_getreg(RX65N_RTC_RCR1);
if ((source & RTC_ALARM_INT_ENABLE) != 0) 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; cbinfo = &g_alarmcb;
cb = cbinfo->ac_cb; cb = cbinfo->ac_cb;
arg = (FAR void *)cbinfo->ac_arg; arg = (void *)cbinfo->ac_arg;
cbinfo->ac_cb = NULL; cbinfo->ac_cb = NULL;
cbinfo->ac_arg = NULL; cbinfo->ac_arg = NULL;
cb(arg, 0); cb(arg, 0);
@@ -284,9 +284,9 @@ static int rtc_alm_interrupt(int irq, void *context, FAR void *arg)
#endif #endif
#ifdef CONFIG_RTC_PERIODIC #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; periodiccb_t cb;
uint8_t source = rx65n_getreg(RX65N_RTC_RCR1); uint8_t source = rx65n_getreg(RX65N_RTC_RCR1);
if ((source & RTC_PERIOD_INT_ENABLE) != 0) 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; cbinfo = &g_periodiccb;
cb = cbinfo->prd_cb; cb = cbinfo->prd_cb;
arg = (FAR void *)cbinfo->prd_arg; arg = (void *)cbinfo->prd_arg;
cb(arg, 0); cb(arg, 0);
} }
@@ -304,7 +304,7 @@ static int rtc_periodic_interrupt(int irq, void *context, FAR void *arg)
#endif #endif
#ifdef CONFIG_RX65N_CARRY #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); uint8_t source = rx65n_getreg(RX65N_RTC_RCR1);
if ((source & RTC_CARRY_INT_ENABLE) != 0) if ((source & RTC_CARRY_INT_ENABLE) != 0)
@@ -457,7 +457,7 @@ int up_rtc_initialize(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_RTC_HIRES) #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 weekcnt;
uint8_t daycnt; uint8_t daycnt;
@@ -543,7 +543,7 @@ int up_rtc_gettime(FAR struct timespec *tp)
} }
#endif #endif
int rx65n_rtc_setdatetime(FAR const struct tm *tp) int rx65n_rtc_setdatetime(const struct tm *tp)
{ {
int i; int i;
volatile uint8_t dummy_byte; 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; int i;
volatile uint8_t dummy_byte; volatile uint8_t dummy_byte;
volatile uint16_t dummy_word; volatile uint16_t dummy_word;
@@ -845,7 +845,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #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; uint8_t bcd_years;
DEBUGASSERT(tp != NULL); DEBUGASSERT(tp != NULL);
@@ -880,7 +880,7 @@ static int rx65n_rtc_getalarmdatetime(FAR struct tm *tp)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #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; int ret = -EINVAL;
DEBUGASSERT(alminfo != NULL); DEBUGASSERT(alminfo != NULL);
@@ -905,7 +905,7 @@ int rx65n_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #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; irqstate_t flags;
uint8_t dummy_byte; uint8_t dummy_byte;
@@ -1074,7 +1074,7 @@ int rx65n_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
#endif #endif
#ifdef CONFIG_RTC_PERIODIC #ifdef CONFIG_RTC_PERIODIC
int rx65n_rtc_setperiodic(FAR const struct timespec *period, int rx65n_rtc_setperiodic(const struct timespec *period,
periodiccb_t callback) periodiccb_t callback)
{ {
irqstate_t flags; irqstate_t flags;
@@ -1249,7 +1249,7 @@ int rx65n_rtc_cancelcarry(void)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_DATETIME #ifdef CONFIG_RTC_DATETIME
int up_rtc_getdatetime(FAR struct tm *tp) int up_rtc_getdatetime(struct tm *tp)
{ {
uint8_t weekcnt; uint8_t weekcnt;
uint8_t daycnt; uint8_t daycnt;
+9 -9
View File
@@ -44,7 +44,7 @@
/* The form of an alarm callback */ /* 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 */ /* Structure used to pass parameters to set an alarm */
@@ -53,7 +53,7 @@ struct alm_setalarm_s
int as_id; /* enum alm_id_e */ int as_id; /* enum alm_id_e */
struct tm as_time; /* Alarm expiration time */ struct tm as_time; /* Alarm expiration time */
alm_callback_t as_cb; /* Callback (if non-NULL) */ 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 */ /* Structure used to pass parameters to query an alarm */
@@ -61,13 +61,13 @@ struct alm_setalarm_s
struct alm_rdalarm_s struct alm_rdalarm_s
{ {
int ar_id; /* enum alm_id_e */ 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 */ #endif /* CONFIG_RTC_ALARM */
#ifdef CONFIG_RTC_PERIODIC #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 #endif
#ifdef CONFIG_RX65N_CARRY #ifdef CONFIG_RX65N_CARRY
@@ -109,7 +109,7 @@ extern "C"
#ifdef CONFIG_RTC_DATETIME #ifdef CONFIG_RTC_DATETIME
struct tm; struct tm;
int rx65n_rtc_setdatetime(FAR const struct tm *tp); int rx65n_rtc_setdatetime(const struct tm *tp);
#endif #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 * 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 * 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); periodiccb_t callback);
/**************************************************************************** /****************************************************************************
@@ -235,7 +235,7 @@ int rx65n_rtc_cancelperiodic(void);
#ifdef CONFIG_RTC_DRIVER #ifdef CONFIG_RTC_DRIVER
struct rtc_lowerhalf_s; struct rtc_lowerhalf_s;
FAR struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void); struct rtc_lowerhalf_s *rx65n_rtc_lowerhalf(void);
#endif #endif
#undef EXTERN #undef EXTERN
+59 -63
View File
@@ -59,7 +59,7 @@
struct rx65n_cbinfo_s struct rx65n_cbinfo_s
{ {
volatile rtc_alarm_callback_t cb; /* Callback when the alarm expires */ 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 */ uint8_t id; /* Identifies the alarm */
}; };
#endif #endif
@@ -74,7 +74,7 @@ struct rx65n_lowerhalf_s
* operations vtable (which may lie in FLASH or ROM) * 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 /* Data following is private to this driver and not visible outside of
* this file. * this file.
@@ -101,29 +101,27 @@ struct rx65n_lowerhalf_s
/* Prototypes for static methods in struct rtc_ops_s */ /* Prototypes for static methods in struct rtc_ops_s */
static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower, static int rx65n_rdtime(struct rtc_lowerhalf_s *lower,
FAR struct rtc_time *rtctime); struct rtc_time *rtctime);
static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, static int rx65n_settime(struct rtc_lowerhalf_s *lower,
FAR const struct rtc_time *rtctime); const struct rtc_time *rtctime);
static bool rx65n_havesettime(FAR struct rtc_lowerhalf_s *lower); static bool rx65n_havesettime(struct rtc_lowerhalf_s *lower);
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setalarm(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setalarm_s *alarminfo); const struct lower_setalarm_s *alarminfo);
static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setrelative_s const struct lower_setrelative_s *alarminfo);
*alarminfo); static int rx65n_cancelalarm(struct rtc_lowerhalf_s *lower,
static int rx65n_cancelalarm(FAR struct rtc_lowerhalf_s *lower,
int alarmid); int alarmid);
static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower, static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower,
FAR struct lower_rdalarm_s *alarminfo); struct lower_rdalarm_s *alarminfo);
#endif #endif
#ifdef CONFIG_RTC_PERIODIC #ifdef CONFIG_RTC_PERIODIC
static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setperiodic(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setperiodic_s const struct lower_setperiodic_s *alarminfo);
*alarminfo); static int rx65n_cancelperiodic(struct rtc_lowerhalf_s *lower, int id);
static int rx65n_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id);
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -183,12 +181,12 @@ static struct rx65n_lowerhalf_s g_rtc_lowerhalf =
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #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; struct rx65n_lowerhalf_s *lower;
FAR struct rx65n_cbinfo_s *cbinfo; struct rx65n_cbinfo_s *cbinfo;
rtc_alarm_callback_t cb; rtc_alarm_callback_t cb;
FAR void *priv; void *priv;
DEBUGASSERT(arg != NULL); 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; cb = (rtc_alarm_callback_t)cbinfo->cb;
priv = (FAR void *)cbinfo->priv; priv = (void *)cbinfo->priv;
cbinfo->cb = NULL; cbinfo->cb = NULL;
cbinfo->priv = 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, static int rx65n_rdtime(struct rtc_lowerhalf_s *lower,
FAR struct rtc_time *rtctime) struct rtc_time *rtctime)
{ {
#if defined(CONFIG_RTC_DATETIME) #if defined(CONFIG_RTC_DATETIME)
/* This operation depends on the fact that struct rtc_time is cast /* 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; int ret;
return up_rtc_getdatetime((FAR struct tm *)rtctime); return up_rtc_getdatetime((struct tm *)rtctime);
#elif defined(CONFIG_RTC_HIRES) #elif defined(CONFIG_RTC_HIRES)
FAR struct timespec ts; struct timespec ts;
int ret; int ret;
/* Get the higher resolution time */ /* Get the higher resolution time */
@@ -258,7 +256,7 @@ static int rx65n_rdtime(FAR struct rtc_lowerhalf_s *lower,
* compatible. * compatible.
*/ */
if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime)) if (!gmtime_r(&ts.tv_sec, (struct tm *)rtctime))
{ {
ret = -get_errno(); ret = -get_errno();
goto errout; goto errout;
@@ -288,15 +286,15 @@ errout:
* *
****************************************************************************/ ****************************************************************************/
static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower, static int rx65n_settime(struct rtc_lowerhalf_s *lower,
FAR const struct rtc_time *rtctime) const struct rtc_time *rtctime)
{ {
#ifdef CONFIG_RTC_DATETIME #ifdef CONFIG_RTC_DATETIME
/* This operation depends on the fact that struct rtc_time is cast /* This operation depends on the fact that struct rtc_time is cast
* compatible with struct tm. * compatible with struct tm.
*/ */
return rx65n_rtc_setdatetime((FAR const struct tm *)rtctime); return rx65n_rtc_setdatetime((const struct tm *)rtctime);
#else #else
struct timespec ts; 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. * 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; ts.tv_nsec = 0;
/* Now set the time (to one second accuracy) */ /* 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 ; return true ;
} }
@@ -351,16 +349,16 @@ static bool rx65n_havesettime(FAR struct rtc_lowerhalf_s *lower)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setalarm(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setalarm_s *alarminfo) const struct lower_setalarm_s *alarminfo)
{ {
FAR struct rx65n_lowerhalf_s *priv; struct rx65n_lowerhalf_s *priv;
FAR struct rx65n_cbinfo_s *cbinfo; struct rx65n_cbinfo_s *cbinfo;
struct alm_setalarm_s lowerinfo; struct alm_setalarm_s lowerinfo;
int ret; int ret;
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); 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); ret = nxmutex_lock(&priv->devlock);
if (ret < 0) if (ret < 0)
@@ -416,9 +414,8 @@ static int rx65n_setalarm(FAR struct rtc_lowerhalf_s *lower,
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setrelative_s const struct lower_setrelative_s *alarminfo)
*alarminfo)
{ {
struct lower_setalarm_s setalarm; struct lower_setalarm_s setalarm;
struct tm time; 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 */ /* 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 */ /* 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 #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; struct rx65n_lowerhalf_s *priv;
FAR struct rx65n_cbinfo_s *cbinfo; struct rx65n_cbinfo_s *cbinfo;
DEBUGASSERT(lower != NULL); DEBUGASSERT(lower != NULL);
DEBUGASSERT(alarmid == 0); 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 */ /* 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 #ifdef CONFIG_RTC_ALARM
static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower, static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower,
FAR struct lower_rdalarm_s *alarminfo) struct lower_rdalarm_s *alarminfo)
{ {
struct alm_rdalarm_s lowerinfo; struct alm_rdalarm_s lowerinfo;
int ret = -EINVAL; int ret = -EINVAL;
@@ -596,16 +593,16 @@ static int rx65n_rdalarm(FAR struct rtc_lowerhalf_s *lower,
#ifdef CONFIG_RTC_PERIODIC #ifdef CONFIG_RTC_PERIODIC
static int rx65n_periodic_callback(void) static int rx65n_periodic_callback(void)
{ {
FAR struct rx65n_lowerhalf_s *lower; struct rx65n_lowerhalf_s *lower;
struct lower_setperiodic_s *cbinfo; struct lower_setperiodic_s *cbinfo;
periodiccb_t cb; 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; cbinfo = &lower->periodic;
cb = (periodiccb_t)cbinfo->cb; cb = (periodiccb_t)cbinfo->cb;
priv = (FAR void *)cbinfo->priv; priv = (void *)cbinfo->priv;
/* Perform the callback */ /* Perform the callback */
@@ -637,15 +634,14 @@ static int rx65n_periodic_callback(void)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_PERIODIC #ifdef CONFIG_RTC_PERIODIC
static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower, static int rx65n_setperiodic(struct rtc_lowerhalf_s *lower,
FAR const struct lower_setperiodic_s const struct lower_setperiodic_s *alarminfo)
*alarminfo)
{ {
FAR struct rx65n_lowerhalf_s *priv; struct rx65n_lowerhalf_s *priv;
int ret; int ret;
DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(lower != NULL && alarminfo != NULL);
priv = (FAR struct rx65n_lowerhalf_s *)lower; priv = (struct rx65n_lowerhalf_s *)lower;
ret = nxmutex_lock(&priv->devlock); ret = nxmutex_lock(&priv->devlock);
if (ret < 0) if (ret < 0)
@@ -679,13 +675,13 @@ static int rx65n_setperiodic(FAR struct rtc_lowerhalf_s *lower,
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_RTC_PERIODIC #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; int ret;
DEBUGASSERT(lower != NULL); DEBUGASSERT(lower != NULL);
priv = (FAR struct rx65n_lowerhalf_s *)lower; priv = (struct rx65n_lowerhalf_s *)lower;
DEBUGASSERT(id == 0); 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 */ #endif /* CONFIG_RTC_DRIVER */
+46 -50
View File
@@ -93,28 +93,26 @@ struct rx65n_sbram_s
{ {
mutex_t lock; /* For atomic accesses to this structure */ mutex_t lock; /* For atomic accesses to this structure */
uint8_t refs; /* Number of references */ uint8_t refs; /* Number of references */
FAR struct sbramfh_s *bbf; /* File in bbram */ struct sbramfh_s *bbf; /* File in bbram */
}; };
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static int rx65n_sbram_open(FAR struct file *filep); static int rx65n_sbram_open(struct file *filep);
static int rx65n_sbram_close(FAR struct file *filep); static int rx65n_sbram_close(struct file *filep);
static off_t rx65n_sbram_seek(FAR struct file *filep, off_t offset, static off_t rx65n_sbram_seek(struct file *filep, off_t offset,
int whence); int whence);
static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer, static ssize_t rx65n_sbram_read(struct file *filep, char *buffer,
size_t len); size_t len);
static ssize_t rx65n_sbram_write(FAR struct file *filep, static ssize_t rx65n_sbram_write(struct file *filep, const char *buffer,
FAR const char *buffer, size_t len); size_t len);
static int rx65n_sbram_ioctl(FAR struct file *filep, int cmd, static int rx65n_sbram_ioctl(struct file *filep, int cmd, unsigned long arg);
unsigned long arg); static int rx65n_sbram_poll(struct file *filep, struct pollfd *fds,
static int rx65n_sbram_poll(FAR struct file *filep,
FAR struct pollfd *fds,
bool setup); bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int rx65n_sbram_unlink(FAR struct inode *inode); static int rx65n_sbram_unlink(struct inode *inode);
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -161,7 +159,7 @@ static void rx65n_sbram_rd(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SBRAM_DEBUG) #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(); SBRAM_DEBUG_READ();
_info("%s:\n", op); _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, return crc32((uint8_t *)pf + SBRAM_CRCED_OFFSET,
SBRAM_CRCED_SIZE(pf->len)); 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; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
DEBUGASSERT(inode && inode->i_private); 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 */ /* 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; bbf->dirty = 0;
clock_gettime(CLOCK_REALTIME, &bbf->lastwrite); 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; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
int ret = OK; int ret = OK;
DEBUGASSERT(inode && inode->i_private); 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); nxmutex_lock(&bbr->lock);
@@ -293,16 +291,16 @@ static int rx65n_sbram_close(FAR struct file *filep)
* Name: rx65n_sbram_seek * Name: rx65n_sbram_seek
****************************************************************************/ ****************************************************************************/
static off_t rx65n_sbram_seek(FAR struct file *filep, off_t offset, static off_t rx65n_sbram_seek(struct file *filep, off_t offset,
int whence) int whence)
{ {
FAR struct inode *inode = filep->f_inode; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
off_t newpos; off_t newpos;
int ret; int ret;
DEBUGASSERT(inode && inode->i_private); 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); 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 * Name: rx65n_sbram_read
****************************************************************************/ ****************************************************************************/
static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer, static ssize_t rx65n_sbram_read(struct file *filep, char *buffer,
size_t len) size_t len)
{ {
FAR struct inode *inode = filep->f_inode; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
DEBUGASSERT(inode && inode->i_private); 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); nxmutex_lock(&bbr->lock);
@@ -392,8 +390,8 @@ static ssize_t rx65n_sbram_read(FAR struct file *filep, FAR char *buffer,
* Name: rx65n_sbram_internal_write * Name: rx65n_sbram_internal_write
****************************************************************************/ ****************************************************************************/
static ssize_t rx65n_sbram_internal_write(FAR struct sbramfh_s *bbf, static ssize_t rx65n_sbram_internal_write(struct sbramfh_s *bbf,
FAR const char *buffer, const char *buffer,
off_t offset, size_t len) off_t offset, size_t len)
{ {
bbf->dirty = 1; bbf->dirty = 1;
@@ -405,16 +403,15 @@ static ssize_t rx65n_sbram_internal_write(FAR struct sbramfh_s *bbf,
* Name: rx65n_sbram_write * Name: rx65n_sbram_write
****************************************************************************/ ****************************************************************************/
static ssize_t rx65n_sbram_write(FAR struct file *filep, static ssize_t rx65n_sbram_write(struct file *filep, const char *buffer,
FAR const char *buffer,
size_t len) size_t len)
{ {
FAR struct inode *inode = filep->f_inode; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
int ret = -EFBIG; int ret = -EFBIG;
DEBUGASSERT(inode && inode->i_private); 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 */ /* Forbid writes past the end of the device */
@@ -445,7 +442,7 @@ static ssize_t rx65n_sbram_write(FAR struct file *filep,
* Name: rx65n_sbram_poll * Name: rx65n_sbram_poll
****************************************************************************/ ****************************************************************************/
static int rx65n_sbram_poll(FAR struct file *filep, FAR struct pollfd *fds, static int rx65n_sbram_poll(struct file *filep, struct pollfd *fds,
bool setup) bool setup)
{ {
if (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, static int rx65n_sbram_ioctl(struct file *filep, int cmd, unsigned long arg)
unsigned long arg)
{ {
FAR struct inode *inode = filep->f_inode; struct inode *inode = filep->f_inode;
FAR struct rx65n_sbram_s *bbr; struct rx65n_sbram_s *bbr;
int ret = -ENOTTY; int ret = -ENOTTY;
DEBUGASSERT(inode && inode->i_private); 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) 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); nxmutex_lock(&bbr->lock);
if (!bbrr) if (!bbrr)
@@ -513,12 +509,12 @@ static int rx65n_sbram_ioctl(FAR struct file *filep, int cmd,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #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); 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); nxmutex_lock(&bbr->lock);
memset(bbr->bbf->data, 0, bbr->bbf->len); 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) #if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
int rx65n_sbram_savepanic(int fileno, uint8_t *context, int length) int rx65n_sbram_savepanic(int fileno, uint8_t *context, int length)
{ {
FAR struct sbramfh_s *bbf; struct sbramfh_s *bbf;
int fill; int fill;
int ret = -ENOSPC; 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 with 0 if data is less then file size */
fill = (int) bbf->len - length; fill = (int)bbf->len - length;
if (fill > 0) if (fill > 0)
{ {
+5 -5
View File
@@ -281,10 +281,10 @@ static void up_shutdown(struct uart_dev_s *dev);
static int up_attach(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev);
static void up_detach(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_ioctl(struct file *filep, int cmd, unsigned long arg);
static int up_xmtinterrupt(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, FAR void *arg); static int up_rcvinterrupt(int irq, void *context, void *arg);
static int up_eriinterrupt(int irq, void *context, FAR void *arg); static int up_eriinterrupt(int irq, void *context, void *arg);
static int up_teiinterrupt(int irq, void *context, FAR 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 int up_receive(struct uart_dev_s *dev, unsigned int *status);
static void up_rxint(struct uart_dev_s *dev, bool enable); static void up_rxint(struct uart_dev_s *dev, bool enable);
static bool up_rxavailable(struct uart_dev_s *dev); 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; struct uart_dev_s *dev;
dev = (struct uart_dev_s *)arg; dev = (struct uart_dev_s *)arg;
File diff suppressed because it is too large Load Diff
+24 -21
View File
@@ -358,7 +358,7 @@ static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv,
/* Interrupt handling *******************************************************/ /* 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 *******************************************/ /* USB host controller operations *******************************************/
@@ -370,8 +370,8 @@ 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, static int rx65n_usbhost_ep0configure(struct usbhost_driver_s *drvr,
usbhost_ep_t ep0, uint8_t funcaddr, uint8_t speed, usbhost_ep_t ep0, uint8_t funcaddr,
uint16_t maxpacketsize); uint8_t speed, uint16_t maxpacketsize);
static int rx65n_usbhost_epalloc(struct usbhost_driver_s *drvr, static int rx65n_usbhost_epalloc(struct usbhost_driver_s *drvr,
const struct usbhost_epdesc_s *epdesc, const struct usbhost_epdesc_s *epdesc,
usbhost_ep_t *ep); usbhost_ep_t *ep);
@@ -394,14 +394,16 @@ static int rx65n_usbhost_ctrlout(struct usbhost_driver_s *drvr,
const struct usb_ctrlreq_s *req, const struct usb_ctrlreq_s *req,
const uint8_t *buffer); const uint8_t *buffer);
static int rx65n_usbhost_transfer_common(struct rx65n_usbhost_s *priv, static int rx65n_usbhost_transfer_common(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed, uint8_t *buffer, struct rx65n_usbhost_ed_s *ed,
size_t buflen); uint8_t *buffer, size_t buflen);
#if RX65N_USBHOST_IOBUFFERS > 0 #if RX65N_USBHOST_IOBUFFERS > 0
static int rx65n_usbhost_dma_alloc(struct rx65n_usbhost_s *priv, static int rx65n_usbhost_dma_alloc(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed, uint8_t *userbuffer, struct rx65n_usbhost_ed_s *ed,
uint8_t *userbuffer,
size_t buflen, uint8_t **alloc); size_t buflen, uint8_t **alloc);
static void rx65n_usbhost_dma_free(struct rx65n_usbhost_s *priv, static void rx65n_usbhost_dma_free(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed, uint8_t *userbuffer, struct rx65n_usbhost_ed_s *ed,
uint8_t *userbuffer,
size_t buflen, uint8_t *alloc); size_t buflen, uint8_t *alloc);
#endif #endif
static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr, static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr,
@@ -410,15 +412,16 @@ static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr,
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
static void rx65n_usbhost_asynch_completion(struct rx65n_usbhost_s *priv, static void rx65n_usbhost_asynch_completion(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed); struct rx65n_usbhost_ed_s *ed);
static int rx65n_usbhost_asynch(FAR struct usbhost_driver_s *drvr, static int rx65n_usbhost_asynch(struct usbhost_driver_s *drvr,
usbhost_ep_t ep, FAR uint8_t *buffer, size_t buflen, usbhost_ep_t ep, uint8_t *buffer,
usbhost_asynch_t callback, FAR void *arg); size_t buflen, usbhost_asynch_t callback,
void *arg);
#endif #endif
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); usbhost_ep_t ep);
#ifdef CONFIG_USBHOST_HUB #ifdef CONFIG_USBHOST_HUB
static int rx65n_usbhost_connect(FAR struct usbhost_driver_s *drvr, static int rx65n_usbhost_connect(struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport, struct usbhost_hubport_s *hport,
bool connected); bool connected);
#endif #endif
static void rx65n_usbhost_disconnect(struct usbhost_driver_s *drvr, static void rx65n_usbhost_disconnect(struct usbhost_driver_s *drvr,
@@ -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 intenb0;
uint16_t intenb1; 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, static int rx65n_usbhost_enumerate(struct usbhost_connection_s *conn,
FAR struct usbhost_hubport_s *hport) struct usbhost_hubport_s *hport)
{ {
int ret; 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, static int rx65n_usbhost_ioalloc(struct usbhost_driver_s *drvr,
uint8_t **buffer, size_t buflen) uint8_t **buffer, size_t buflen)
{ {
FAR uint8_t *alloc; uint8_t *alloc;
DEBUGASSERT(drvr && buffer && buflen > 0); DEBUGASSERT(drvr && buffer && buflen > 0);
/* There is no special memory requirement */ /* There is no special memory requirement */
alloc = (FAR uint8_t *)kmm_malloc(buflen); alloc = (uint8_t *)kmm_malloc(buflen);
if (!alloc) if (!alloc)
{ {
return -ENOMEM; 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) usbhost_ep_t ep)
{ {
#ifdef CONFIG_USBHOST_ASYNCH #ifdef CONFIG_USBHOST_ASYNCH
@@ -7975,8 +7978,8 @@ static int rx65n_usbhost_cancel(FAR struct usbhost_driver_s *drvr,
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_USBHOST_HUB #ifdef CONFIG_USBHOST_HUB
static int rx65n_usbhost_connect(FAR struct usbhost_driver_s *drvr, static int rx65n_usbhost_connect(struct usbhost_driver_s *drvr,
FAR struct usbhost_hubport_s *hport, struct usbhost_hubport_s *hport,
bool connected) bool connected)
{ {
struct rx65n_usbhost_s *priv = (struct rx65n_usbhost_s *)drvr; struct rx65n_usbhost_s *priv = (struct rx65n_usbhost_s *)drvr;
+1 -1
View File
@@ -235,7 +235,7 @@ extern "C"
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
struct usbhost_connection_s; struct usbhost_connection_s;
FAR struct usbhost_connection_s *rx65n_usbhost_initialize(int controller); struct usbhost_connection_s *rx65n_usbhost_initialize(int controller);
#endif #endif
#undef EXTERN #undef EXTERN
+1 -1
View File
@@ -112,7 +112,7 @@ static inline void sh1_registerdump(void)
void renesas_dumpstate(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 sp = up_getsp();
uint32_t ustackbase; uint32_t ustackbase;
uint32_t ustacksize; uint32_t ustacksize;
+2 -2
View File
@@ -141,7 +141,7 @@ static int up_setup(struct uart_dev_s *dev);
static void up_shutdown(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev);
static int up_attach(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev);
static void up_detach(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 int up_receive(struct uart_dev_s *dev, unsigned int *status);
static void up_rxint(struct uart_dev_s *dev, bool enable); static void up_rxint(struct uart_dev_s *dev, bool enable);
static bool up_rxavailable(struct uart_dev_s *dev); 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 uart_dev_s *dev = (struct uart_dev_s *)arg;
struct up_dev_s *priv; struct up_dev_s *priv;