Fix the coding style and typo issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
anjiahao 2022-09-06 14:18:45 +08:00 committed by Masayuki Ishikawa
parent d07792a343
commit a4563b8744
148 changed files with 1747 additions and 1744 deletions

View File

@ -292,6 +292,10 @@ struct dma_channel_s
static struct dma_channel_s g_dmach[NCHANNELS]; static struct dma_channel_s g_dmach[NCHANNELS];
static mutex_t g_dmalock = NXMUTEX_INITIALIZER; static mutex_t g_dmalock = NXMUTEX_INITIALIZER;
/****************************************************************************
* Private Functions
****************************************************************************/
static int dma_init(int ch); static int dma_init(int ch);
static int dma_uninit(int ch); static int dma_uninit(int ch);
static int dma_open(int ch); static int dma_open(int ch);
@ -328,6 +332,7 @@ static struct dmac_register_map *get_device(int ch)
case 2: return (struct dmac_register_map *)DMAC2_REG_BASE; case 2: return (struct dmac_register_map *)DMAC2_REG_BASE;
case 3: return (struct dmac_register_map *)DMAC3_REG_BASE; case 3: return (struct dmac_register_map *)DMAC3_REG_BASE;
} }
return NULL; return NULL;
} }
@ -335,7 +340,9 @@ static struct dmac_ch_register_map *get_channel(int ch)
{ {
struct dmac_register_map *dev = get_device(ch); struct dmac_register_map *dev = get_device(ch);
if (dev == NULL) if (dev == NULL)
{
return NULL; return NULL;
}
if (is_dmac(2, dev)) if (is_dmac(2, dev))
{ {

View File

@ -935,13 +935,11 @@ static int cxd56_emmc_geometry(struct inode *inode,
int cxd56_emmcinitialize(void) int cxd56_emmcinitialize(void)
{ {
struct cxd56_emmc_state_s *priv; struct cxd56_emmc_state_s *priv = &g_emmcdev;
uint8_t *buf; uint8_t *buf;
struct emmc_dma_desc_s *descs; struct emmc_dma_desc_s *descs;
int ret; int ret;
priv = &g_emmcdev;
ret = emmc_hwinitialize(); ret = emmc_hwinitialize();
if (ret != OK) if (ret != OK)
{ {

View File

@ -442,9 +442,7 @@ static int hif_initialize(struct hostif_buff_s *buffer)
cxd56_iccinit(CXD56_PROTO_HOSTIF); cxd56_iccinit(CXD56_PROTO_HOSTIF);
ret = cxd56_iccregisterhandler(CXD56_PROTO_HOSTIF, hif_rxhandler, NULL); return cxd56_iccregisterhandler(CXD56_PROTO_HOSTIF, hif_rxhandler, NULL);
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -179,7 +179,7 @@ static struct cxd56_spidev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_spi4ops .ops = &g_spi4ops,
}, },
.spibase = CXD56_IMG_SPI_BASE, .spibase = CXD56_IMG_SPI_BASE,
.spibasefreq = 0, .spibasefreq = 0,
@ -226,7 +226,7 @@ static struct cxd56_spidev_s g_spi5dev =
{ {
.spidev = .spidev =
{ {
&g_spi5ops .ops = &g_spi5ops,
}, },
.spibase = CXD56_IMG_WSPI_BASE, .spibase = CXD56_IMG_WSPI_BASE,
.spibasefreq = 0, .spibasefreq = 0,
@ -272,7 +272,7 @@ static struct cxd56_spidev_s g_spi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.spibase = CXD56_SPIM_BASE, .spibase = CXD56_SPIM_BASE,
.spibasefreq = 0, .spibasefreq = 0,
@ -318,7 +318,7 @@ static struct cxd56_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = CXD56_SCU_SPI_BASE, .spibase = CXD56_SCU_SPI_BASE,
.spibasefreq = 0, .spibasefreq = 0,

View File

@ -231,15 +231,7 @@ static ssize_t uart0_write(struct file *filep,
int cxd56_uart0initialize(const char *devname) int cxd56_uart0initialize(const char *devname)
{ {
int ret; return register_driver(devname, &g_uart0fops, 0666, NULL);
ret = register_driver(devname, &g_uart0fops, 0666, NULL);
if (ret != 0)
{
return ERROR;
}
return OK;
} }
/**************************************************************************** /****************************************************************************

View File

@ -294,7 +294,7 @@ static struct gd32_spidev_s g_spi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops
}, },
.spibase = GD32_SPI0, .spibase = GD32_SPI0,
.spiclock = GD32_PCLK2_FREQUENCY, .spiclock = GD32_PCLK2_FREQUENCY,

View File

@ -1976,7 +1976,7 @@ static int imxrt_lpi2c_dma_transfer(struct imxrt_lpi2c_priv_s *priv)
LPI2C_MIER_NDIE | LPI2C_MIER_ALIE | LPI2C_MIER_NDIE | LPI2C_MIER_ALIE |
LPI2C_MIER_PLTIE | LPI2C_MIER_FEIE); LPI2C_MIER_PLTIE | LPI2C_MIER_FEIE);
imxrt_dmach_start(priv->dma, imxrt_dma_callback, (void *)priv); imxrt_dmach_start(priv->dma, imxrt_dma_callback, priv);
imxrt_lpi2c_modifyreg(priv, IMXRT_LPI2C_MDER_OFFSET, 0, imxrt_lpi2c_modifyreg(priv, IMXRT_LPI2C_MDER_OFFSET, 0,
LPI2C_MDER_TDDE | LPI2C_MDER_RDDE); LPI2C_MDER_TDDE | LPI2C_MDER_RDDE);

View File

@ -242,7 +242,7 @@ static struct imxrt_lpspidev_s g_lpspi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = IMXRT_LPSPI1_BASE, .spibase = IMXRT_LPSPI1_BASE,
#ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS #ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS
@ -291,7 +291,7 @@ static struct imxrt_lpspidev_s g_lpspi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = IMXRT_LPSPI2_BASE, .spibase = IMXRT_LPSPI2_BASE,
#ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS #ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS
@ -340,7 +340,7 @@ static struct imxrt_lpspidev_s g_lpspi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = IMXRT_LPSPI3_BASE, .spibase = IMXRT_LPSPI3_BASE,
#ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS #ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS
@ -389,7 +389,7 @@ static struct imxrt_lpspidev_s g_lpspi4dev =
{ {
.spidev = .spidev =
{ {
&g_spi4ops .ops = &g_spi4ops,
}, },
.spibase = IMXRT_LPSPI4_BASE, .spibase = IMXRT_LPSPI4_BASE,
#ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS #ifdef CONFIG_IMXRT_LPSPI_INTERRUPTS
@ -1310,8 +1310,8 @@ static void imxrt_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 16-bit mode */ /* 16-bit mode */
const uint16_t *src = (const uint16_t *)txbuffer; const uint16_t *src = txbuffer;
uint16_t *dest = (uint16_t *) rxbuffer; uint16_t *dest = rxbuffer;
uint16_t word; uint16_t word;
while (nwords-- > 0) while (nwords-- > 0)
@ -1343,8 +1343,8 @@ static void imxrt_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 8-bit mode */ /* 8-bit mode */
const uint8_t *src = (const uint8_t *)txbuffer; const uint8_t *src = txbuffer;
uint8_t *dest = (uint8_t *) rxbuffer; uint8_t *dest = rxbuffer;
uint8_t word; uint8_t word;
while (nwords-- > 0) while (nwords-- > 0)
@ -1362,7 +1362,7 @@ static void imxrt_lpspi_exchange_nodma(struct spi_dev_s *dev,
/* Exchange one word */ /* Exchange one word */
word = (uint8_t) imxrt_lpspi_send(dev, (uint32_t) word); word = (uint8_t)imxrt_lpspi_send(dev, word);
/* Is there a buffer to receive the return value? */ /* Is there a buffer to receive the return value? */

View File

@ -1538,7 +1538,7 @@ static int imxrt_dma_setup(struct uart_dev_s *dev)
* worth of time to claim bytes before they are overwritten. * worth of time to claim bytes before they are overwritten.
*/ */
imxrt_dmach_start(priv->rxdma, imxrt_dma_rxcallback, (void *)priv); imxrt_dmach_start(priv->rxdma, imxrt_dma_rxcallback, priv);
} }
#endif #endif
@ -2398,7 +2398,7 @@ static void imxrt_dma_reenable(struct imxrt_uart_s *priv)
* worth of time to claim bytes before they are overwritten. * worth of time to claim bytes before they are overwritten.
*/ */
imxrt_dmach_start(priv->rxdma, imxrt_dma_rxcallback, (void *)priv); imxrt_dmach_start(priv->rxdma, imxrt_dma_rxcallback, priv);
/* Clear DMA suspended flag. */ /* Clear DMA suspended flag. */
@ -2569,7 +2569,7 @@ static void imxrt_dma_send(struct uart_dev_s *dev)
/* Start transmission with the callback on DMA completion */ /* Start transmission with the callback on DMA completion */
imxrt_dmach_start(priv->txdma, imxrt_dma_txcallback, (void *)priv); imxrt_dmach_start(priv->txdma, imxrt_dma_txcallback, priv);
} }
#endif #endif

View File

@ -2244,7 +2244,8 @@ static int imxrt_recvsetup(struct sdio_dev_s *dev, uint8_t *buffer,
* handler and DMA memory invalidation. * handler and DMA memory invalidation.
*/ */
priv->buffer = (uint32_t *) buffer; priv->remaining = nbytes; priv->buffer = (uint32_t *)buffer;
priv->remaining = nbytes;
/* Then set up the SDIO data path */ /* Then set up the SDIO data path */
@ -2292,7 +2293,8 @@ static int imxrt_sendsetup(struct sdio_dev_s *dev,
/* Save the source buffer information for use by the interrupt handler */ /* Save the source buffer information for use by the interrupt handler */
priv->buffer = (uint32_t *) buffer; priv->remaining = nbytes; priv->buffer = (uint32_t *)buffer;
priv->remaining = nbytes;
/* Then set up the SDIO data path */ /* Then set up the SDIO data path */

View File

@ -4042,10 +4042,6 @@ static int kinetis_epalloc(struct usbhost_driver_s *drvr,
epinfo->xfrtype = epdesc->xfrtype; epinfo->xfrtype = epdesc->xfrtype;
epinfo->speed = hport->speed; epinfo->speed = hport->speed;
/* The iocsem semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
nxsem_init(&epinfo->iocsem, 0, 0); nxsem_init(&epinfo->iocsem, 0, 0);
/* Success.. return an opaque reference to the endpoint information /* Success.. return an opaque reference to the endpoint information

View File

@ -123,7 +123,7 @@ static struct kl_spidev_s g_spi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops
}, },
.spibase = KL_SPI0_BASE, .spibase = KL_SPI0_BASE,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -156,7 +156,7 @@ static struct kl_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops
}, },
.spibase = KL_SPI1_BASE, .spibase = KL_SPI1_BASE,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,

View File

@ -306,7 +306,7 @@ static void dma_done(DMA_HANDLE handle, void *arg, int result)
test_done = 1; test_done = 1;
} }
void lc823450_dma_test() void lc823450_dma_test(void)
{ {
int i; int i;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)

View File

@ -815,7 +815,6 @@ int lc823450_mtd_uninitialize(uint32_t devno)
DEBUGASSERT(ret == OK); DEBUGASSERT(ret == OK);
nxmutex_destroy(&priv->lock); nxmutex_destroy(&priv->lock);
kmm_free(g_mtdmaster[ch]); kmm_free(g_mtdmaster[ch]);
g_mtdmaster[ch] = NULL; g_mtdmaster[ch] = NULL;

View File

@ -82,7 +82,7 @@
static mutex_t _sdc_lock[2] = static mutex_t _sdc_lock[2] =
{ {
NXMUTEX_INITIALIZER, NXMUTEX_INITIALIZER,
NXMUTEX_INITIALIZER NXMUTEX_INITIALIZER,
}; };
static struct sddrcfg_s _sdch0; static struct sddrcfg_s _sdch0;

View File

@ -168,7 +168,6 @@ struct up_dev_s
DMA_HANDLE hrxdma; DMA_HANDLE hrxdma;
DMA_HANDLE htxdma; DMA_HANDLE htxdma;
sem_t rxdma_wait; sem_t rxdma_wait;
sem_t rxpkt_wait;
sem_t txdma_wait; sem_t txdma_wait;
#endif /* CONFIG_HSUART */ #endif /* CONFIG_HSUART */
spinlock_t lock; spinlock_t lock;
@ -1112,7 +1111,7 @@ static void uart_rxdma_callback(DMA_HANDLE hdma, void *arg, int result)
* Name: up_hs_dmasetup * Name: up_hs_dmasetup
****************************************************************************/ ****************************************************************************/
static void up_hs_dmasetup() static void up_hs_dmasetup(void)
{ {
irqstate_t flags; irqstate_t flags;

View File

@ -128,7 +128,7 @@ static struct lc823450_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops
}, },
#ifndef CONFIG_SPI_OWNBUS #ifndef CONFIG_SPI_OWNBUS
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,

View File

@ -560,7 +560,7 @@ static struct usbdev_req_s *lc823450_epallocreq(struct usbdev_ep_s *ep)
usbtrace(TRACE_EPALLOCREQ, ((struct lc823450_ep_s *)ep)->epphy); usbtrace(TRACE_EPALLOCREQ, ((struct lc823450_ep_s *)ep)->epphy);
privreq = (struct lc823450_req_s *) privreq = (struct lc823450_req_s *)
kmm_malloc(sizeof(struct lc823450_req_s)); kmm_zalloc(sizeof(struct lc823450_req_s));
if (!privreq) if (!privreq)
{ {
@ -568,7 +568,6 @@ static struct usbdev_req_s *lc823450_epallocreq(struct usbdev_ep_s *ep)
return NULL; return NULL;
} }
memset(privreq, 0, sizeof(struct lc823450_req_s));
return &privreq->req; return &privreq->req;
} }
@ -1710,7 +1709,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
* Name: usbdev_msc_read_enter * Name: usbdev_msc_read_enter
****************************************************************************/ ****************************************************************************/
void usbdev_msc_read_enter() void usbdev_msc_read_enter(void)
{ {
struct lc823450_ep_s *privep; struct lc823450_ep_s *privep;
# ifdef CONFIG_DVFS # ifdef CONFIG_DVFS
@ -1727,7 +1726,7 @@ void usbdev_msc_read_enter()
* Name: usbdev_msc_read_exit * Name: usbdev_msc_read_exit
****************************************************************************/ ****************************************************************************/
void usbdev_msc_read_exit() void usbdev_msc_read_exit(void)
{ {
struct lc823450_ep_s *privep; struct lc823450_ep_s *privep;

View File

@ -140,7 +140,7 @@ static struct lpc17_40_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
}; };

View File

@ -178,7 +178,7 @@ static struct lpc17_40_sspdev_s g_ssp0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.sspbase = LPC17_40_SSP0_BASE, .sspbase = LPC17_40_SSP0_BASE,
#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS #ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
@ -214,7 +214,7 @@ static struct lpc17_40_sspdev_s g_ssp1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.sspbase = LPC17_40_SSP1_BASE, .sspbase = LPC17_40_SSP1_BASE,
#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS #ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
@ -250,7 +250,7 @@ static struct lpc17_40_sspdev_s g_ssp2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.sspbase = LPC17_40_SSP2_BASE, .sspbase = LPC17_40_SSP2_BASE,
#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS #ifdef CONFIG_LPC17_40_SSP_INTERRUPTS

View File

@ -159,7 +159,7 @@ static struct lpc23xx_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
}; };

View File

@ -155,7 +155,7 @@ static struct lpc31_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
}; };

View File

@ -131,7 +131,7 @@ static struct lpc43_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
}; };

View File

@ -145,7 +145,7 @@ static struct lpc43_sspdev_s g_ssp0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.sspbase = LPC43_SSP0_BASE, .sspbase = LPC43_SSP0_BASE,
.sspbasefreq = BOARD_SSP0_BASEFREQ, .sspbasefreq = BOARD_SSP0_BASEFREQ,
@ -186,7 +186,7 @@ static struct lpc43_sspdev_s g_ssp1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.sspbase = LPC43_SSP1_BASE, .sspbase = LPC43_SSP1_BASE,
.sspbasefreq = BOARD_SSP1_BASEFREQ, .sspbasefreq = BOARD_SSP1_BASEFREQ,

View File

@ -233,7 +233,7 @@ static struct max326_spidev_s g_spi0dev =
{ {
.dev = .dev =
{ {
&g_sp0iops .ops = &g_sp0iops,
}, },
.base = MAX326_SPI0_BASE, .base = MAX326_SPI0_BASE,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,

View File

@ -198,7 +198,7 @@ static struct nrf52_spidev_s g_spi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.base = NRF52_SPIM0_BASE, .base = NRF52_SPIM0_BASE,
@ -251,7 +251,7 @@ static struct nrf52_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.base = NRF52_SPIM1_BASE, .base = NRF52_SPIM1_BASE,
@ -304,7 +304,7 @@ static struct nrf52_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.base = NRF52_SPIM2_BASE, .base = NRF52_SPIM2_BASE,
@ -357,7 +357,7 @@ static struct nrf52_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.base = NRF52_SPIM3_BASE, .base = NRF52_SPIM3_BASE,

View File

@ -178,7 +178,7 @@ static struct rp2040_spidev_s g_spi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.spibase = RP2040_SPI0_BASE, .spibase = RP2040_SPI0_BASE,
.spibasefreq = 0, .spibasefreq = 0,
@ -227,7 +227,7 @@ static struct rp2040_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = RP2040_SPI1_BASE, .spibase = RP2040_SPI1_BASE,
.spibasefreq = 0, .spibasefreq = 0,
@ -874,7 +874,6 @@ struct spi_dev_s *rp2040_spibus_initialize(int port)
/* Set a initialized flag */ /* Set a initialized flag */
priv->initialized = 1; priv->initialized = 1;
return &priv->spidev; return &priv->spidev;
} }

View File

@ -1776,8 +1776,8 @@ static int s32k1xx_lpi2c_dma_transfer(struct s32k1xx_lpi2c_priv_s *priv)
LPI2C_MIER_NDIE | LPI2C_MIER_ALIE | LPI2C_MIER_NDIE | LPI2C_MIER_ALIE |
LPI2C_MIER_PLTIE | LPI2C_MIER_FEIE); LPI2C_MIER_PLTIE | LPI2C_MIER_FEIE);
s32k1xx_dmach_start(priv->rxdma, s32k1xx_rxdma_callback, (void *)priv); s32k1xx_dmach_start(priv->rxdma, s32k1xx_rxdma_callback, priv);
s32k1xx_dmach_start(priv->txdma, s32k1xx_txdma_callback, (void *)priv); s32k1xx_dmach_start(priv->txdma, s32k1xx_txdma_callback, priv);
s32k1xx_lpi2c_modifyreg(priv, S32K1XX_LPI2C_MDER_OFFSET, 0, s32k1xx_lpi2c_modifyreg(priv, S32K1XX_LPI2C_MDER_OFFSET, 0,
LPI2C_MDER_TDDE | LPI2C_MDER_RDDE); LPI2C_MDER_TDDE | LPI2C_MDER_RDDE);

View File

@ -255,7 +255,7 @@ static struct s32k1xx_lpspidev_s g_lpspi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.spibase = S32K1XX_LPSPI0_BASE, .spibase = S32K1XX_LPSPI0_BASE,
#ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS
@ -306,7 +306,7 @@ static struct s32k1xx_lpspidev_s g_lpspi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = S32K1XX_LPSPI1_BASE, .spibase = S32K1XX_LPSPI1_BASE,
#ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS
@ -357,7 +357,7 @@ static struct s32k1xx_lpspidev_s g_lpspi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = S32K1XX_LPSPI2_BASE, .spibase = S32K1XX_LPSPI2_BASE,
#ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K1XX_LPSPI_INTERRUPTS
@ -1369,8 +1369,8 @@ static void s32k1xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
* take care of big endian mode of hardware !! * take care of big endian mode of hardware !!
*/ */
const uint8_t *src = (const uint8_t *)txbuffer; const uint8_t *src = txbuffer;
uint8_t *dest = (uint8_t *) rxbuffer; uint8_t *dest = rxbuffer;
uint32_t word = 0x0; uint32_t word = 0x0;
#ifdef CONFIG_S32K1XX_LPSPI_DWORD #ifdef CONFIG_S32K1XX_LPSPI_DWORD
uint32_t word1 = 0x0; uint32_t word1 = 0x0;
@ -1447,8 +1447,8 @@ static void s32k1xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 32-bit or 64 bit, word size memory transfers */ /* 32-bit or 64 bit, word size memory transfers */
const uint32_t *src = (const uint32_t *)txbuffer; const uint32_t *src = txbuffer;
uint32_t *dest = (uint32_t *) rxbuffer; uint32_t *dest = rxbuffer;
uint32_t word = 0x0; uint32_t word = 0x0;
#ifdef CONFIG_S32K1XX_LPSPI_DWORD #ifdef CONFIG_S32K1XX_LPSPI_DWORD
uint32_t word1 = 0x0; uint32_t word1 = 0x0;
@ -1528,8 +1528,8 @@ static void s32k1xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 16-bit mode */ /* 16-bit mode */
const uint16_t *src = (const uint16_t *)txbuffer; const uint16_t *src = txbuffer;
uint16_t *dest = (uint16_t *) rxbuffer; uint16_t *dest = rxbuffer;
uint16_t word; uint16_t word;
while (nwords-- > 0) while (nwords-- > 0)
@ -1563,8 +1563,8 @@ static void s32k1xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 8-bit mode */ /* 8-bit mode */
const uint8_t *src = (const uint8_t *)txbuffer; const uint8_t *src = txbuffer;
uint8_t *dest = (uint8_t *) rxbuffer; uint8_t *dest = rxbuffer;
uint8_t word; uint8_t word;
while (nwords-- > 0) while (nwords-- > 0)

View File

@ -246,7 +246,7 @@ static struct s32k3xx_lpspidev_s g_lpspi0dev =
{ {
.spidev = .spidev =
{ {
&g_spi0ops .ops = &g_spi0ops,
}, },
.spibase = S32K3XX_LPSPI0_BASE, .spibase = S32K3XX_LPSPI0_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -296,7 +296,7 @@ static struct s32k3xx_lpspidev_s g_lpspi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = S32K3XX_LPSPI1_BASE, .spibase = S32K3XX_LPSPI1_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -346,7 +346,7 @@ static struct s32k3xx_lpspidev_s g_lpspi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = S32K3XX_LPSPI2_BASE, .spibase = S32K3XX_LPSPI2_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -396,7 +396,7 @@ static struct s32k3xx_lpspidev_s g_lpspi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = S32K3XX_LPSPI3_BASE, .spibase = S32K3XX_LPSPI3_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -446,7 +446,7 @@ static struct s32k3xx_lpspidev_s g_lpspi4dev =
{ {
.spidev = .spidev =
{ {
&g_spi4ops .ops = &g_spi4ops,
}, },
.spibase = S32K3XX_LPSPI4_BASE, .spibase = S32K3XX_LPSPI4_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -496,7 +496,7 @@ static struct s32k3xx_lpspidev_s g_lpspi5dev =
{ {
.spidev = .spidev =
{ {
&g_spi5ops .ops = &g_spi5ops,
}, },
.spibase = S32K3XX_LPSPI5_BASE, .spibase = S32K3XX_LPSPI5_BASE,
#ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS #ifdef CONFIG_S32K3XX_LPSPI_INTERRUPTS
@ -1535,8 +1535,8 @@ static void s32k3xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
* take care of big endian mode of hardware !! * take care of big endian mode of hardware !!
*/ */
const uint8_t *src = (const uint8_t *)txbuffer; const uint8_t *src = txbuffer;
uint8_t *dest = (uint8_t *) rxbuffer; uint8_t *dest = rxbuffer;
uint32_t word = 0x0; uint32_t word = 0x0;
#ifdef CONFIG_S32K3XX_LPSPI_DWORD #ifdef CONFIG_S32K3XX_LPSPI_DWORD
uint32_t word1 = 0x0; uint32_t word1 = 0x0;
@ -1613,8 +1613,8 @@ static void s32k3xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 32-bit or 64 bit, word size memory transfers */ /* 32-bit or 64 bit, word size memory transfers */
const uint32_t *src = (const uint32_t *)txbuffer; const uint32_t *src = txbuffer;
uint32_t *dest = (uint32_t *) rxbuffer; uint32_t *dest = rxbuffer;
uint32_t word = 0x0; uint32_t word = 0x0;
#ifdef CONFIG_S32K3XX_LPSPI_DWORD #ifdef CONFIG_S32K3XX_LPSPI_DWORD
uint32_t word1 = 0x0; uint32_t word1 = 0x0;
@ -1694,8 +1694,8 @@ static void s32k3xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 16-bit mode */ /* 16-bit mode */
const uint16_t *src = (const uint16_t *)txbuffer; const uint16_t *src = txbuffer;
uint16_t *dest = (uint16_t *) rxbuffer; uint16_t *dest = rxbuffer;
uint16_t word; uint16_t word;
while (nwords-- > 0) while (nwords-- > 0)
@ -1729,8 +1729,8 @@ static void s32k3xx_lpspi_exchange_nodma(struct spi_dev_s *dev,
{ {
/* 8-bit mode */ /* 8-bit mode */
const uint8_t *src = (const uint8_t *)txbuffer; const uint8_t *src = txbuffer;
uint8_t *dest = (uint8_t *) rxbuffer; uint8_t *dest = rxbuffer;
uint8_t word; uint8_t word;
while (nwords-- > 0) while (nwords-- > 0)

View File

@ -2408,7 +2408,8 @@ static int sam_sendsetup(struct sdio_dev_s *dev,
/* Save the source buffer information for use by the interrupt handler */ /* Save the source buffer information for use by the interrupt handler */
priv->buffer = (uint32_t *) buffer; priv->remaining = nbytes; priv->buffer = (uint32_t *)buffer;
priv->remaining = nbytes;
/* Then set up the SDIO data path */ /* Then set up the SDIO data path */

View File

@ -1174,8 +1174,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
/* Start RX and TX DMA channels */ /* Start RX and TX DMA channels */
sam_dmastart(priv->dma_tx, spi_dma_callback, (void *)priv); sam_dmastart(priv->dma_tx, spi_dma_callback, priv);
sam_dmastart(priv->dma_rx, spi_dma_callback, (void *)priv); sam_dmastart(priv->dma_rx, spi_dma_callback, priv);
/* Enable SPI to trigger the TX DMA channel */ /* Enable SPI to trigger the TX DMA channel */

View File

@ -1270,8 +1270,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
/* Start RX and TX DMA channels */ /* Start RX and TX DMA channels */
sam_dmastart(priv->dma_tx, spi_dma_callback, (void *)priv); sam_dmastart(priv->dma_tx, spi_dma_callback, priv);
sam_dmastart(priv->dma_rx, spi_dma_callback, (void *)priv); sam_dmastart(priv->dma_rx, spi_dma_callback, priv);
/* Enable SPI to trigger the TX DMA channel */ /* Enable SPI to trigger the TX DMA channel */

View File

@ -1006,7 +1006,7 @@ static uint32_t g_mcan0_msgram[MCAN0_MSGRAM_WORDS]
/* Constant configuration */ /* Constant configuration */
static struct sam_config_s g_mcan0const = static const struct sam_config_s g_mcan0const =
{ {
.rxpinset = GPIO_MCAN0_RX, .rxpinset = GPIO_MCAN0_RX,
.txpinset = GPIO_MCAN0_TX, .txpinset = GPIO_MCAN0_TX,
@ -1104,7 +1104,7 @@ static uint32_t g_mcan1_msgram[MCAN1_MSGRAM_WORDS]
/* MCAN1 constant configuration */ /* MCAN1 constant configuration */
static struct sam_config_s g_mcan1const = static const struct sam_config_s g_mcan1const =
{ {
.rxpinset = GPIO_MCAN1_RX, .rxpinset = GPIO_MCAN1_RX,
.txpinset = GPIO_MCAN1_TX, .txpinset = GPIO_MCAN1_TX,

View File

@ -856,7 +856,7 @@ static int qspi_memory_dma(struct sam_qspidev_s *priv,
/* Start the DMA */ /* Start the DMA */
priv->result = -EBUSY; priv->result = -EBUSY;
ret = sam_dmastart(priv->dmach, qspi_dma_callback, (void *)priv); ret = sam_dmastart(priv->dmach, qspi_dma_callback, priv);
if (ret < 0) if (ret < 0)
{ {
spierr("ERROR: sam_dmastart failed: %d\n", ret); spierr("ERROR: sam_dmastart failed: %d\n", ret);

View File

@ -189,7 +189,7 @@ static const struct sam_pidmap_s g_xdmac_txchan[] =
/* This array describes the available link list descriptors */ /* This array describes the available link list descriptors */
struct chnext_view1_s g_lldesc[CONFIG_SAMV7_NLLDESC]; static struct chnext_view1_s g_lldesc[CONFIG_SAMV7_NLLDESC];
/* This array describes the state of each XDMAC channel 0 */ /* This array describes the state of each XDMAC channel 0 */

View File

@ -110,7 +110,6 @@ struct stm32_dma2d_s
#ifdef CONFIG_STM32_FB_CMAP #ifdef CONFIG_STM32_FB_CMAP
uint32_t *clut; /* Color lookup table */ uint32_t *clut; /* Color lookup table */
#endif #endif
mutex_t *lock; /* Ensure mutually exclusive access */ mutex_t *lock; /* Ensure mutually exclusive access */
}; };

View File

@ -382,7 +382,7 @@ static const struct hciuart_config_s g_hciusart1_config =
.rxbuffer = g_usart1_rxbuffer, .rxbuffer = g_usart1_rxbuffer,
.txbuffer = g_usart1_txbuffer, .txbuffer = g_usart1_txbuffer,
#ifdef CONFIG_STM32_HCIUART1_RXDMA #ifdef CONFIG_STM32_HCIUART1_RXDMA
.rxdmabuffer = , .rxdmabuffer = g_usart1_rxdmabuffer,
#endif #endif
.rxbufsize = CONFIG_STM32_HCIUART1_RXBUFSIZE, .rxbufsize = CONFIG_STM32_HCIUART1_RXBUFSIZE,
.txbufsize = CONFIG_STM32_HCIUART1_TXBUFSIZE, .txbufsize = CONFIG_STM32_HCIUART1_TXBUFSIZE,

View File

@ -2468,11 +2468,18 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
static int stm32_i2c_transfer(struct i2c_master_s *dev, static int stm32_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count) struct i2c_msg_s *msgs, int count)
{ {
struct stm32_i2c_priv_s *priv;
int ret; int ret;
DEBUGASSERT(dev);
/* Get I2C private structure */
priv = ((struct stm32_i2c_inst_s *)dev)->priv;
/* Ensure that address or flags don't change meanwhile */ /* Ensure that address or flags don't change meanwhile */
ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret >= 0) if (ret >= 0)
{ {
ret = stm32_i2c_process(dev, msgs, count); ret = stm32_i2c_process(dev, msgs, count);

View File

@ -350,7 +350,7 @@ static struct stm32_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_sp1iops .ops = &g_sp1iops
}, },
.spibase = STM32_SPI1_BASE, .spibase = STM32_SPI1_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -361,7 +361,7 @@ static struct stm32_spidev_s g_spi1dev =
# ifdef CONFIG_STM32_SPI1_DMA # ifdef CONFIG_STM32_SPI1_DMA
.rxch = DMACHAN_SPI1_RX, .rxch = DMACHAN_SPI1_RX,
.txch = DMACHAN_SPI1_TX, .txch = DMACHAN_SPI1_TX,
#if defined(SPI1_DMABUFSIZE_ADJUSTED) # ifdef SPI1_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi1_rxbuf, .rxbuf = g_spi1_rxbuf,
.txbuf = g_spi1_txbuf, .txbuf = g_spi1_txbuf,
.buflen = SPI1_DMABUFSIZE_ADJUSTED, .buflen = SPI1_DMABUFSIZE_ADJUSTED,
@ -418,7 +418,7 @@ static struct stm32_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_sp2iops .ops = &g_sp2iops
}, },
.spibase = STM32_SPI2_BASE, .spibase = STM32_SPI2_BASE,
.spiclock = STM32_PCLK1_FREQUENCY, .spiclock = STM32_PCLK1_FREQUENCY,
@ -429,7 +429,7 @@ static struct stm32_spidev_s g_spi2dev =
# ifdef CONFIG_STM32_SPI2_DMA # ifdef CONFIG_STM32_SPI2_DMA
.rxch = DMACHAN_SPI2_RX, .rxch = DMACHAN_SPI2_RX,
.txch = DMACHAN_SPI2_TX, .txch = DMACHAN_SPI2_TX,
#if defined(SPI2_DMABUFSIZE_ADJUSTED) # ifdef SPI2_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi2_rxbuf, .rxbuf = g_spi2_rxbuf,
.txbuf = g_spi2_txbuf, .txbuf = g_spi2_txbuf,
.buflen = SPI2_DMABUFSIZE_ADJUSTED, .buflen = SPI2_DMABUFSIZE_ADJUSTED,
@ -486,7 +486,7 @@ static struct stm32_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_sp3iops .ops = &g_sp3iops
}, },
.spibase = STM32_SPI3_BASE, .spibase = STM32_SPI3_BASE,
.spiclock = STM32_PCLK1_FREQUENCY, .spiclock = STM32_PCLK1_FREQUENCY,
@ -497,7 +497,7 @@ static struct stm32_spidev_s g_spi3dev =
# ifdef CONFIG_STM32_SPI3_DMA # ifdef CONFIG_STM32_SPI3_DMA
.rxch = DMACHAN_SPI3_RX, .rxch = DMACHAN_SPI3_RX,
.txch = DMACHAN_SPI3_TX, .txch = DMACHAN_SPI3_TX,
#if defined(SPI3_DMABUFSIZE_ADJUSTED) # ifdef SPI3_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi3_rxbuf, .rxbuf = g_spi3_rxbuf,
.txbuf = g_spi3_txbuf, .txbuf = g_spi3_txbuf,
.buflen = SPI3_DMABUFSIZE_ADJUSTED, .buflen = SPI3_DMABUFSIZE_ADJUSTED,
@ -554,7 +554,7 @@ static struct stm32_spidev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_sp4iops .ops = &g_sp4iops
}, },
.spibase = STM32_SPI4_BASE, .spibase = STM32_SPI4_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -565,7 +565,7 @@ static struct stm32_spidev_s g_spi4dev =
# ifdef CONFIG_STM32_SPI4_DMA # ifdef CONFIG_STM32_SPI4_DMA
.rxch = DMACHAN_SPI4_RX, .rxch = DMACHAN_SPI4_RX,
.txch = DMACHAN_SPI4_TX, .txch = DMACHAN_SPI4_TX,
#if defined(SPI4_DMABUFSIZE_ADJUSTED) # ifdef SPI4_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi4_rxbuf, .rxbuf = g_spi4_rxbuf,
.txbuf = g_spi4_txbuf, .txbuf = g_spi4_txbuf,
.buflen = SPI4_DMABUFSIZE_ADJUSTED, .buflen = SPI4_DMABUFSIZE_ADJUSTED,
@ -622,7 +622,7 @@ static struct stm32_spidev_s g_spi5dev =
{ {
.spidev = .spidev =
{ {
&g_sp5iops .ops = &g_sp5iops
}, },
.spibase = STM32_SPI5_BASE, .spibase = STM32_SPI5_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -633,7 +633,7 @@ static struct stm32_spidev_s g_spi5dev =
# ifdef CONFIG_STM32_SPI5_DMA # ifdef CONFIG_STM32_SPI5_DMA
.rxch = DMACHAN_SPI5_RX, .rxch = DMACHAN_SPI5_RX,
.txch = DMACHAN_SPI5_TX, .txch = DMACHAN_SPI5_TX,
#if defined(SPI5_DMABUFSIZE_ADJUSTED) # ifdef SPI5_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi5_rxbuf, .rxbuf = g_spi5_rxbuf,
.txbuf = g_spi5_txbuf, .txbuf = g_spi5_txbuf,
.buflen = SPI5_DMABUFSIZE_ADJUSTED, .buflen = SPI5_DMABUFSIZE_ADJUSTED,
@ -690,7 +690,7 @@ static struct stm32_spidev_s g_spi6dev =
{ {
.spidev = .spidev =
{ {
&g_sp6iops .ops = &g_sp6iops
}, },
.spibase = STM32_SPI6_BASE, .spibase = STM32_SPI6_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -701,7 +701,7 @@ static struct stm32_spidev_s g_spi6dev =
# ifdef CONFIG_STM32_SPI6_DMA # ifdef CONFIG_STM32_SPI6_DMA
.rxch = DMACHAN_SPI6_RX, .rxch = DMACHAN_SPI6_RX,
.txch = DMACHAN_SPI6_TX, .txch = DMACHAN_SPI6_TX,
#if defined(SPI6_DMABUFSIZE_ADJUSTED) # ifdef SPI6_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi6_rxbuf, .rxbuf = g_spi6_rxbuf,
.txbuf = g_spi6_txbuf, .txbuf = g_spi6_txbuf,
.buflen = SPI6_DMABUFSIZE_ADJUSTED, .buflen = SPI6_DMABUFSIZE_ADJUSTED,

View File

@ -2464,11 +2464,18 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
static int stm32_i2c_transfer(struct i2c_master_s *dev, static int stm32_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count) struct i2c_msg_s *msgs, int count)
{ {
struct stm32_i2c_priv_s *priv;
int ret; int ret;
DEBUGASSERT(dev);
/* Get I2C private structure */
priv = ((struct stm32_i2c_inst_s *)dev)->priv;
/* Ensure that address or flags don't change meanwhile */ /* Ensure that address or flags don't change meanwhile */
ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret >= 0) if (ret >= 0)
{ {
ret = stm32_i2c_process(dev, msgs, count); ret = stm32_i2c_process(dev, msgs, count);

View File

@ -313,7 +313,7 @@ static struct stm32_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = STM32_SPI1_BASE, .spibase = STM32_SPI1_BASE,
.spiclock = SPI1_PCLK_FREQUENCY, .spiclock = SPI1_PCLK_FREQUENCY,
@ -372,7 +372,7 @@ static struct stm32_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = STM32_SPI2_BASE, .spibase = STM32_SPI2_BASE,
.spiclock = SPI1_PCLK_FREQUENCY, .spiclock = SPI1_PCLK_FREQUENCY,
@ -429,7 +429,7 @@ static struct stm32_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = STM32_SPI3_BASE, .spibase = STM32_SPI3_BASE,
.spiclock = SPI1_PCLK_FREQUENCY, .spiclock = SPI1_PCLK_FREQUENCY,

View File

@ -2505,11 +2505,18 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
static int stm32_i2c_transfer(struct i2c_master_s *dev, static int stm32_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count) struct i2c_msg_s *msgs, int count)
{ {
struct stm32_i2c_priv_s *priv;
int ret; int ret;
DEBUGASSERT(dev);
/* Get I2C private structure */
priv = ((struct stm32_i2c_inst_s *)dev)->priv;
/* Ensure that address or flags don't change meanwhile */ /* Ensure that address or flags don't change meanwhile */
ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret >= 0) if (ret >= 0)
{ {
ret = stm32_i2c_process(dev, msgs, count); ret = stm32_i2c_process(dev, msgs, count);

View File

@ -330,7 +330,7 @@ static struct stm32_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_sp1iops .ops = &g_sp1iops,
}, },
.spibase = STM32_SPI1_BASE, .spibase = STM32_SPI1_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -341,7 +341,7 @@ static struct stm32_spidev_s g_spi1dev =
# ifdef CONFIG_STM32F7_SPI1_DMA # ifdef CONFIG_STM32F7_SPI1_DMA
.rxch = DMAMAP_SPI1_RX, .rxch = DMAMAP_SPI1_RX,
.txch = DMAMAP_SPI1_TX, .txch = DMAMAP_SPI1_TX,
#if defined(SPI1_DMABUFSIZE_ADJUSTED) # ifdef SPI1_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi1_rxbuf, .rxbuf = g_spi1_rxbuf,
.txbuf = g_spi1_txbuf, .txbuf = g_spi1_txbuf,
.buflen = SPI1_DMABUFSIZE_ADJUSTED, .buflen = SPI1_DMABUFSIZE_ADJUSTED,
@ -401,7 +401,7 @@ static struct stm32_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_sp2iops .ops = &g_sp2iops,
}, },
.spibase = STM32_SPI2_BASE, .spibase = STM32_SPI2_BASE,
.spiclock = STM32_PCLK1_FREQUENCY, .spiclock = STM32_PCLK1_FREQUENCY,
@ -412,7 +412,7 @@ static struct stm32_spidev_s g_spi2dev =
# ifdef CONFIG_STM32F7_SPI2_DMA # ifdef CONFIG_STM32F7_SPI2_DMA
.rxch = DMAMAP_SPI2_RX, .rxch = DMAMAP_SPI2_RX,
.txch = DMAMAP_SPI2_TX, .txch = DMAMAP_SPI2_TX,
#if defined(SPI2_DMABUFSIZE_ADJUSTED) # ifdef SPI3_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi2_rxbuf, .rxbuf = g_spi2_rxbuf,
.txbuf = g_spi2_txbuf, .txbuf = g_spi2_txbuf,
.buflen = SPI2_DMABUFSIZE_ADJUSTED, .buflen = SPI2_DMABUFSIZE_ADJUSTED,
@ -472,7 +472,7 @@ static struct stm32_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_sp3iops .ops = &g_sp3iops,
}, },
.spibase = STM32_SPI3_BASE, .spibase = STM32_SPI3_BASE,
.spiclock = STM32_PCLK1_FREQUENCY, .spiclock = STM32_PCLK1_FREQUENCY,
@ -483,7 +483,7 @@ static struct stm32_spidev_s g_spi3dev =
# ifdef CONFIG_STM32F7_SPI3_DMA # ifdef CONFIG_STM32F7_SPI3_DMA
.rxch = DMAMAP_SPI3_RX, .rxch = DMAMAP_SPI3_RX,
.txch = DMAMAP_SPI3_TX, .txch = DMAMAP_SPI3_TX,
#if defined(SPI3_DMABUFSIZE_ADJUSTED) # ifdef SPI3_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi3_rxbuf, .rxbuf = g_spi3_rxbuf,
.txbuf = g_spi3_txbuf, .txbuf = g_spi3_txbuf,
.buflen = SPI3_DMABUFSIZE_ADJUSTED, .buflen = SPI3_DMABUFSIZE_ADJUSTED,
@ -543,7 +543,7 @@ static struct stm32_spidev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_sp4iops .ops = &g_sp4iops,
}, },
.spibase = STM32_SPI4_BASE, .spibase = STM32_SPI4_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -554,7 +554,7 @@ static struct stm32_spidev_s g_spi4dev =
# ifdef CONFIG_STM32F7_SPI4_DMA # ifdef CONFIG_STM32F7_SPI4_DMA
.rxch = DMAMAP_SPI4_RX, .rxch = DMAMAP_SPI4_RX,
.txch = DMAMAP_SPI4_TX, .txch = DMAMAP_SPI4_TX,
#if defined(SPI4_DMABUFSIZE_ADJUSTED) # ifdef SPI4_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi4_rxbuf, .rxbuf = g_spi4_rxbuf,
.txbuf = g_spi4_txbuf, .txbuf = g_spi4_txbuf,
.buflen = SPI4_DMABUFSIZE_ADJUSTED, .buflen = SPI4_DMABUFSIZE_ADJUSTED,
@ -614,7 +614,7 @@ static struct stm32_spidev_s g_spi5dev =
{ {
.spidev = .spidev =
{ {
&g_sp5iops .ops = &g_sp5iops,
}, },
.spibase = STM32_SPI5_BASE, .spibase = STM32_SPI5_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -625,7 +625,7 @@ static struct stm32_spidev_s g_spi5dev =
# ifdef CONFIG_STM32F7_SPI5_DMA # ifdef CONFIG_STM32F7_SPI5_DMA
.rxch = DMAMAP_SPI5_RX, .rxch = DMAMAP_SPI5_RX,
.txch = DMAMAP_SPI5_TX, .txch = DMAMAP_SPI5_TX,
#if defined(SPI5_DMABUFSIZE_ADJUSTED) # ifdef SPI5_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi5_rxbuf, .rxbuf = g_spi5_rxbuf,
.txbuf = g_spi5_txbuf, .txbuf = g_spi5_txbuf,
.buflen = SPI5_DMABUFSIZE_ADJUSTED, .buflen = SPI5_DMABUFSIZE_ADJUSTED,
@ -685,7 +685,7 @@ static struct stm32_spidev_s g_spi6dev =
{ {
.spidev = .spidev =
{ {
&g_sp6iops .ops = &g_sp6iops,
}, },
.spibase = STM32_SPI6_BASE, .spibase = STM32_SPI6_BASE,
.spiclock = STM32_PCLK2_FREQUENCY, .spiclock = STM32_PCLK2_FREQUENCY,
@ -696,7 +696,7 @@ static struct stm32_spidev_s g_spi6dev =
# ifdef CONFIG_STM32F7_SPI6_DMA # ifdef CONFIG_STM32F7_SPI6_DMA
.rxch = DMAMAP_SPI6_RX, .rxch = DMAMAP_SPI6_RX,
.txch = DMAMAP_SPI6_TX, .txch = DMAMAP_SPI6_TX,
#if defined(SPI6_DMABUFSIZE_ADJUSTED) # ifdef SPI6_DMABUFSIZE_ADJUSTED
.rxbuf = g_spi6_rxbuf, .rxbuf = g_spi6_rxbuf,
.txbuf = g_spi6_txbuf, .txbuf = g_spi6_txbuf,
.buflen = SPI6_DMABUFSIZE_ADJUSTED, .buflen = SPI6_DMABUFSIZE_ADJUSTED,

View File

@ -2469,11 +2469,18 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
static int stm32_i2c_transfer(struct i2c_master_s *dev, static int stm32_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count) struct i2c_msg_s *msgs, int count)
{ {
struct stm32_i2c_priv_s *priv;
int ret; int ret;
DEBUGASSERT(dev);
/* Get I2C private structure */
priv = ((struct stm32_i2c_inst_s *)dev)->priv;
/* Ensure that address or flags don't change meanwhile */ /* Ensure that address or flags don't change meanwhile */
ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret >= 0) if (ret >= 0)
{ {
ret = stm32_i2c_process(dev, msgs, count); ret = stm32_i2c_process(dev, msgs, count);

View File

@ -2274,7 +2274,7 @@ static int up_dma_setup(struct uart_dev_s *dev)
* worth of time to claim bytes before they are overwritten. * worth of time to claim bytes before they are overwritten.
*/ */
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, true); stm32_dmastart(priv->rxdma, up_dma_rxcallback, priv, true);
} }
#endif #endif
@ -3253,7 +3253,7 @@ static void up_dma_reenable(struct up_dev_s *priv)
* worth of time to claim bytes before they are overwritten. * worth of time to claim bytes before they are overwritten.
*/ */
stm32_dmastart(priv->rxdma, up_dma_rxcallback, (void *)priv, true); stm32_dmastart(priv->rxdma, up_dma_rxcallback, priv, true);
/* Clear DMA suspended flag. */ /* Clear DMA suspended flag. */
@ -3352,7 +3352,7 @@ static void up_dma_txcallback(DMA_HANDLE handle, uint8_t status, void *arg)
/* Start transmission with the callback on DMA completion */ /* Start transmission with the callback on DMA completion */
stm32_dmastart(priv->txdma, up_dma_txcallback, stm32_dmastart(priv->txdma, up_dma_txcallback,
(void *)priv, false); priv, false);
return; return;
} }
@ -3438,7 +3438,7 @@ static void up_dma_send(struct uart_dev_s *dev)
/* Start transmission with the callback on DMA completion */ /* Start transmission with the callback on DMA completion */
stm32_dmastart(priv->txdma, up_dma_txcallback, (void *)priv, false); stm32_dmastart(priv->txdma, up_dma_txcallback, priv, false);
} }
#endif #endif

View File

@ -396,7 +396,7 @@ static struct stm32_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_sp1iops .ops = &g_sp1iops,
}, },
.spibase = STM32_SPI1_BASE, .spibase = STM32_SPI1_BASE,
.spiclock = SPI123_KERNEL_CLOCK_FREQ, .spiclock = SPI123_KERNEL_CLOCK_FREQ,
@ -468,7 +468,7 @@ static struct stm32_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_sp2iops .ops = &g_sp2iops,
}, },
.spibase = STM32_SPI2_BASE, .spibase = STM32_SPI2_BASE,
.spiclock = SPI123_KERNEL_CLOCK_FREQ, .spiclock = SPI123_KERNEL_CLOCK_FREQ,
@ -540,7 +540,7 @@ static struct stm32_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_sp3iops .ops = &g_sp3iops,
}, },
.spibase = STM32_SPI3_BASE, .spibase = STM32_SPI3_BASE,
.spiclock = SPI123_KERNEL_CLOCK_FREQ, .spiclock = SPI123_KERNEL_CLOCK_FREQ,
@ -612,7 +612,7 @@ static struct stm32_spidev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_sp4iops .ops = &g_sp4iops,
}, },
.spibase = STM32_SPI4_BASE, .spibase = STM32_SPI4_BASE,
.spiclock = SPI45_KERNEL_CLOCK_FREQ, .spiclock = SPI45_KERNEL_CLOCK_FREQ,
@ -684,7 +684,7 @@ static struct stm32_spidev_s g_spi5dev =
{ {
.spidev = .spidev =
{ {
&g_sp5iops .ops = &g_sp5iops,
}, },
.spibase = STM32_SPI5_BASE, .spibase = STM32_SPI5_BASE,
.spiclock = SPI45_KERNEL_CLOCK_FREQ, .spiclock = SPI45_KERNEL_CLOCK_FREQ,
@ -757,7 +757,7 @@ static struct stm32_spidev_s g_spi6dev =
{ {
.spidev = .spidev =
{ {
&g_sp6iops .ops = &g_sp6iops,
}, },
.spibase = STM32_SPI6_BASE, .spibase = STM32_SPI6_BASE,
.spiclock = SPI6_KERNEL_CLOCK_FREQ, .spiclock = SPI6_KERNEL_CLOCK_FREQ,

View File

@ -281,7 +281,7 @@ static struct stm32l4_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = STM32L4_SPI1_BASE, .spibase = STM32L4_SPI1_BASE,
.spiclock = STM32L4_PCLK2_FREQUENCY, .spiclock = STM32L4_PCLK2_FREQUENCY,
@ -339,7 +339,7 @@ static struct stm32l4_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = STM32L4_SPI2_BASE, .spibase = STM32L4_SPI2_BASE,
.spiclock = STM32L4_PCLK1_FREQUENCY, .spiclock = STM32L4_PCLK1_FREQUENCY,
@ -395,7 +395,7 @@ static struct stm32l4_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = STM32L4_SPI3_BASE, .spibase = STM32L4_SPI3_BASE,
.spiclock = STM32L4_PCLK1_FREQUENCY, .spiclock = STM32L4_PCLK1_FREQUENCY,

View File

@ -281,7 +281,7 @@ static struct stm32l5_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = STM32L5_SPI1_BASE, .spibase = STM32L5_SPI1_BASE,
.spiclock = STM32L5_PCLK2_FREQUENCY, .spiclock = STM32L5_PCLK2_FREQUENCY,
@ -339,7 +339,7 @@ static struct stm32l5_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = STM32L5_SPI2_BASE, .spibase = STM32L5_SPI2_BASE,
.spiclock = STM32L5_PCLK1_FREQUENCY, .spiclock = STM32L5_PCLK1_FREQUENCY,
@ -395,7 +395,7 @@ static struct stm32l5_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.spibase = STM32L5_SPI3_BASE, .spibase = STM32L5_SPI3_BASE,
.spiclock = STM32L5_PCLK1_FREQUENCY, .spiclock = STM32L5_PCLK1_FREQUENCY,

View File

@ -348,7 +348,7 @@ static struct stm32_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_sp1iops .ops = &g_sp1iops,
}, },
.spibase = STM32_SPI1_BASE, .spibase = STM32_SPI1_BASE,
.spiclock = SPI1_KERNEL_CLOCK_FREQ, .spiclock = SPI1_KERNEL_CLOCK_FREQ,
@ -420,7 +420,7 @@ static struct stm32_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_sp2iops .ops = &g_sp2iops,
}, },
.spibase = STM32_SPI2_BASE, .spibase = STM32_SPI2_BASE,
.spiclock = SPI2_KERNEL_CLOCK_FREQ, .spiclock = SPI2_KERNEL_CLOCK_FREQ,
@ -492,7 +492,7 @@ static struct stm32_spidev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_sp3iops .ops = &g_sp3iops,
}, },
.spibase = STM32_SPI3_BASE, .spibase = STM32_SPI3_BASE,
.spiclock = SPI3_KERNEL_CLOCK_FREQ, .spiclock = SPI3_KERNEL_CLOCK_FREQ,

View File

@ -277,7 +277,7 @@ static struct stm32wb_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.spibase = STM32WB_SPI1_BASE, .spibase = STM32WB_SPI1_BASE,
.spiclock = STM32WB_PCLK2_FREQUENCY, .spiclock = STM32WB_PCLK2_FREQUENCY,
@ -335,7 +335,7 @@ static struct stm32wb_spidev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.spibase = STM32WB_SPI2_BASE, .spibase = STM32WB_SPI2_BASE,
.spiclock = STM32WB_PCLK1_FREQUENCY, .spiclock = STM32WB_PCLK1_FREQUENCY,

View File

@ -312,7 +312,7 @@ static struct stm32wl5_spidev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_sp1iops .ops = &g_sp1iops,
}, },
.spibase = STM32WL5_SPI1_BASE, .spibase = STM32WL5_SPI1_BASE,
.spiclock = STM32WL5_PCLK2_FREQUENCY, .spiclock = STM32WL5_PCLK2_FREQUENCY,

View File

@ -106,7 +106,7 @@ static struct avr_spidev_s g_spidev =
{ {
.spidev = .spidev =
{ {
&g_spiops .ops = &g_spiops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
}; };

View File

@ -138,7 +138,7 @@ static struct pic32mx_dev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.base = PIC32MX_SPI1_K1BASE, .base = PIC32MX_SPI1_K1BASE,
#ifdef CONFIG_PIC32MX_SPI_INTERRUPTS #ifdef CONFIG_PIC32MX_SPI_INTERRUPTS
@ -177,7 +177,7 @@ static struct pic32mx_dev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.base = PIC32MX_SPI2_K1BASE, .base = PIC32MX_SPI2_K1BASE,
#ifdef CONFIG_PIC32MX_SPI_INTERRUPTS #ifdef CONFIG_PIC32MX_SPI_INTERRUPTS
@ -216,7 +216,7 @@ static struct pic32mx_dev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.base = PIC32MX_SPI3_K1BASE, .base = PIC32MX_SPI3_K1BASE,
#ifdef CONFIG_PIC32MX_SPI_INTERRUPTS #ifdef CONFIG_PIC32MX_SPI_INTERRUPTS
@ -255,7 +255,7 @@ static struct pic32mx_dev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_spi4ops .ops = &g_spi4ops,
}, },
.base = PIC32MX_SPI4_K1BASE, .base = PIC32MX_SPI4_K1BASE,
#ifdef CONFIG_PIC32MX_SPI_INTERRUPTS #ifdef CONFIG_PIC32MX_SPI_INTERRUPTS

View File

@ -281,7 +281,7 @@ static struct pic32mz_dev_s g_spi1dev =
{ {
.spidev = .spidev =
{ {
&g_spi1ops .ops = &g_spi1ops,
}, },
.config = &g_spi1config, .config = &g_spi1config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -334,7 +334,7 @@ static struct pic32mz_dev_s g_spi2dev =
{ {
.spidev = .spidev =
{ {
&g_spi2ops .ops = &g_spi2ops,
}, },
.config = &g_spi2config, .config = &g_spi2config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -387,7 +387,7 @@ static struct pic32mz_dev_s g_spi3dev =
{ {
.spidev = .spidev =
{ {
&g_spi3ops .ops = &g_spi3ops,
}, },
.config = &g_spi3config, .config = &g_spi3config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -440,7 +440,7 @@ static struct pic32mz_dev_s g_spi4dev =
{ {
.spidev = .spidev =
{ {
&g_spi4ops .ops = &g_spi4ops,
}, },
.config = &g_spi4config, .config = &g_spi4config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -493,7 +493,7 @@ static struct pic32mz_dev_s g_spi5dev =
{ {
.spidev = .spidev =
{ {
&g_spi5ops .ops = &g_spi5ops,
}, },
.config = &g_spi5config, .config = &g_spi5config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -546,7 +546,7 @@ static struct pic32mz_dev_s g_spi6dev =
{ {
.spidev = .spidev =
{ {
&g_spi6ops .ops = &g_spi6ops,
}, },
.config = &g_spi6config, .config = &g_spi6config,
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
@ -1752,7 +1752,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
priv->result = -EBUSY; priv->result = -EBUSY;
ret = pic32mz_dma_start(priv->rxdma, spi_dmarxcallback, (void *)priv); ret = pic32mz_dma_start(priv->rxdma, spi_dmarxcallback, priv);
if (ret < 0) if (ret < 0)
{ {
spierr("ERROR: RX DMA start failed: %d\n", ret); spierr("ERROR: RX DMA start failed: %d\n", ret);
@ -1761,7 +1761,7 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
spi_rxdma_sample(priv, DMA_AFTER_START); spi_rxdma_sample(priv, DMA_AFTER_START);
ret = pic32mz_dma_start(priv->txdma, spi_dmatxcallback, (void *)priv); ret = pic32mz_dma_start(priv->txdma, spi_dmatxcallback, priv);
if (ret < 0) if (ret < 0)
{ {
spierr("ERROR: TX DMA start failed: %d\n", ret); spierr("ERROR: TX DMA start failed: %d\n", ret);

View File

@ -296,7 +296,7 @@ static struct rx65n_rspidev_s g_rspi0dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi0ops .ops = &g_rspi0ops,
}, },
.rspibase = RX65N_RSPI0_BASE, .rspibase = RX65N_RSPI0_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,
@ -362,7 +362,7 @@ static struct rx65n_rspidev_s g_rspi1dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi1ops .ops = &g_rspi1ops,
}, },
.rspibase = RX65N_RSPI1_BASE, .rspibase = RX65N_RSPI1_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,
@ -428,7 +428,7 @@ static struct rx65n_rspidev_s g_rspi2dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi2ops .ops = &g_rspi2ops,
}, },
.rspibase = RX65N_RSPI2_BASE, .rspibase = RX65N_RSPI2_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,
@ -1018,8 +1018,8 @@ 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(FAR struct rx65n_rspidev_s *priv,
FAR const void *txbuffer, FAR const void *txdummy, FAR const void *txbuffer,
size_t nwords) FAR 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;

View File

@ -279,7 +279,7 @@ static struct rx65n_rspidev_s g_rspi0dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi0ops .ops = &g_rspi0ops,
}, },
.rspibase = RX65N_RSPI0_BASE, .rspibase = RX65N_RSPI0_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,
@ -333,7 +333,7 @@ static struct rx65n_rspidev_s g_rspi1dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi1ops .ops = &g_rspi1ops,
}, },
.rspibase = RX65N_RSPI1_BASE, .rspibase = RX65N_RSPI1_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,
@ -387,7 +387,7 @@ static struct rx65n_rspidev_s g_rspi2dev =
{ {
.rspidev = .rspidev =
{ {
&g_rspi2ops .ops = &g_rspi2ops,
}, },
.rspibase = RX65N_RSPI2_BASE, .rspibase = RX65N_RSPI2_BASE,
.rspiclock = RX65N_PCLK_FREQUENCY, .rspiclock = RX65N_PCLK_FREQUENCY,

View File

@ -970,7 +970,7 @@ void hw_usb_hmodule_init (void)
uint16_t hw_usb_read_syscfg(void) uint16_t hw_usb_read_syscfg(void)
{ {
return (rx65n_usbhost_getreg(RX65N_USB_SYSCFG)); return rx65n_usbhost_getreg(RX65N_USB_SYSCFG);
} }
/**************************************************************************** /****************************************************************************
@ -1007,7 +1007,7 @@ void hw_usb_clear_usbe (void)
static uint16_t hw_usb_read_syssts(void) static uint16_t hw_usb_read_syssts(void)
{ {
return (rx65n_usbhost_getreg(RX65N_USB_SYSSTS0)); return rx65n_usbhost_getreg(RX65N_USB_SYSSTS0);
} }
/**************************************************************************** /****************************************************************************
@ -1019,7 +1019,7 @@ static uint16_t hw_usb_read_syssts (void)
static uint16_t hw_usb_read_dvstctr(void) static uint16_t hw_usb_read_dvstctr(void)
{ {
return (rx65n_usbhost_getreg(RX65N_USB_DVSTCTR0)); return rx65n_usbhost_getreg(RX65N_USB_DVSTCTR0);
} }
/**************************************************************************** /****************************************************************************
@ -1694,7 +1694,7 @@ static uint16_t hw_usb_read_pipectr (uint16_t pipeno)
p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR + (pipeno - 1)); p_reg = (uint16_t *)(RX65N_USB_PIPE1CTR + (pipeno - 1));
} }
return (rx65n_usbhost_getreg (p_reg)); return rx65n_usbhost_getreg(p_reg);
} }
/**************************************************************************** /****************************************************************************
@ -2123,8 +2123,8 @@ uint16_t usb_hstd_write_data_control_pipe (uint8_t * buf_add,
uint16_t end_flag; uint16_t end_flag;
buffer = usb_cstd_is_set_frdy(USB_PIPE0, buffer = usb_cstd_is_set_frdy(USB_PIPE0,
(uint16_t) RX65N_USB_USING_CFIFO, RX65N_USB_USING_CFIFO,
(uint16_t) RX65N_USB_CFIFOSEL_ISEL); RX65N_USB_CFIFOSEL_ISEL);
/* Check error */ /* Check error */
@ -2132,7 +2132,7 @@ uint16_t usb_hstd_write_data_control_pipe (uint8_t * buf_add,
{ {
/* FIFO access error */ /* FIFO access error */
return (USB_FIFOERROR); return USB_FIFOERROR;
} }
/* Data buffer size */ /* Data buffer size */
@ -2225,7 +2225,7 @@ uint16_t pipe, uint16_t pipemode)
/* Changes FIFO port by the pipe. */ /* Changes FIFO port by the pipe. */
buffer = usb_cstd_is_set_frdy(pipe, (uint16_t) pipemode, USB_FALSE); buffer = usb_cstd_is_set_frdy(pipe, pipemode, USB_FALSE);
/* Check error */ /* Check error */
@ -2233,7 +2233,7 @@ uint16_t pipe, uint16_t pipemode)
{ {
/* FIFO access error */ /* FIFO access error */
return (USB_FIFOERROR); return USB_FIFOERROR;
} }
/* Data buffer size */ /* Data buffer size */
@ -2329,7 +2329,7 @@ void usb_hstd_receive_start (uint8_t *buffer, size_t buflen, uint8_t pipe)
/* Ignore count clear */ /* Ignore count clear */
hw_usb_clear_status_bemp((uint16_t) pipe); /* BEMP Status Clear */ hw_usb_clear_status_bemp(pipe); /* BEMP Status Clear */
hw_usb_clear_sts_brdy(pipe); /* BRDY Status Clear */ hw_usb_clear_sts_brdy(pipe); /* BRDY Status Clear */
hw_usb_clear_status_nrdy(pipe); /* NRDY Status Clear */ hw_usb_clear_status_nrdy(pipe); /* NRDY Status Clear */
nrdy_retries[pipe] = 0; /* Initialize theh NRDY retries to 0 */ nrdy_retries[pipe] = 0; /* Initialize theh NRDY retries to 0 */
@ -2342,22 +2342,21 @@ void usb_hstd_receive_start (uint8_t *buffer, size_t buflen, uint8_t pipe)
length = buflen; length = buflen;
if ((uint32_t) 0u != length) if (0u != length)
{ {
/* Data length check */ /* Data length check */
if ((uint32_t) 0u == (length % mxps)) if ((0u == (length % mxps))
{ {
/* Set Transaction counter */ /* Set Transaction counter */
usb_cstd_set_transaction_counter(pipe, (uint16_t) (length / mxps)); usb_cstd_set_transaction_counter(pipe, length / mxps);
} }
else else
{ {
/* Set Transaction counter */ /* Set Transaction counter */
usb_cstd_set_transaction_counter(pipe, (uint16_t) ((length / mxps) usb_cstd_set_transaction_counter(pipe, length / mxps + 1u));
+ (uint32_t) 1u));
} }
} }
@ -2488,17 +2487,17 @@ uint16_t usb_hstd_read_data_control_pipe (void)
/* Changes FIFO port by the pipe. */ /* Changes FIFO port by the pipe. */
buffer = usb_cstd_is_set_frdy(USB_PIPE0, (uint16_t) USB_CUSE, USB_FALSE); buffer = usb_cstd_is_set_frdy(USB_PIPE0, USB_CUSE, USB_FALSE);
if (USB_FIFOERROR == buffer) if (USB_FIFOERROR == buffer)
{ {
/* FIFO access error */ /* FIFO access error */
return (USB_FIFOERROR); return USB_FIFOERROR;
syslog(LOG_INFO, "FIFO ERROR"); syslog(LOG_INFO, "FIFO ERROR");
} }
dtln = (uint16_t) (buffer & RX65N_USB_FIFOCTR_DTLN); dtln = buffer & RX65N_USB_FIFOCTR_DTLN;
/* Max Packet Size */ /* Max Packet Size */
@ -2559,7 +2558,7 @@ uint16_t usb_hstd_read_data_control_pipe (void)
g_rx65n_tdlist[USB_PIPE0].ed->xfrinfo->xfrd += count; g_rx65n_tdlist[USB_PIPE0].ed->xfrinfo->xfrd += count;
return (end_flag); return end_flag;
} }
/**************************************************************************** /****************************************************************************
@ -2586,14 +2585,14 @@ uint16_t usb_hstd_read_data (uint16_t pipe, uint16_t pipemode)
if (pipe != 0) /* Data transfer for non CTRL pipe */ if (pipe != 0) /* Data transfer for non CTRL pipe */
{ {
buffer = usb_cstd_is_set_frdy(pipe, (uint16_t) pipemode, USB_FALSE); buffer = usb_cstd_is_set_frdy(pipe, pipemode, USB_FALSE);
if (USB_FIFOERROR == buffer) if (USB_FIFOERROR == buffer)
{ {
return (USB_FIFOERROR); return USB_FIFOERROR;
} }
dtln = (uint16_t) (buffer & RX65N_USB_FIFOCTR_DTLN); dtln = buffer & RX65N_USB_FIFOCTR_DTLN;
mxps = usb_cstd_get_maxpacket_size(pipe); mxps = usb_cstd_get_maxpacket_size(pipe);
/* now calculate the count */ /* now calculate the count */
@ -2656,7 +2655,7 @@ uint16_t usb_hstd_read_data (uint16_t pipe, uint16_t pipemode)
} }
} }
return (end_flag); return end_flag;
} }
/**************************************************************************** /****************************************************************************
@ -2766,11 +2765,11 @@ void usb_hstd_buf_to_fifo (uint8_t *buffer, size_t buflen, uint16_t pipe,
/* FIFO access error */ /* FIFO access error */
syslog(LOG_INFO, "### FIFO access error\n"); syslog(LOG_INFO, "### FIFO access error\n");
usb_hstd_forced_termination(pipe, (uint16_t) USB_DATA_ERR); usb_hstd_forced_termination(pipe, USB_DATA_ERR);
break; break;
default: default:
usb_hstd_forced_termination(pipe, (uint16_t) USB_DATA_ERR); usb_hstd_forced_termination(pipe, USB_DATA_ERR);
break; break;
} }
} }
@ -2817,8 +2816,7 @@ void usb_hstd_brdy_pipe_process (uint16_t bitsts)
RX65N_USB_DCPCTR_PIDSTALL)) RX65N_USB_DCPCTR_PIDSTALL))
{ {
syslog(LOG_INFO, "### STALL Pipe %d\n", i); syslog(LOG_INFO, "### STALL Pipe %d\n", i);
usb_hstd_forced_termination(i, usb_hstd_forced_termination(i, USB_DATA_STALL);
(uint16_t) USB_DATA_STALL);
} }
else else
{ {
@ -2862,7 +2860,7 @@ void usb_hstd_brdy_pipe_process (uint16_t bitsts)
else else
{ {
usb_hstd_data_end(i, (uint16_t) USB_DATA_OK); usb_hstd_data_end(i, USB_DATA_OK);
g_rx65n_edlist[i].xfrinfo->tdstatus = g_rx65n_edlist[i].xfrinfo->tdstatus =
TD_CC_NOERROR; TD_CC_NOERROR;
@ -2870,8 +2868,7 @@ void usb_hstd_brdy_pipe_process (uint16_t bitsts)
if ((g_rx65n_edlist[i].xfrinfo != 0) if ((g_rx65n_edlist[i].xfrinfo != 0)
&& (g_rx65n_edlist[i].xfrinfo->callback)) && (g_rx65n_edlist[i].xfrinfo->callback))
{ {
hw_usb_write_dcpmxps((uint16_t) (USB_DEFPACKET hw_usb_write_dcpmxps(USB_DEFPACKET + USB_DEVICE_1);
+ USB_DEVICE_1));
rx65n_usbhost_asynch_completion(priv, rx65n_usbhost_asynch_completion(priv,
&g_rx65n_edlist[i]); &g_rx65n_edlist[i]);
} }
@ -2950,13 +2947,13 @@ void usb_hstd_bemp_pipe_process (uint16_t bitsts)
RX65N_USB_DCPCTR_PIDSTALL)) RX65N_USB_DCPCTR_PIDSTALL))
{ {
syslog(LOG_INFO, "### STALL Pipe %d\n", i); syslog(LOG_INFO, "### STALL Pipe %d\n", i);
usb_hstd_forced_termination(i, (uint16_t) USB_DATA_STALL); usb_hstd_forced_termination(i, USB_DATA_STALL);
} }
else else
{ {
if (data_len == 0) if (data_len == 0)
{ {
usb_hstd_data_end(i, (uint16_t) USB_DATA_OK); usb_hstd_data_end(i, USB_DATA_OK);
g_rx65n_edlist[i].xfrinfo->tdstatus = TD_CC_NOERROR; g_rx65n_edlist[i].xfrinfo->tdstatus = TD_CC_NOERROR;
/* Release the semaphore for this pipe */ /* Release the semaphore for this pipe */
@ -2966,8 +2963,9 @@ void usb_hstd_bemp_pipe_process (uint16_t bitsts)
else else
{ {
syslog (LOG_INFO, "BEMP can NOT be with %d len data \ syslog(LOG_INFO,
for pipe\n", data_len, i); "BEMP can NOT be with %d len data for pipe\n",
data_len, i);
} }
} }
} }
@ -3005,14 +3003,14 @@ uint16_t usb_hstd_get_pipe_peri_value (uint8_t binterval)
work2 = 0; work2 = 0;
for (; work1 != 0; work2++ ) for (; work1 != 0; work2++ )
{ {
work1 = (uint16_t)(work1 >> 1); work1 >>= 1;
} }
if (0 != work2) if (0 != work2)
{ {
/* Interval time */ /* Interval time */
pipe_peri |= (uint16_t)(work2 - 1); pipe_peri |= (work2 - 1);
} }
} }
@ -3034,7 +3032,7 @@ uint16_t usb_hstd_chk_attach (void)
uint16_t buf[3]; uint16_t buf[3];
usb_hstd_read_lnst(buf); usb_hstd_read_lnst(buf);
if (0 == (uint16_t) (buf[1] & RX65N_USB_DVSTCTR0_RHST)) if (0 == (buf[1] & RX65N_USB_DVSTCTR0_RHST))
{ {
if (RX65N_USB_SYSSTS0_LNST_FS_JSTS == (buf[0] & 3)) if (RX65N_USB_SYSSTS0_LNST_FS_JSTS == (buf[0] & 3))
{ {
@ -3117,7 +3115,7 @@ uint16_t usb_hstd_detach_process (void)
{ {
/* End of data transfer (IN/OUT) */ /* End of data transfer (IN/OUT) */
usb_hstd_forced_termination(USB_PIPE0, (uint16_t) USB_DATA_STOP); usb_hstd_forced_termination(USB_PIPE0, USB_DATA_STOP);
} }
usb_cstd_clr_pipe_cnfg(USB_PIPE0); usb_cstd_clr_pipe_cnfg(USB_PIPE0);
@ -3138,7 +3136,7 @@ uint16_t usb_hstd_detach_process (void)
{ {
/* End of data transfer (IN/OUT) */ /* End of data transfer (IN/OUT) */
usb_hstd_forced_termination(i, (uint16_t) USB_DATA_STOP); usb_hstd_forced_termination(i, USB_DATA_STOP);
} }
usb_cstd_clr_pipe_cnfg(i); usb_cstd_clr_pipe_cnfg(i);
@ -3166,7 +3164,7 @@ uint16_t usb_hstd_detach_process (void)
/* Check clock */ /* Check clock */
usb_hstd_chk_clk((uint16_t) USB_DETACH); usb_hstd_chk_clk(USB_DETACH);
break; break;
default: default:
@ -3177,7 +3175,7 @@ uint16_t usb_hstd_detach_process (void)
/* Check clock */ /* Check clock */
usb_hstd_chk_clk((uint16_t) USB_DETACH); usb_hstd_chk_clk(USB_DETACH);
break; break;
} }
@ -3293,11 +3291,11 @@ uint16_t usb_hstd_attach_process (void)
/* Check clock */ /* Check clock */
usb_hstd_chk_clk((uint16_t) USB_DETACH); usb_hstd_chk_clk(USB_DETACH);
break; break;
default: default:
usb_hstd_attach((uint16_t) USB_ATTACHF); usb_hstd_attach(USB_ATTACHF);
break; break;
} }
@ -3335,7 +3333,7 @@ void usb_hstd_bus_reset (void)
/* Wait 50ms */ /* Wait 50ms */
up_mdelay(50); /* usb_cpu_delay_xms((uint16_t) 50); */ up_mdelay(50); /* usb_cpu_delay_xms(50); */
/* USBRST=0, RESUME=0, UACT=1 */ /* USBRST=0, RESUME=0, UACT=1 */
@ -3343,7 +3341,7 @@ void usb_hstd_bus_reset (void)
/* Wait 10ms or more (USB reset recovery) */ /* Wait 10ms or more (USB reset recovery) */
up_mdelay(20); /* usb_cpu_delay_xms((uint16_t) 20); */ up_mdelay(20); /* usb_cpu_delay_xms(20); */
/* WAIT_LOOP */ /* WAIT_LOOP */
@ -3355,8 +3353,7 @@ void usb_hstd_bus_reset (void)
{ {
/* DeviceStateControlRegister - ResetHandshakeStatusCheck */ /* DeviceStateControlRegister - ResetHandshakeStatusCheck */
buf = hw_usb_read_dvstctr(); buf = hw_usb_read_dvstctr() & RX65N_USB_DVSTCTR0_RHST;
buf = (uint16_t) (buf & RX65N_USB_DVSTCTR0_RHST);
if (0x04 == buf) if (0x04 == buf)
{ {
/* Wait */ /* Wait */
@ -3386,7 +3383,7 @@ uint8_t *usb_hstd_write_fifo (uint16_t count, uint16_t pipemode,
{ {
/* WAIT_LOOP */ /* WAIT_LOOP */
for (even = (uint16_t) (count >> 1); (0 != even); --even) for (even = count >> 1; 0 != even; --even)
{ {
/* 16bit access */ /* 16bit access */
@ -3397,7 +3394,7 @@ uint8_t *usb_hstd_write_fifo (uint16_t count, uint16_t pipemode,
write_p += sizeof(uint16_t); write_p += sizeof(uint16_t);
} }
if ((count & (uint16_t) 0x0001u) != 0u) if ((count & 0x0001u) != 0u)
{ {
/* count == odd */ /* count == odd */
@ -3441,7 +3438,7 @@ uint8_t *usb_hstd_read_fifo (uint16_t count, uint16_t pipemode,
/* WAIT_LOOP */ /* WAIT_LOOP */
for (even = (uint16_t) (count >> 1); (0 != even); --even) for (even = count >> 1; 0 != even; --even)
{ {
/* 16bit FIFO access */ /* 16bit FIFO access */
@ -3452,7 +3449,7 @@ uint8_t *usb_hstd_read_fifo (uint16_t count, uint16_t pipemode,
read_p += sizeof(uint16_t); read_p += sizeof(uint16_t);
} }
if ((count & (uint16_t) 0x0001) != 0) if ((count & 0x0001) != 0)
{ {
/* 16bit FIFO access */ /* 16bit FIFO access */
@ -3511,8 +3508,7 @@ void usb_hstd_forced_termination (uint16_t pipe, uint16_t status)
{ {
/* Changes the FIFO port by the pipe. */ /* Changes the FIFO port by the pipe. */
usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, usb_cstd_chg_curpipe(USB_PIPE0, USB_CUSE, USB_FALSE);
(uint16_t) USB_CUSE, USB_FALSE);
} }
#ifdef DMA_DTC_NOT_ENABLED #ifdef DMA_DTC_NOT_ENABLED
@ -3525,8 +3521,7 @@ void usb_hstd_forced_termination (uint16_t pipe, uint16_t status)
{ {
/* Changes the FIFO port by the pipe. */ /* Changes the FIFO port by the pipe. */
usb_cstd_chg_curpipe(ptr, (uint16_t) USB_PIPE0, usb_cstd_chg_curpipe(ptr, USB_PIPE0, USB_D0USE, USB_FALSE);
(uint16_t) USB_D0USE, USB_FALSE);
} }
/* Clear D1FIFO-port */ /* Clear D1FIFO-port */
@ -3536,8 +3531,7 @@ void usb_hstd_forced_termination (uint16_t pipe, uint16_t status)
{ {
/* Changes the FIFO port by the pipe. */ /* Changes the FIFO port by the pipe. */
usb_cstd_chg_curpipe(ptr, (uint16_t) USB_PIPE0, usb_cstd_chg_curpipe(ptr, USB_PIPE0, USB_D1USE, USB_FALSE);
(uint16_t) USB_D1USE, USB_FALSE);
} }
#endif /* ((USB_CFG_DTC==USB_CFG_ENABLE)||(USB_CFG_DMA==USB_CFG_ENABLE)) */ #endif /* ((USB_CFG_DTC==USB_CFG_ENABLE)||(USB_CFG_DMA==USB_CFG_ENABLE)) */
@ -3603,7 +3597,7 @@ void usb_hstd_nrdy_endprocess (uint16_t pipe)
/* PIPEx Data Retry */ /* PIPEx Data Retry */
usb_hstd_data_end(pipe, (uint16_t) USB_DATA_TMO); usb_hstd_data_end(pipe, USB_DATA_TMO);
hw_usb_set_bclr(USB_CUSE); /* Clear Buffer on CPU side */ hw_usb_set_bclr(USB_CUSE); /* Clear Buffer on CPU side */
g_rx65n_edlist[pipe].xfrinfo->tdstatus = TD_CC_DEVNOTRESPONDING; g_rx65n_edlist[pipe].xfrinfo->tdstatus = TD_CC_DEVNOTRESPONDING;
@ -3674,10 +3668,10 @@ void usb_hstd_detach (void)
{ {
/* DVSTCTR clear */ /* DVSTCTR clear */
hw_usb_clear_dvstctr((uint16_t) (RX65N_USB_DVSTCTR0_RWUPE | hw_usb_clear_dvstctr(RX65N_USB_DVSTCTR0_RWUPE |
RX65N_USB_DVSTCTR0_USBRST | RX65N_USB_DVSTCTR0_USBRST |
RX65N_USB_DVSTCTR0_RESUME | RX65N_USB_DVSTCTR0_RESUME |
RX65N_USB_DVSTCTR0_UACT)); RX65N_USB_DVSTCTR0_UACT);
/* ATTCH interrupt enable */ /* ATTCH interrupt enable */
@ -3705,7 +3699,7 @@ static uint16_t usb_cstd_get_buf_size (uint16_t pipe)
/* Max Packet Size */ /* Max Packet Size */
size = (uint16_t) (buffer & RX65N_USB_DCPMAXP_MXPS_MASK); size = buffer & RX65N_USB_DCPMAXP_MXPS_MASK;
} }
else else
{ {
@ -3719,7 +3713,7 @@ static uint16_t usb_cstd_get_buf_size (uint16_t pipe)
/* Max Packet Size */ /* Max Packet Size */
size = (uint16_t) (buffer & RX65N_USB_PIPEMAXP_MXPSMASK); size = buffer & RX65N_USB_PIPEMAXP_MXPSMASK;
} }
return size; return size;
@ -3821,8 +3815,7 @@ static void usb_cstd_clr_pipe_cnfg (uint16_t pipe_no)
/* PIPE Configuration */ /* PIPE Configuration */
usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, usb_cstd_chg_curpipe(USB_PIPE0, USB_CUSE, USB_FALSE);
(uint16_t) USB_CUSE, USB_FALSE);
hw_usb_write_pipesel(pipe_no); hw_usb_write_pipesel(pipe_no);
hw_usb_write_pipecfg(0); hw_usb_write_pipecfg(0);
@ -3887,7 +3880,7 @@ static void usb_cstd_set_nak (uint16_t pipe)
/* PIPE control reg read */ /* PIPE control reg read */
buf = hw_usb_read_pipectr(pipe); buf = hw_usb_read_pipectr(pipe);
if (0 == (uint16_t) (buf & RX65N_USB_DCPCTR_PID_MASK)) if (0 == (buf & RX65N_USB_DCPCTR_PID_MASK))
{ {
n = 0xfffeu; n = 0xfffeu;
} }
@ -3919,10 +3912,10 @@ static uint16_t usb_cstd_is_set_frdy (uint16_t pipe, uint16_t fifosel,
{ {
buffer = hw_usb_read_fifoctr(fifosel); buffer = hw_usb_read_fifoctr(fifosel);
if (RX65N_USB_FIFOCTR_FRDY == (uint16_t) (buffer & if (RX65N_USB_FIFOCTR_FRDY == (buffer &
RX65N_USB_FIFOCTR_FRDY)) RX65N_USB_FIFOCTR_FRDY))
{ {
return (buffer); return buffer;
} }
buffer = hw_usb_read_syscfg(); buffer = hw_usb_read_syscfg();
@ -3930,7 +3923,7 @@ static uint16_t usb_cstd_is_set_frdy (uint16_t pipe, uint16_t fifosel,
nxsig_usleep(1); nxsig_usleep(1);
} }
return (RX65N_USB_FIFO_ERROR); return RX65N_USB_FIFO_ERROR;
} }
/**************************************************************************** /****************************************************************************
@ -3967,8 +3960,7 @@ void usb_cstd_chg_curpipe (uint16_t pipe, uint16_t fifosel, uint16_t isel)
buffer = hw_usb_read_fifosel(USB_CUSE); buffer = hw_usb_read_fifosel(USB_CUSE);
} }
while ((buffer & (uint16_t) (USB_ISEL | USB_CURPIPE)) != while ((buffer & (USB_ISEL | USB_CURPIPE)) != (isel | pipe));
(uint16_t) (isel | pipe));
break; break;
#ifdef DTC_DMA_ENABLED #ifdef DTC_DMA_ENABLED
@ -3992,7 +3984,7 @@ void usb_cstd_chg_curpipe (uint16_t pipe, uint16_t fifosel, uint16_t isel)
{ {
buffer = hw_usb_read_fifosel(fifosel); buffer = hw_usb_read_fifosel(fifosel);
} }
while ((uint16_t)(buffer & USB_CURPIPE) != pipe); while ((buffer & USB_CURPIPE) != pipe);
break; break;
#endif /* ((USB_CFG_DTC==USB_CFG_ENABLE||(USB_CFG_DMA==USB_CFG_ENABLE))*/ #endif /* ((USB_CFG_DTC==USB_CFG_ENABLE||(USB_CFG_DMA==USB_CFG_ENABLE))*/
@ -4070,7 +4062,7 @@ static uint16_t usb_cstd_get_pid (uint16_t pipe)
/* PIPE control reg read */ /* PIPE control reg read */
buf = hw_usb_read_pipectr(pipe); buf = hw_usb_read_pipectr(pipe);
return (uint16_t) (buf & RX65N_USB_DCPCTR_PID_MASK); return buf & RX65N_USB_DCPCTR_PID_MASK;
} }
/**************************************************************************** /****************************************************************************
@ -4104,7 +4096,7 @@ static uint16_t usb_cstd_get_maxpacket_size (uint16_t pipe)
/* Max Packet Size */ /* Max Packet Size */
size = (uint16_t) (buffer & RX65N_USB_DCPMAXP_MXPS_MASK); size = (buffer & RX65N_USB_DCPMAXP_MXPS_MASK);
return size; return size;
} }
@ -4132,7 +4124,7 @@ static uint16_t usb_cstd_get_pipe_dir (uint16_t pipe)
/* Read Pipe direction */ /* Read Pipe direction */
buffer = hw_usb_read_pipecfg(); buffer = hw_usb_read_pipecfg();
return (uint16_t) (buffer & RX65N_USB_PIPECFG_DIR); return buffer & RX65N_USB_PIPECFG_DIR;
} }
/**************************************************************************** /****************************************************************************
@ -4216,7 +4208,7 @@ uint16_t usb_hstd_ctrl_write_start (uint8_t * buf_add, size_t buf_size)
/* PID=NAK & clear STALL */ /* PID=NAK & clear STALL */
usb_cstd_clr_stall((uint16_t) USB_PIPE0); usb_cstd_clr_stall(USB_PIPE0);
/* DCP Configuration Register (0x5c) */ /* DCP Configuration Register (0x5c) */
@ -4238,15 +4230,15 @@ uint16_t usb_hstd_ctrl_write_start (uint8_t * buf_add, size_t buf_size)
/* Enable Empty Interrupt */ /* Enable Empty Interrupt */
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
/* Set BUF */ /* Set BUF */
usb_cstd_set_buf((uint16_t) USB_PIPE0); usb_cstd_set_buf(USB_PIPE0);
break; break;
/* End of data write (not null) */ /* End of data write (not null) */
@ -4261,15 +4253,15 @@ uint16_t usb_hstd_ctrl_write_start (uint8_t * buf_add, size_t buf_size)
/* Enable Empty Interrupt */ /* Enable Empty Interrupt */
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
/* Set BUF */ /* Set BUF */
usb_cstd_set_buf((uint16_t) USB_PIPE0); usb_cstd_set_buf(USB_PIPE0);
break; break;
/* FIFO access error */ /* FIFO access error */
@ -4283,7 +4275,7 @@ uint16_t usb_hstd_ctrl_write_start (uint8_t * buf_add, size_t buf_size)
/* End or Err or Continue */ /* End or Err or Continue */
return (end_flag); return end_flag;
} }
/**************************************************************************** /****************************************************************************
@ -4297,7 +4289,7 @@ void usb_hstd_ctrl_read_start (void)
{ {
/* PID=NAK & clear STALL */ /* PID=NAK & clear STALL */
usb_cstd_clr_stall((uint16_t) USB_PIPE0); usb_cstd_clr_stall(USB_PIPE0);
/* DCP Configuration Register (0x5c) */ /* DCP Configuration Register (0x5c) */
@ -4311,12 +4303,12 @@ void usb_hstd_ctrl_read_start (void)
/* Enable Ready Interrupt */ /* Enable Ready Interrupt */
hw_usb_set_brdyenb((uint16_t) USB_PIPE0); hw_usb_set_brdyenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
usb_cstd_set_buf((uint16_t) USB_PIPE0); /* Set BUF */ usb_cstd_set_buf(USB_PIPE0); /* Set BUF */
} }
/**************************************************************************** /****************************************************************************
@ -4334,7 +4326,7 @@ void usb_host_read_pipe_start (uint16_t pipe)
/* PID=NAK & clear STALL */ /* PID=NAK & clear STALL */
usb_cstd_clr_stall((uint16_t) pipe); usb_cstd_clr_stall(pipe);
config_reg = hw_usb_read_pipecfg(); config_reg = hw_usb_read_pipecfg();
@ -4357,15 +4349,15 @@ void usb_host_read_pipe_start (uint16_t pipe)
/* Enable Ready Interrupt */ /* Enable Ready Interrupt */
hw_usb_set_brdyenb((uint16_t) pipe); hw_usb_set_brdyenb(pipe);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) pipe); usb_cstd_nrdy_enable(pipe);
/* Set BUF */ /* Set BUF */
usb_cstd_set_buf((uint16_t) pipe); usb_cstd_set_buf(pipe);
} }
/**************************************************************************** /****************************************************************************
@ -4380,11 +4372,11 @@ void usb_hstd_status_start (void)
/* BEMP0 Disable */ /* BEMP0 Disable */
hw_usb_clear_bempenb((uint16_t) USB_PIPE0); hw_usb_clear_bempenb(USB_PIPE0);
/* BRDY0 Disable */ /* BRDY0 Disable */
hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); hw_usb_clear_brdyenb(USB_PIPE0);
} }
/**************************************************************************** /****************************************************************************
@ -4399,24 +4391,22 @@ void usb_hstd_ctrl_end (uint16_t status)
{ {
/* Interrupt Disable */ /* Interrupt Disable */
hw_usb_clear_bempenb((uint16_t) USB_PIPE0); /* BEMP0 Disable */ hw_usb_clear_bempenb(USB_PIPE0); /* BEMP0 Disable */
hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); /* BRDY0 Disable */ hw_usb_clear_brdyenb(USB_PIPE0); /* BRDY0 Disable */
hw_usb_clear_nrdyenb((uint16_t) USB_PIPE0); /* NRDY0 Disable */ hw_usb_clear_nrdyenb(USB_PIPE0); /* NRDY0 Disable */
usb_cstd_clr_stall((uint16_t) USB_PIPE0); /* PID=NAK & clear STALL */ usb_cstd_clr_stall(USB_PIPE0); /* PID=NAK & clear STALL */
hw_usb_set_mbw(USB_CUSE, USB0_CFIFO_MBW); hw_usb_set_mbw(USB_CUSE, USB0_CFIFO_MBW);
/* SUREQ=1, SQCLR=1, PID=NAK */ /* SUREQ=1, SQCLR=1, PID=NAK */
hw_usb_hwrite_dcpctr((uint16_t) (USB_SUREQCLR | USB_SQCLR)); hw_usb_hwrite_dcpctr((USB_SUREQCLR | USB_SQCLR);
/* CFIFO buffer clear */ /* CFIFO buffer clear */
usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, usb_cstd_chg_curpipe(USB_PIPE0, USB_CUSE, USB_FALSE);
(uint16_t) USB_CUSE, USB_FALSE);
hw_usb_set_bclr(USB_CUSE); /* Clear BVAL */ hw_usb_set_bclr(USB_CUSE); /* Clear BVAL */
usb_cstd_chg_curpipe((uint16_t) USB_PIPE0, usb_cstd_chg_curpipe((USB_PIPE0, USB_CUSE, USB_ISEL);
(uint16_t) USB_CUSE, (uint16_t) USB_ISEL);
hw_usb_set_bclr(USB_CUSE); /* Clear BVAL */ hw_usb_set_bclr(USB_CUSE); /* Clear BVAL */
} }
@ -4454,7 +4444,7 @@ void usb_hstd_brdy_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_END); usb_hstd_ctrl_end(USB_CTRL_END);
nxsem_post(&EDCTRL->wdhsem); nxsem_post(&EDCTRL->wdhsem);
return; /* Nothing else to do here... as of now... */ return; /* Nothing else to do here... as of now... */
@ -4495,14 +4485,14 @@ void usb_hstd_brdy_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_OVR); usb_hstd_ctrl_end(USB_DATA_OVR);
break; break;
case USB_FIFOERROR: /* FIFO access error */ case USB_FIFOERROR: /* FIFO access error */
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_ERR); usb_hstd_ctrl_end(USB_DATA_ERR);
syslog(LOG_INFO, "ERROR"); syslog(LOG_INFO, "ERROR");
break; break;
@ -4521,7 +4511,7 @@ void usb_hstd_brdy_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_READING); usb_hstd_ctrl_end(USB_CTRL_READING);
break; break;
case USB_READSHRT: /* End of data read */ case USB_READSHRT: /* End of data read */
@ -4544,14 +4534,14 @@ void usb_hstd_brdy_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_OVR); usb_hstd_ctrl_end(USB_DATA_OVR);
break; break;
case USB_FIFOERROR: /* FIFO access error */ case USB_FIFOERROR: /* FIFO access error */
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_ERR); usb_hstd_ctrl_end(USB_DATA_ERR);
syslog(LOG_INFO, "ERROR"); syslog(LOG_INFO, "ERROR");
break; break;
@ -4566,7 +4556,7 @@ void usb_hstd_brdy_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_END); usb_hstd_ctrl_end(USB_CTRL_END);
break; break;
default: default:
@ -4615,7 +4605,7 @@ void usb_hstd_nrdy_pipe (void)
/* Get Pipe PID from pipe number */ /* Get Pipe PID from pipe number */
buffer = usb_cstd_get_pid((uint16_t) USB_PIPE0); buffer = usb_cstd_get_pid(USB_PIPE0);
/* STALL ? */ /* STALL ? */
@ -4624,13 +4614,13 @@ void usb_hstd_nrdy_pipe (void)
{ {
/* PIPE0 STALL call back */ /* PIPE0 STALL call back */
usb_hstd_ctrl_end((uint16_t) USB_DATA_STALL); usb_hstd_ctrl_end(USB_DATA_STALL);
} }
else else
{ {
/* Control Data Stage Device Ignore X 3 call back */ /* Control Data Stage Device Ignore X 3 call back */
usb_hstd_ctrl_end((uint16_t) USB_DATA_ERR); usb_hstd_ctrl_end(USB_DATA_ERR);
} }
} }
@ -4670,17 +4660,17 @@ void usb_hstd_bemp_pipe (void)
/* BEMP0 Disable */ /* BEMP0 Disable */
hw_usb_clear_bempenb((uint16_t) USB_PIPE0); hw_usb_clear_bempenb(USB_PIPE0);
/* BRDY0 Disable */ /* BRDY0 Disable */
hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); hw_usb_clear_brdyenb(USB_PIPE0);
/* Call this to end the setup packet */ /* Call this to end the setup packet */
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_END); usb_hstd_ctrl_end(USB_CTRL_END);
nxsem_post(&EDCTRL->wdhsem); nxsem_post(&EDCTRL->wdhsem);
return; /* As of now, Nothing else to do here... */ return; /* As of now, Nothing else to do here... */
@ -4688,7 +4678,7 @@ void usb_hstd_bemp_pipe (void)
/* Get Pipe PID from pipe number */ /* Get Pipe PID from pipe number */
buffer = usb_cstd_get_pid((uint16_t) USB_PIPE0); buffer = usb_cstd_get_pid(USB_PIPE0);
/* MAX packet size error ? */ /* MAX packet size error ? */
@ -4696,7 +4686,7 @@ void usb_hstd_bemp_pipe (void)
{ {
/* PIPE0 STALL call back */ /* PIPE0 STALL call back */
usb_hstd_ctrl_end((uint16_t) USB_DATA_STALL); usb_hstd_ctrl_end(USB_DATA_STALL);
} }
else else
{ {
@ -4718,11 +4708,11 @@ void usb_hstd_bemp_pipe (void)
case USB_WRITESHRT: case USB_WRITESHRT:
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
break; break;
/* End of data write (not null) */ /* End of data write (not null) */
@ -4737,11 +4727,11 @@ void usb_hstd_bemp_pipe (void)
/* Enable Empty Interrupt */ /* Enable Empty Interrupt */
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
break; break;
/* FIFO access error */ /* FIFO access error */
@ -4750,7 +4740,7 @@ void usb_hstd_bemp_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_ERR); usb_hstd_ctrl_end(USB_DATA_ERR);
break; break;
default: default:
@ -4772,11 +4762,11 @@ void usb_hstd_bemp_pipe (void)
case USB_WRITESHRT: case USB_WRITESHRT:
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
break; break;
/* End of data write (not null) */ /* End of data write (not null) */
@ -4785,7 +4775,7 @@ void usb_hstd_bemp_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_WRITING); usb_hstd_ctrl_end(USB_CTRL_WRITING);
break; break;
/* Continue of data write */ /* Continue of data write */
@ -4794,11 +4784,11 @@ void usb_hstd_bemp_pipe (void)
/* Enable Empty Interrupt */ /* Enable Empty Interrupt */
hw_usb_set_bempenb((uint16_t) USB_PIPE0); hw_usb_set_bempenb(USB_PIPE0);
/* Enable Not Ready Interrupt */ /* Enable Not Ready Interrupt */
usb_cstd_nrdy_enable((uint16_t) USB_PIPE0); usb_cstd_nrdy_enable(USB_PIPE0);
break; break;
/* FIFO access error */ /* FIFO access error */
@ -4807,7 +4797,7 @@ void usb_hstd_bemp_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_DATA_ERR); usb_hstd_ctrl_end(USB_DATA_ERR);
break; break;
default: default:
@ -4825,7 +4815,7 @@ void usb_hstd_bemp_pipe (void)
/* Control Read/Write End */ /* Control Read/Write End */
usb_hstd_ctrl_end((uint16_t) USB_CTRL_END); usb_hstd_ctrl_end(USB_CTRL_END);
break; break;
default: default:
@ -4969,7 +4959,7 @@ static void rx65n_usbhost_putreg(uint16_t val, uint32_t addr)
static inline uint16_t rx65n_usbhost_getle16(const uint8_t *val) static inline uint16_t rx65n_usbhost_getle16(const uint8_t *val)
{ {
return (uint16_t)val[1] << 8 | (uint16_t)val[0]; return val[1] << 8 | val[0];
} }
/**************************************************************************** /****************************************************************************
@ -5649,9 +5639,9 @@ static inline int rx65n_usbhost_remisoced(struct rx65n_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static int rx65n_usbhost_enqueuetd(struct rx65n_usbhost_s *priv, static int rx65n_usbhost_enqueuetd(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed, uint32_t dirpid, struct rx65n_usbhost_ed_s *ed,
uint32_t toggle, volatile uint8_t *buffer, uint32_t dirpid, uint32_t toggle,
size_t buflen) volatile uint8_t *buffer, size_t buflen)
{ {
struct rx65n_usbhost_gtd_s *td; struct rx65n_usbhost_gtd_s *td;
int ret = -ENOMEM; int ret = -ENOMEM;
@ -5748,7 +5738,8 @@ static int rx65n_usbhost_wdhwait(struct rx65n_usbhost_s *priv,
static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv, static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv,
struct rx65n_usbhost_ed_s *ed, struct rx65n_usbhost_ed_s *ed,
uint32_t dirpid, uint8_t *buffer, size_t buflen) uint32_t dirpid, uint8_t *buffer,
size_t buflen)
{ {
struct rx65n_usbhost_xfrinfo_s *xfrinfo; struct rx65n_usbhost_xfrinfo_s *xfrinfo;
uint32_t toggle; uint32_t toggle;
@ -5876,11 +5867,11 @@ static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv,
/* BEMP0 Disable */ /* BEMP0 Disable */
hw_usb_clear_bempenb((uint16_t) USB_PIPE0); hw_usb_clear_bempenb(USB_PIPE0);
/* BRDY0 Disable */ /* BRDY0 Disable */
hw_usb_clear_brdyenb((uint16_t) USB_PIPE0); hw_usb_clear_brdyenb(USB_PIPE0);
usb_hstd_ctrl_read_start(); usb_hstd_ctrl_read_start();
@ -5913,11 +5904,11 @@ static int rx65n_usbhost_ctrltd(struct rx65n_usbhost_s *priv,
/* Disable Empty Interrupt */ /* Disable Empty Interrupt */
hw_usb_clear_bempenb((uint16_t) USB_PIPE0); hw_usb_clear_bempenb(USB_PIPE0);
/* Disable Not Ready Interrupt */ /* Disable Not Ready Interrupt */
hw_usb_clear_nrdyenb((uint16_t) USB_PIPE0); hw_usb_clear_nrdyenb(USB_PIPE0);
} }
/* Check the TD completion status bits */ /* Check the TD completion status bits */
@ -7157,7 +7148,7 @@ static int rx65n_usbhost_ctrlin(struct usbhost_driver_s *drvr,
/* for read does the calculation correctly */ /* for read does the calculation correctly */
g_rx65n_edlist[kbd_interrupt_in_pipe].xfrinfo->xfrd = 0; g_rx65n_edlist[kbd_interrupt_in_pipe].xfrinfo->xfrd = 0;
usb_cstd_set_buf((uint16_t) kbd_interrupt_in_pipe); /* Set BUF */ usb_cstd_set_buf(kbd_interrupt_in_pipe); /* Set BUF */
} }
return ret; return ret;
@ -7250,8 +7241,7 @@ static int rx65n_usbhost_ctrlout(struct usbhost_driver_s *drvr,
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, struct rx65n_usbhost_ed_s *ed,
uint8_t *buffer, uint8_t *buffer, size_t buflen)
size_t buflen)
{ {
struct rx65n_usbhost_xfrinfo_s *xfrinfo; struct rx65n_usbhost_xfrinfo_s *xfrinfo;
uint32_t dirpid; uint32_t dirpid;
@ -7341,8 +7331,8 @@ static int rx65n_usbhost_transfer_common(struct rx65n_usbhost_s *priv,
#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, struct rx65n_usbhost_ed_s *ed,
uint8_t *userbuffer, uint8_t *userbuffer, size_t buflen,
size_t buflen, uint8_t **alloc) uint8_t **alloc)
{ {
syslog(LOG_INFO, "Debug : %s(): Line : %d\n", __func__, __LINE__); syslog(LOG_INFO, "Debug : %s(): Line : %d\n", __func__, __LINE__);
@ -7378,8 +7368,8 @@ static int rx65n_usbhost_dma_alloc(struct rx65n_usbhost_s *priv,
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, struct rx65n_usbhost_ed_s *ed,
uint8_t *userbuffer, uint8_t *userbuffer, size_t buflen,
size_t buflen, uint8_t *newbuffer) uint8_t *newbuffer)
{ {
syslog(LOG_INFO, "Debug : %s(): Line : %d\n", __func__, __LINE__); syslog(LOG_INFO, "Debug : %s(): Line : %d\n", __func__, __LINE__);
} }
@ -7425,7 +7415,8 @@ static void rx65n_usbhost_dma_free(struct rx65n_usbhost_s *priv,
****************************************************************************/ ****************************************************************************/
static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr, static ssize_t rx65n_usbhost_transfer(struct usbhost_driver_s *drvr,
usbhost_ep_t ep, uint8_t *buffer, size_t buflen) usbhost_ep_t ep,
uint8_t *buffer, size_t buflen)
{ {
struct rx65n_usbhost_s *priv = (struct rx65n_usbhost_s *)drvr; struct rx65n_usbhost_s *priv = (struct rx65n_usbhost_s *)drvr;
struct rx65n_usbhost_ed_s *ed = (struct rx65n_usbhost_ed_s *)ep; struct rx65n_usbhost_ed_s *ed = (struct rx65n_usbhost_ed_s *)ep;
@ -8014,7 +8005,7 @@ static int rx65n_usbhost_connect(FAR struct usbhost_driver_s *drvr,
syslog(LOG_INFO, "Enumeration failed with %d", ret); syslog(LOG_INFO, "Enumeration failed with %d", ret);
} }
hw_usb_write_dcpmxps((uint16_t) (USB_DEFPACKET + USB_DEVICE_1)); hw_usb_write_dcpmxps(USB_DEFPACKET + USB_DEVICE_1);
if (hport->speed == USB_SPEED_LOW) if (hport->speed == USB_SPEED_LOW)
{ {

View File

@ -1673,7 +1673,7 @@ bl602_net_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg)
} }
#endif #endif
priv->wlan = wifi_mgmr_sta_enable((void *)priv); priv->wlan = wifi_mgmr_sta_enable(priv);
memcpy(priv->wlan->mac, memcpy(priv->wlan->mac,
priv->net_dev.d_mac.ether.ether_addr_octet, priv->net_dev.d_mac.ether.ether_addr_octet,
@ -1694,7 +1694,7 @@ bl602_net_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg)
} }
#endif #endif
priv->wlan = wifi_mgmr_ap_enable((void *)priv); priv->wlan = wifi_mgmr_ap_enable(priv);
memcpy(priv->wlan->mac, memcpy(priv->wlan->mac,
priv->net_dev.d_mac.ether.ether_addr_octet, priv->net_dev.d_mac.ether.ether_addr_octet,
6); 6);

View File

@ -38,6 +38,7 @@
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/mutex.h> #include <nuttx/mutex.h>
#include <nuttx/semaphore.h>
#include <nuttx/signal.h> #include <nuttx/signal.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
@ -1480,7 +1481,7 @@ void bl602_spi_dma_init(struct spi_dev_s *dev)
/* Request a DMA channel for SPI peripheral */ /* Request a DMA channel for SPI peripheral */
priv->dma_rxchan = bl602_dma_channel_request(bl602_dma_rx_callback, priv->dma_rxchan = bl602_dma_channel_request(bl602_dma_rx_callback,
(void *)priv); priv);
if (priv->dma_rxchan < 0) if (priv->dma_rxchan < 0)
{ {
spierr("Failed to allocate GDMA channel\n"); spierr("Failed to allocate GDMA channel\n");
@ -1490,7 +1491,7 @@ void bl602_spi_dma_init(struct spi_dev_s *dev)
} }
priv->dma_txchan = bl602_dma_channel_request(bl602_dma_tx_callback, priv->dma_txchan = bl602_dma_channel_request(bl602_dma_tx_callback,
(void *)priv); priv);
if (priv->dma_txchan < 0) if (priv->dma_txchan < 0)
{ {
spierr("Failed to allocate GDMA channel\n"); spierr("Failed to allocate GDMA channel\n");

View File

@ -411,7 +411,7 @@ static struct esp32_i2s_s esp32_i2s0_priv =
{ {
.dev = .dev =
{ {
.ops = &g_i2sops .ops = &g_i2sops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
.config = &esp32_i2s0_config, .config = &esp32_i2s0_config,
@ -472,7 +472,7 @@ static struct esp32_i2s_s esp32_i2s1_priv =
{ {
.dev = .dev =
{ {
.ops = &g_i2sops .ops = &g_i2sops,
}, },
.lock = NXMUTEX_INITIALIZER, .lock = NXMUTEX_INITIALIZER,
.config = &esp32_i2s1_config, .config = &esp32_i2s1_config,
@ -614,8 +614,6 @@ static void i2s_buf_free(struct esp32_i2s_s *priv,
static int i2s_buf_initialize(struct esp32_i2s_s *priv) static int i2s_buf_initialize(struct esp32_i2s_s *priv)
{ {
int ret;
priv->tx.carry.bytes = 0; priv->tx.carry.bytes = 0;
priv->tx.carry.value = 0; priv->tx.carry.value = 0;
@ -1786,7 +1784,6 @@ static int esp32_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
bfcontainer->result = -EBUSY; bfcontainer->result = -EBUSY;
ret = i2s_txdma_setup(priv, bfcontainer); ret = i2s_txdma_setup(priv, bfcontainer);
if (ret != OK) if (ret != OK)
{ {
goto errout_with_buf; goto errout_with_buf;
@ -1797,7 +1794,6 @@ static int esp32_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
apb->nbytes - apb->curbyte); apb->nbytes - apb->curbyte);
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);
return OK; return OK;
errout_with_buf: errout_with_buf:

View File

@ -92,7 +92,7 @@ static int ez80_i2c_transfer(FAR struct i2c_master_s *dev,
static bool g_initialized; /* true:I2C has been initialized */ static bool g_initialized; /* true:I2C has been initialized */
static mutex_t g_i2clock = NXMUTEX_INITIALIZER; /* Serialize I2C transfers */ static mutex_t g_i2clock = NXMUTEX_INITIALIZER; /* Serialize I2C transfers */
const struct i2c_ops_s g_ops = static const struct i2c_ops_s g_ops =
{ {
ez80_i2c_transfer ez80_i2c_transfer
}; };

View File

@ -1347,8 +1347,7 @@ static int tc_ioctl(struct file *filep, int cmd, unsigned long arg)
* Name: tc_poll * Name: tc_poll
****************************************************************************/ ****************************************************************************/
static int tc_poll(struct file *filep, struct pollfd *fds, static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
bool setup)
{ {
struct inode *inode; struct inode *inode;
struct tc_dev_s *priv; struct tc_dev_s *priv;

View File

@ -1224,8 +1224,7 @@ static int tc_ioctl(struct file *filep, int cmd, unsigned long arg)
* Name: tc_poll * Name: tc_poll
****************************************************************************/ ****************************************************************************/
static int tc_poll(struct file *filep, struct pollfd *fds, static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
bool setup)
{ {
struct inode *inode; struct inode *inode;
struct tc_dev_s *priv; struct tc_dev_s *priv;

View File

@ -284,7 +284,7 @@ static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */ /* struct usbhost_registry_s methods */
static struct usbhost_class_s *usbhost_create( static FAR struct usbhost_class_s *usbhost_create(
FAR struct usbhost_hubport_s *hport, FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id); FAR const struct usbhost_id_s *id);
@ -355,7 +355,7 @@ static uint32_t g_devinuse;
static mutex_t g_lock = NXMUTEX_INITIALIZER; static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0); static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */ static FAR struct usbhost_state_s *g_priv;
/* The following tables map keyboard scan codes to printable ASIC /* The following tables map keyboard scan codes to printable ASIC
* characters. There is no support here for function keys or cursor * characters. There is no support here for function keys or cursor
@ -1978,7 +1978,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
* *
****************************************************************************/ ****************************************************************************/
static int usbhost_disconnected(struct usbhost_class_s *usbclass) static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass)
{ {
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass; FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;

View File

@ -334,7 +334,7 @@ static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */ /* struct usbhost_registry_s methods */
static struct usbhost_class_s * static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport, usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id); FAR const struct usbhost_id_s *id);
@ -405,7 +405,7 @@ static uint32_t g_devinuse;
static mutex_t g_lock = NXMUTEX_INITIALIZER; static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0); static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */ static FAR struct usbhost_state_s *g_priv;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -1913,7 +1913,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
* *
****************************************************************************/ ****************************************************************************/
static int usbhost_disconnected(struct usbhost_class_s *usbclass) static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass)
{ {
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass; FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
int i; int i;

View File

@ -163,7 +163,7 @@ struct usbhost_state_s
mutex_t lock; /* Used to maintain mutual exclusive access */ mutex_t lock; /* Used to maintain mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */ struct work_s work; /* For interacting with the worker thread */
FAR uint8_t *tbuffer; /* The allocated transfer buffer */ FAR uint8_t *tbuffer; /* The allocated transfer buffer */
FAR uint8_t obuffer[20]; /* The fixed output transfer buffer */ uint8_t obuffer[20]; /* The fixed output transfer buffer */
size_t tbuflen; /* Size of the allocated transfer buffer */ size_t tbuflen; /* Size of the allocated transfer buffer */
usbhost_ep_t epin; /* IN endpoint */ usbhost_ep_t epin; /* IN endpoint */
usbhost_ep_t epout; /* OUT endpoint */ usbhost_ep_t epout; /* OUT endpoint */
@ -223,7 +223,7 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */ /* struct usbhost_registry_s methods */
static struct usbhost_class_s * static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport, usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id); FAR const struct usbhost_id_s *id);
@ -310,7 +310,7 @@ static uint32_t g_devinuse;
static mutex_t g_lock = NXMUTEX_INITIALIZER; static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0); static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */ static FAR struct usbhost_state_s *g_priv;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -1651,7 +1651,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
* *
****************************************************************************/ ****************************************************************************/
static int usbhost_disconnected(struct usbhost_class_s *usbclass) static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass)
{ {
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass; FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass;
int i; int i;
@ -1903,7 +1903,7 @@ static ssize_t usbhost_read(FAR struct file *filep, FAR char *buffer,
{ {
FAR struct inode *inode; FAR struct inode *inode;
FAR struct usbhost_state_s *priv; FAR struct usbhost_state_s *priv;
FAR struct xbox_controller_buttonstate_s sample; struct xbox_controller_buttonstate_s sample;
int ret; int ret;
DEBUGASSERT(filep && filep->f_inode && buffer); DEBUGASSERT(filep && filep->f_inode && buffer);

View File

@ -528,7 +528,7 @@ static inline int nxrmutex_breaklock(FAR rmutex_t *rmutex,
rmutex->count = 0; rmutex->count = 0;
rmutex->holder = NXRMUTEX_NO_HOLDER; rmutex->holder = NXRMUTEX_NO_HOLDER;
nxmutex_unlock(&rmutex->mutex); nxmutex_unlock(&rmutex->mutex);
ret = 0; ret = OK;
} }
return ret; return ret;

View File

@ -70,7 +70,7 @@ struct btnet_discoverstate_s
{ {
struct bt_gatt_discover_params_s bd_params; struct bt_gatt_discover_params_s bd_params;
struct bt_uuid_s bd_uuid; /* Discovery UUID */ struct bt_uuid_s bd_uuid; /* Discovery UUID */
sem_t bd_donesem; /* Manages exclusive access */ sem_t bd_donesem; /* Done notification */
}; };
/* GATT read state variables. */ /* GATT read state variables. */
@ -79,7 +79,7 @@ struct btnet_rdstate_s
{ {
struct btreq_s *rd_btreq; struct btreq_s *rd_btreq;
uint8_t rd_result; /* The result of the read */ uint8_t rd_result; /* The result of the read */
sem_t rd_donesem; /* Manages exclusive access */ sem_t rd_donesem; /* Done notification */
}; };
/* GATT write state variables. */ /* GATT write state variables. */
@ -88,7 +88,7 @@ struct btnet_wrstate_s
{ {
struct btreq_s *wr_btreq; struct btreq_s *wr_btreq;
uint8_t wr_result; /* The result of the read */ uint8_t wr_result; /* The result of the read */
sem_t wr_donesem; /* Manages exclusive access */ sem_t wr_donesem; /* Done notification */
}; };
/**************************************************************************** /****************************************************************************