mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
Many changes to reduce complaints from CppCheck. Several latent bugs fixes, but probably some new typos introduced
This commit is contained in:
@@ -6570,3 +6570,6 @@
|
|||||||
for the MIO283QT9A LCD. From Toby Duckworth (2014-2-10).
|
for the MIO283QT9A LCD. From Toby Duckworth (2014-2-10).
|
||||||
* configs/mikroe-stm32f4/src/up_mio283qt9a.c: The Mikroe STM32F4 can
|
* configs/mikroe-stm32f4/src/up_mio283qt9a.c: The Mikroe STM32F4 can
|
||||||
now support the newer MIO283QT9A LCD. From Toby Duckworth (2014-2-10).
|
now support the newer MIO283QT9A LCD. From Toby Duckworth (2014-2-10).
|
||||||
|
* MANY files changes based on complaints from the tool CppCheck. Several
|
||||||
|
latent bugs were fixed (and most likely some new typos were introducted)
|
||||||
|
(2014-2-10).
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void up_enable_irq(int irq)
|
|||||||
|
|
||||||
void up_maskack_irq(int irq)
|
void up_maskack_irq(int irq)
|
||||||
{
|
{
|
||||||
uint32_t reg = getreg32(INT_CTRL_REG);
|
uint32_t reg;
|
||||||
|
|
||||||
/* Mask the interrupt */
|
/* Mask the interrupt */
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen)
|
|||||||
dbg("buflen=%d\n", buflen);
|
dbg("buflen=%d\n", buflen);
|
||||||
if (buflen >= 18)
|
if (buflen >= 18)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "#08x %08x\n", c5471_wdt_cntl, c5471_wdt_count);
|
sprintf(buffer, "%08x %08x\n", c5471_wdt_cntl, c5471_wdt_count);
|
||||||
return 18;
|
return 18;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
|||||||
|
|
||||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||||
size_t usize = CONFIG_RAM_END - ubase;
|
size_t usize = CONFIG_RAM_END - ubase;
|
||||||
int log2;
|
|
||||||
|
|
||||||
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
||||||
|
|
||||||
@@ -151,9 +150,6 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||||
size_t usize = CONFIG_RAM_END - ubase;
|
|
||||||
int log2;
|
|
||||||
|
|
||||||
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
||||||
|
|
||||||
/* Return the kernel heap settings (i.e., the part of the heap region
|
/* Return the kernel heap settings (i.e., the part of the heap region
|
||||||
|
|||||||
@@ -1254,7 +1254,7 @@ static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursora
|
|||||||
attrib->size.w = getreg16(DM320_OSD_CURXL);
|
attrib->size.w = getreg16(DM320_OSD_CURXL);
|
||||||
attrib->size.h = getreg16(DM320_OSD_CURYL);
|
attrib->size.h = getreg16(DM320_OSD_CURYL);
|
||||||
#endif
|
#endif
|
||||||
irqrestore();
|
irqrestore(flags);
|
||||||
|
|
||||||
attrib->mxsize.w = MAX_XRES;
|
attrib->mxsize.w = MAX_XRES;
|
||||||
attrib->mxsize.h = MAX_YRES;
|
attrib->mxsize.h = MAX_YRES;
|
||||||
@@ -1325,10 +1325,8 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs
|
|||||||
settings->size.h = MAX_YRES;
|
settings->size.h = MAX_YRES;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = irqsave();
|
|
||||||
putreg16(settings->size.w, DM320_OSD_CURXL);
|
putreg16(settings->size.w, DM320_OSD_CURXL);
|
||||||
putreg16(settings->size.h, DM320_OSD_CURYL);
|
putreg16(settings->size.h, DM320_OSD_CURYL);
|
||||||
restore_flags(flags);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1342,7 +1340,7 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs
|
|||||||
regval &= ~1;
|
regval &= ~1;
|
||||||
}
|
}
|
||||||
putreg16(regval, DM320_OSD_RECTCUR);
|
putreg16(regval, DM320_OSD_RECTCUR);
|
||||||
restore_flags(flags);
|
irqrestore(flags);
|
||||||
|
|
||||||
gvdbg("DM320_OSD_CURXP: %04x\n", getreg16(DM320_OSD_CURXP));
|
gvdbg("DM320_OSD_CURXP: %04x\n", getreg16(DM320_OSD_CURXP));
|
||||||
gvdbg("DM320_OSD_CURYP: %04x\n", getreg16(DM320_OSD_CURYP));
|
gvdbg("DM320_OSD_CURYP: %04x\n", getreg16(DM320_OSD_CURYP));
|
||||||
|
|||||||
@@ -1761,7 +1761,7 @@ static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
|
|||||||
|
|
||||||
/* FIFO address, max packet size, dual/single buffered */
|
/* FIFO address, max packet size, dual/single buffered */
|
||||||
|
|
||||||
dm320_putreg8(addrhi, DM320_USB_TXFIFO1);
|
dm320_putreg8(addrlo, DM320_USB_TXFIFO1);
|
||||||
dm320_putreg8(addrhi|g_epinfo[i].fifo, DM320_USB_TXFIFO2);
|
dm320_putreg8(addrhi|g_epinfo[i].fifo, DM320_USB_TXFIFO2);
|
||||||
|
|
||||||
/* TX endpoint max packet size */
|
/* TX endpoint max packet size */
|
||||||
|
|||||||
@@ -879,8 +879,10 @@ static int up_interrupt(int irq, void *context)
|
|||||||
|
|
||||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
|
||||||
struct inode *inode = filep->f_inode;
|
struct inode *inode = filep->f_inode;
|
||||||
struct uart_dev_s *dev = inode->i_private;
|
struct uart_dev_s *dev = inode->i_private;
|
||||||
|
#endif
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
|||||||
@@ -500,10 +500,10 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer,
|
|||||||
{
|
{
|
||||||
#ifndef CONFIG_SPI_POLLWAIT
|
#ifndef CONFIG_SPI_POLLWAIT
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
#endif
|
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
int ntxd;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
#endif
|
||||||
|
int ntxd;
|
||||||
|
|
||||||
/* Set up to perform the transfer */
|
/* Set up to perform the transfer */
|
||||||
|
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
priv->ie |= UART_C2_RIE;
|
priv->ie &= ~UART_C2_RIE;
|
||||||
up_setuartint(priv);
|
up_setuartint(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ extern void _vectors(void);
|
|||||||
|
|
||||||
void __start(void)
|
void __start(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BOOT_RUNFROMFLASH
|
||||||
const uint32_t *src;
|
const uint32_t *src;
|
||||||
|
#endif
|
||||||
uint32_t *dest;
|
uint32_t *dest;
|
||||||
|
|
||||||
/* Configure the uart so that we can get debug output as soon as possible */
|
/* Configure the uart so that we can get debug output as soon as possible */
|
||||||
|
|||||||
@@ -111,10 +111,11 @@ static struct lpc31_i2cdev_s i2cdevices[2];
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int i2c_interrupt (int irq, FAR void *context);
|
|
||||||
static void i2c_progress (struct lpc31_i2cdev_s *priv);
|
static int i2c_interrupt(int irq, FAR void *context);
|
||||||
static void i2c_timeout (int argc, uint32_t arg, ...);
|
static void i2c_progress(struct lpc31_i2cdev_s *priv);
|
||||||
static void i2c_reset (struct lpc31_i2cdev_s *priv);
|
static void i2c_timeout(int argc, uint32_t arg, ...);
|
||||||
|
static void i2c_reset(struct lpc31_i2cdev_s *priv);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -130,7 +131,8 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int
|
|||||||
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
|
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
|
||||||
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count);
|
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count);
|
||||||
|
|
||||||
struct i2c_ops_s lpc31_i2c_ops = {
|
struct i2c_ops_s lpc31_i2c_ops =
|
||||||
|
{
|
||||||
.setfrequency = i2c_setfrequency,
|
.setfrequency = i2c_setfrequency,
|
||||||
.setaddress = i2c_setaddress,
|
.setaddress = i2c_setaddress,
|
||||||
.write = i2c_write,
|
.write = i2c_write,
|
||||||
@@ -157,20 +159,20 @@ struct i2c_dev_s *up_i2cinitialize(int port)
|
|||||||
priv->rstid = (port == 0) ? RESETID_I2C0RST : RESETID_I2C1RST;
|
priv->rstid = (port == 0) ? RESETID_I2C0RST : RESETID_I2C1RST;
|
||||||
priv->irqid = (port == 0) ? LPC31_IRQ_I2C0 : LPC31_IRQ_I2C1;
|
priv->irqid = (port == 0) ? LPC31_IRQ_I2C0 : LPC31_IRQ_I2C1;
|
||||||
|
|
||||||
sem_init (&priv->mutex, 0, 1);
|
sem_init(&priv->mutex, 0, 1);
|
||||||
sem_init (&priv->wait, 0, 0);
|
sem_init(&priv->wait, 0, 0);
|
||||||
|
|
||||||
/* Enable I2C system clocks */
|
/* Enable I2C system clocks */
|
||||||
|
|
||||||
lpc31_enableclock (priv->clkid);
|
lpc31_enableclock(priv->clkid);
|
||||||
|
|
||||||
/* Reset I2C blocks */
|
/* Reset I2C blocks */
|
||||||
|
|
||||||
lpc31_softreset (priv->rstid);
|
lpc31_softreset(priv->rstid);
|
||||||
|
|
||||||
/* Soft reset the device */
|
/* Soft reset the device */
|
||||||
|
|
||||||
i2c_reset (priv);
|
i2c_reset(priv);
|
||||||
|
|
||||||
/* Allocate a watchdog timer */
|
/* Allocate a watchdog timer */
|
||||||
priv->timeout = wd_create();
|
priv->timeout = wd_create();
|
||||||
@@ -178,7 +180,7 @@ struct i2c_dev_s *up_i2cinitialize(int port)
|
|||||||
DEBUGASSERT(priv->timeout != 0);
|
DEBUGASSERT(priv->timeout != 0);
|
||||||
|
|
||||||
/* Attach Interrupt Handler */
|
/* Attach Interrupt Handler */
|
||||||
irq_attach (priv->irqid, i2c_interrupt);
|
irq_attach(priv->irqid, i2c_interrupt);
|
||||||
|
|
||||||
/* Enable Interrupt Handler */
|
/* Enable Interrupt Handler */
|
||||||
up_enable_irq(priv->irqid);
|
up_enable_irq(priv->irqid);
|
||||||
@@ -197,23 +199,23 @@ struct i2c_dev_s *up_i2cinitialize(int port)
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
void up_i2cuninitalize (struct lpc31_i2cdev_s *priv)
|
void up_i2cuninitalize(struct lpc31_i2cdev_s *priv)
|
||||||
{
|
{
|
||||||
/* Disable All Interrupts, soft reset the device */
|
/* Disable All Interrupts, soft reset the device */
|
||||||
|
|
||||||
i2c_reset (priv);
|
i2c_reset(priv);
|
||||||
|
|
||||||
/* Detach Interrupt Handler */
|
/* Detach Interrupt Handler */
|
||||||
|
|
||||||
irq_detach (priv->irqid);
|
irq_detach(priv->irqid);
|
||||||
|
|
||||||
/* Reset I2C blocks */
|
/* Reset I2C blocks */
|
||||||
|
|
||||||
lpc31_softreset (priv->rstid);
|
lpc31_softreset(priv->rstid);
|
||||||
|
|
||||||
/* Disable I2C system clocks */
|
/* Disable I2C system clocks */
|
||||||
|
|
||||||
lpc31_disableclock (priv->clkid);
|
lpc31_disableclock(priv->clkid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -228,22 +230,25 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
|
|||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
||||||
|
|
||||||
uint32_t freq = lpc31_clkfreq (priv->clkid, DOMAINID_AHB0APB1);
|
uint32_t freq = lpc31_clkfreq(priv->clkid, DOMAINID_AHB0APB1);
|
||||||
|
|
||||||
if (freq > 100000)
|
if (freq > 100000)
|
||||||
{
|
{
|
||||||
/* asymetric per 400Khz I2C spec */
|
/* asymetric per 400Khz I2C spec */
|
||||||
putreg32 (((47 * freq) / (83 + 47)) / frequency, priv->base + LPC31_I2C_CLKHI_OFFSET);
|
|
||||||
putreg32 (((83 * freq) / (83 + 47)) / frequency, priv->base + LPC31_I2C_CLKLO_OFFSET);
|
putreg32(((47 * freq) / (83 + 47)) / frequency, priv->base + LPC31_I2C_CLKHI_OFFSET);
|
||||||
|
putreg32(((83 * freq) / (83 + 47)) / frequency, priv->base + LPC31_I2C_CLKLO_OFFSET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* 50/50 mark space ratio */
|
/* 50/50 mark space ratio */
|
||||||
putreg32 (((50 * freq) / 100) / frequency, priv->base + LPC31_I2C_CLKLO_OFFSET);
|
|
||||||
putreg32 (((50 * freq) / 100) / frequency, priv->base + LPC31_I2C_CLKHI_OFFSET);
|
putreg32(((50 * freq) / 100) / frequency, priv->base + LPC31_I2C_CLKLO_OFFSET);
|
||||||
|
putreg32(((50 * freq) / 100) / frequency, priv->base + LPC31_I2C_CLKHI_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This function should return the actual selected frequency */
|
/* FIXME: This function should return the actual selected frequency */
|
||||||
|
|
||||||
return frequency;
|
return frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +259,7 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
|
|||||||
* Set the I2C slave address for a subsequent read/write
|
* Set the I2C slave address for a subsequent read/write
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
|
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
|
||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
||||||
@@ -275,18 +281,19 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
|
|||||||
* frequency and slave address.
|
* frequency and slave address.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen)
|
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT (dev != NULL);
|
DEBUGASSERT(dev != NULL);
|
||||||
|
|
||||||
priv->msg.flags &= ~I2C_M_READ;
|
priv->msg.flags &= ~I2C_M_READ;
|
||||||
priv->msg.buffer = (uint8_t*)buffer;
|
priv->msg.buffer = (uint8_t*)buffer;
|
||||||
priv->msg.length = buflen;
|
priv->msg.length = buflen;
|
||||||
|
|
||||||
ret = i2c_transfer (dev, &priv->msg, 1);
|
ret = i2c_transfer(dev, &priv->msg, 1);
|
||||||
|
|
||||||
return ret == 1 ? OK : -ETIMEDOUT;
|
return ret == 1 ? OK : -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
@@ -299,18 +306,19 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int bufle
|
|||||||
* frequency and slave address.
|
* frequency and slave address.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
|
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT (dev != NULL);
|
DEBUGASSERT(dev != NULL);
|
||||||
|
|
||||||
priv->msg.flags |= I2C_M_READ;
|
priv->msg.flags |= I2C_M_READ;
|
||||||
priv->msg.buffer = buffer;
|
priv->msg.buffer = buffer;
|
||||||
priv->msg.length = buflen;
|
priv->msg.length = buflen;
|
||||||
|
|
||||||
ret = i2c_transfer (dev, &priv->msg, 1);
|
ret = i2c_transfer(dev, &priv->msg, 1);
|
||||||
|
|
||||||
return ret == 1 ? OK : -ETIMEDOUT;
|
return ret == 1 ? OK : -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
@@ -323,36 +331,38 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static int i2c_transfer (FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count)
|
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count)
|
||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) dev;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sem_wait (&priv->mutex);
|
sem_wait(&priv->mutex);
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
|
|
||||||
priv->state = I2C_STATE_START;
|
priv->state = I2C_STATE_START;
|
||||||
priv->msgs = msgs;
|
priv->msgs = msgs;
|
||||||
priv->nmsg = count;
|
priv->nmsg = count;
|
||||||
|
|
||||||
i2c_progress (priv);
|
i2c_progress(priv);
|
||||||
|
|
||||||
/* start a watchdog to timeout the transfer if
|
/* start a watchdog to timeout the transfer if
|
||||||
* the bus is locked up... */
|
* the bus is locked up...
|
||||||
wd_start (priv->timeout, I2C_TIMEOUT, i2c_timeout, 1, (uint32_t)priv);
|
*/
|
||||||
|
|
||||||
|
wd_start(priv->timeout, I2C_TIMEOUT, i2c_timeout, 1, (uint32_t)priv);
|
||||||
|
|
||||||
while (priv->state != I2C_STATE_DONE)
|
while (priv->state != I2C_STATE_DONE)
|
||||||
{
|
{
|
||||||
sem_wait (&priv->wait);
|
sem_wait(&priv->wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_cancel (priv->timeout);
|
wd_cancel(priv->timeout);
|
||||||
|
|
||||||
ret = count - priv->nmsg;
|
ret = count - priv->nmsg;
|
||||||
|
|
||||||
irqrestore (flags);
|
irqrestore(flags);
|
||||||
sem_post (&priv->mutex);
|
sem_post(&priv->mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -365,16 +375,16 @@ static int i2c_transfer (FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs,
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static int i2c_interrupt (int irq, FAR void *context)
|
static int i2c_interrupt(int irq, FAR void *context)
|
||||||
{
|
{
|
||||||
if (irq == LPC31_IRQ_I2C0)
|
if (irq == LPC31_IRQ_I2C0)
|
||||||
{
|
{
|
||||||
i2c_progress (&i2cdevices[0]);
|
i2c_progress(&i2cdevices[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irq == LPC31_IRQ_I2C1)
|
if (irq == LPC31_IRQ_I2C1)
|
||||||
{
|
{
|
||||||
i2c_progress (&i2cdevices[1]);
|
i2c_progress(&i2cdevices[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -388,23 +398,25 @@ static int i2c_interrupt (int irq, FAR void *context)
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
static void i2c_progress(struct lpc31_i2cdev_s *priv)
|
||||||
{
|
{
|
||||||
struct i2c_msg_s *msg;
|
struct i2c_msg_s *msg;
|
||||||
uint32_t stat, ctrl;
|
uint32_t stat, ctrl;
|
||||||
|
|
||||||
stat = getreg32 (priv->base + LPC31_I2C_STAT_OFFSET);
|
stat = getreg32(priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
|
|
||||||
/* Were there arbitration problems? */
|
/* Were there arbitration problems? */
|
||||||
|
|
||||||
if ((stat & I2C_STAT_AFI) != 0)
|
if ((stat & I2C_STAT_AFI) != 0)
|
||||||
{
|
{
|
||||||
/* Perform a soft reset */
|
/* Perform a soft reset */
|
||||||
i2c_reset (priv);
|
|
||||||
|
i2c_reset(priv);
|
||||||
|
|
||||||
/* FIXME: automatic retry? */
|
/* FIXME: automatic retry? */
|
||||||
|
|
||||||
priv->state = I2C_STATE_DONE;
|
priv->state = I2C_STATE_DONE;
|
||||||
sem_post (&priv->wait);
|
sem_post(&priv->wait);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +445,7 @@ static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
|||||||
priv->hdrcnt = 1;
|
priv->hdrcnt = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
putreg32 (ctrl, priv->base + LPC31_I2C_CTRL_OFFSET);
|
putreg32(ctrl, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
|
|
||||||
priv->state = I2C_STATE_HEADER;
|
priv->state = I2C_STATE_HEADER;
|
||||||
priv->wrcnt = 0;
|
priv->wrcnt = 0;
|
||||||
@@ -445,13 +457,14 @@ static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
|||||||
putreg32(priv->header[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
putreg32(priv->header[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
||||||
priv->wrcnt++;
|
priv->wrcnt++;
|
||||||
|
|
||||||
stat = getreg32 (priv->base + LPC31_I2C_STAT_OFFSET);
|
stat = getreg32(priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->wrcnt < priv->hdrcnt)
|
if (priv->wrcnt < priv->hdrcnt)
|
||||||
{
|
{
|
||||||
/* Enable Tx FIFO Not Full Interrupt */
|
/* Enable Tx FIFO Not Full Interrupt */
|
||||||
putreg32 (ctrl | I2C_CTRL_TFFIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
|
||||||
|
putreg32(ctrl | I2C_CTRL_TFFIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,32 +481,40 @@ static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
|||||||
msg->buffer[priv->rdcnt] = getreg32 (priv->base + LPC31_I2C_RX_OFFSET);
|
msg->buffer[priv->rdcnt] = getreg32 (priv->base + LPC31_I2C_RX_OFFSET);
|
||||||
priv->rdcnt++;
|
priv->rdcnt++;
|
||||||
|
|
||||||
stat = getreg32 (priv->base + LPC31_I2C_STAT_OFFSET);
|
stat = getreg32(priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->rdcnt < msg->length)
|
if (priv->rdcnt < msg->length)
|
||||||
{
|
{
|
||||||
/* Not all data received, fill the Tx FIFO with more dummies */
|
/* Not all data received, fill the Tx FIFO with more dummies */
|
||||||
|
|
||||||
while ((priv->wrcnt != msg->length) && (stat & I2C_STAT_TFF) == 0)
|
while ((priv->wrcnt != msg->length) && (stat & I2C_STAT_TFF) == 0)
|
||||||
{
|
{
|
||||||
if ((priv->wrcnt + 1) == msg->length && priv->nmsg == 1)
|
if ((priv->wrcnt + 1) == msg->length && priv->nmsg == 1)
|
||||||
putreg32 (I2C_TX_STOP, priv->base + LPC31_I2C_TX_OFFSET);
|
{
|
||||||
|
putreg32(I2C_TX_STOP, priv->base + LPC31_I2C_TX_OFFSET);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
putreg32 (0, priv->base + LPC31_I2C_TX_OFFSET);
|
{
|
||||||
|
putreg32(0, priv->base + LPC31_I2C_TX_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
priv->wrcnt++;
|
priv->wrcnt++;
|
||||||
|
|
||||||
stat = getreg32 (priv->base + LPC31_I2C_STAT_OFFSET);
|
stat = getreg32(priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->wrcnt < msg->length)
|
if (priv->wrcnt < msg->length)
|
||||||
{
|
{
|
||||||
/* Enable Tx FIFO not full and Rx Fifo Avail Interrupts */
|
/* Enable Tx FIFO not full and Rx Fifo Avail Interrupts */
|
||||||
putreg32 (ctrl | I2C_CTRL_TFFIE | I2C_CTRL_RFDAIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
|
||||||
|
putreg32(ctrl | I2C_CTRL_TFFIE | I2C_CTRL_RFDAIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Enable Rx Fifo Avail Interrupts */
|
/* Enable Rx Fifo Avail Interrupts */
|
||||||
putreg32 (ctrl | I2C_CTRL_RFDAIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
|
||||||
|
putreg32(ctrl | I2C_CTRL_RFDAIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -503,32 +524,40 @@ static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
|||||||
while ((priv->wrcnt != msg->length) && (stat & I2C_STAT_TFF) == 0)
|
while ((priv->wrcnt != msg->length) && (stat & I2C_STAT_TFF) == 0)
|
||||||
{
|
{
|
||||||
if ((priv->wrcnt + 1) == msg->length && priv->nmsg == 1)
|
if ((priv->wrcnt + 1) == msg->length && priv->nmsg == 1)
|
||||||
putreg32 (I2C_TX_STOP | msg->buffer[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
{
|
||||||
|
putreg32(I2C_TX_STOP | msg->buffer[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
putreg32 (msg->buffer[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
{
|
||||||
|
putreg32(msg->buffer[priv->wrcnt], priv->base + LPC31_I2C_TX_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
priv->wrcnt++;
|
priv->wrcnt++;
|
||||||
|
|
||||||
stat = getreg32 (priv->base + LPC31_I2C_STAT_OFFSET);
|
stat = getreg32(priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->wrcnt < msg->length)
|
if (priv->wrcnt < msg->length)
|
||||||
{
|
{
|
||||||
/* Enable Tx Fifo not full Interrupt */
|
/* Enable Tx Fifo not full Interrupt */
|
||||||
putreg32 (ctrl | I2C_CTRL_TFFIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
|
||||||
|
putreg32(ctrl | I2C_CTRL_TFFIE, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transfer completed, move onto the next one */
|
/* Transfer completed, move onto the next one */
|
||||||
|
|
||||||
priv->state = I2C_STATE_START;
|
priv->state = I2C_STATE_START;
|
||||||
|
|
||||||
if (--priv->nmsg == 0)
|
if (--priv->nmsg == 0)
|
||||||
{
|
{
|
||||||
/* Final transfer, wait for Transmit Done Interrupt */
|
/* Final transfer, wait for Transmit Done Interrupt */
|
||||||
putreg32 (ctrl, priv->base + LPC31_I2C_CTRL_OFFSET);
|
|
||||||
|
putreg32(ctrl, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->msgs++;
|
priv->msgs++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -537,21 +566,26 @@ static void i2c_progress (struct lpc31_i2cdev_s *priv)
|
|||||||
out:
|
out:
|
||||||
if (stat & I2C_STAT_TDI)
|
if (stat & I2C_STAT_TDI)
|
||||||
{
|
{
|
||||||
putreg32 (I2C_STAT_TDI, priv->base + LPC31_I2C_STAT_OFFSET);
|
putreg32(I2C_STAT_TDI, priv->base + LPC31_I2C_STAT_OFFSET);
|
||||||
|
|
||||||
/* You'd expect the NAI bit to be set when no acknowledge was
|
/* You'd expect the NAI bit to be set when no acknowledge was
|
||||||
* received - but it gets cleared whenever a write it done to
|
* received - but it gets cleared whenever a write it done to
|
||||||
* the TXFIFO - so we've gone and cleared it while priming the
|
* the TXFIFO - so we've gone and cleared it while priming the
|
||||||
* rest of the transfer! */
|
* rest of the transfer!
|
||||||
if ((stat = getreg32 (priv->base + LPC31_I2C_TXFL_OFFSET)) != 0)
|
*/
|
||||||
|
|
||||||
|
if ((stat = getreg32(priv->base + LPC31_I2C_TXFL_OFFSET)) != 0)
|
||||||
{
|
{
|
||||||
if (priv->nmsg == 0)
|
if (priv->nmsg == 0)
|
||||||
|
{
|
||||||
priv->nmsg++;
|
priv->nmsg++;
|
||||||
i2c_reset (priv);
|
}
|
||||||
|
|
||||||
|
i2c_reset(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->state = I2C_STATE_DONE;
|
priv->state = I2C_STATE_DONE;
|
||||||
sem_post (&priv->wait);
|
sem_post(&priv->wait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +597,7 @@ out:
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static void i2c_timeout (int argc, uint32_t arg, ...)
|
static void i2c_timeout(int argc, uint32_t arg, ...)
|
||||||
{
|
{
|
||||||
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) arg;
|
struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *) arg;
|
||||||
|
|
||||||
@@ -572,23 +606,28 @@ static void i2c_timeout (int argc, uint32_t arg, ...)
|
|||||||
if (priv->state != I2C_STATE_DONE)
|
if (priv->state != I2C_STATE_DONE)
|
||||||
{
|
{
|
||||||
/* If there's data remaining in the TXFIFO, then ensure at least
|
/* If there's data remaining in the TXFIFO, then ensure at least
|
||||||
* one transfer has failed to complete.. */
|
* one transfer has failed to complete.
|
||||||
|
*/
|
||||||
|
|
||||||
if (getreg32 (priv->base + LPC31_I2C_TXFL_OFFSET) != 0)
|
if (getreg32(priv->base + LPC31_I2C_TXFL_OFFSET) != 0)
|
||||||
{
|
{
|
||||||
if (priv->nmsg == 0)
|
if (priv->nmsg == 0)
|
||||||
|
{
|
||||||
priv->nmsg++;
|
priv->nmsg++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Soft reset the USB controller */
|
/* Soft reset the USB controller */
|
||||||
i2c_reset (priv);
|
|
||||||
|
i2c_reset(priv);
|
||||||
|
|
||||||
/* Mark the transfer as finished */
|
/* Mark the transfer as finished */
|
||||||
|
|
||||||
priv->state = I2C_STATE_DONE;
|
priv->state = I2C_STATE_DONE;
|
||||||
sem_post (&priv->wait);
|
sem_post(&priv->wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore (flags);
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -598,11 +637,12 @@ static void i2c_timeout (int argc, uint32_t arg, ...)
|
|||||||
* Perform a soft reset of the I2C controller
|
* Perform a soft reset of the I2C controller
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static void i2c_reset (struct lpc31_i2cdev_s *priv)
|
static void i2c_reset(struct lpc31_i2cdev_s *priv)
|
||||||
{
|
{
|
||||||
putreg32 (I2C_CTRL_RESET, priv->base + LPC31_I2C_CTRL_OFFSET);
|
putreg32(I2C_CTRL_RESET, priv->base + LPC31_I2C_CTRL_OFFSET);
|
||||||
|
|
||||||
/* Wait for Reset to complete */
|
/* Wait for Reset to complete */
|
||||||
while ((getreg32 (priv->base + LPC31_I2C_CTRL_OFFSET) & I2C_CTRL_RESET) != 0)
|
|
||||||
|
while ((getreg32(priv->base + LPC31_I2C_CTRL_OFFSET) & I2C_CTRL_RESET) != 0)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ static inline int sam_configinterrupt(uintptr_t base, uint32_t pin,
|
|||||||
* 11 Reserved
|
* 11 Reserved
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gpio_pinset_t edges = cfgset & GPIO_INT_MASK;
|
gpio_pinset_t edges = (cfgset & GPIO_INT_MASK);
|
||||||
|
|
||||||
if (edges == GPIO_INT_RISING)
|
if (edges == GPIO_INT_RISING)
|
||||||
{
|
{
|
||||||
@@ -398,16 +398,16 @@ static inline int sam_configperiph(uintptr_t base, uint32_t pin,
|
|||||||
* 11 Reserved
|
* 11 Reserved
|
||||||
*/
|
*/
|
||||||
|
|
||||||
edges = cfgset & GPIO_INT_MASK;
|
edges = (cfgset & GPIO_INT_MASK);
|
||||||
if (edges == GPIO_INT_RISING)
|
if (edges == GPIO_INT_RISING)
|
||||||
{
|
{
|
||||||
/* Rising only.. disable interrrupts on the falling edge */
|
/* Rising only.. disable interrupts on the falling edge */
|
||||||
|
|
||||||
putreg32(pin, base + SAM_GPIO_IMR0S_OFFSET);
|
putreg32(pin, base + SAM_GPIO_IMR0S_OFFSET);
|
||||||
}
|
}
|
||||||
else if (edges == GPIO_INT_FALLING)
|
else if (edges == GPIO_INT_FALLING)
|
||||||
{
|
{
|
||||||
/* Falling only.. disable interrrupts on the rising edge */
|
/* Falling only.. disable interrupts on the rising edge */
|
||||||
|
|
||||||
putreg32(pin, base + SAM_GPIO_IMR1S_OFFSET);
|
putreg32(pin, base + SAM_GPIO_IMR1S_OFFSET);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,12 +109,10 @@ int stm32_dumpgpio(uint32_t pinset, const char *msg)
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
unsigned int pin;
|
|
||||||
|
|
||||||
/* Get the base address associated with the GPIO port */
|
/* Get the base address associated with the GPIO port */
|
||||||
|
|
||||||
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
||||||
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
|
|
||||||
base = g_gpiobase[port];
|
base = g_gpiobase[port];
|
||||||
|
|
||||||
/* The following requires exclusive access to the GPIO registers */
|
/* The following requires exclusive access to the GPIO registers */
|
||||||
|
|||||||
@@ -753,8 +753,10 @@ static int up_interrupt(int irq, void *context)
|
|||||||
|
|
||||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
|
||||||
struct inode *inode = filep->f_inode;
|
struct inode *inode = filep->f_inode;
|
||||||
struct uart_dev_s *dev = inode->i_private;
|
struct uart_dev_s *dev = inode->i_private;
|
||||||
|
#endif
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
FAR uint8_t *ptr;
|
FAR uint8_t *ptr;
|
||||||
size_t mark;
|
size_t mark;
|
||||||
int i, j;
|
#if 0
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The AVR uses a push-down stack: the stack grows toward lower addresses
|
/* The AVR uses a push-down stack: the stack grows toward lower addresses
|
||||||
* in memory. We need to start at the lowest address in the stack memory
|
* in memory. We need to start at the lowest address in the stack memory
|
||||||
@@ -121,8 +124,10 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
ch = 'X';
|
ch = 'X';
|
||||||
}
|
}
|
||||||
|
|
||||||
up_putc(ch);
|
up_putc(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
up_putc('\n');
|
up_putc('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ static void emac_receive(FAR struct emac_driver_s *priv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (); /* While there are more packets to be processed */
|
while (true); /* While there are more packets to be processed */
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ static int up_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct up_dev_s *priv;
|
FAR struct up_dev_s *priv;
|
||||||
int ret = OK;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ivdbg("setup: %d\n", (int)setup);
|
ivdbg("setup: %d\n", (int)setup);
|
||||||
|
|||||||
@@ -302,7 +302,6 @@ static uint8_t z16f_disableuartirq(struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state)
|
static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state)
|
||||||
{
|
{
|
||||||
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
|
|
||||||
irqstate_t flags = irqsave();
|
irqstate_t flags = irqsave();
|
||||||
|
|
||||||
z16f_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
z16f_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
||||||
@@ -400,7 +399,6 @@ static int z16f_setup(struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void z16f_shutdown(struct uart_dev_s *dev)
|
static void z16f_shutdown(struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
|
|
||||||
(void)z16f_disableuartirq(dev);
|
(void)z16f_disableuartirq(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,6 @@ static void i2c_stop(void)
|
|||||||
static int i2c_sendaddr(struct ez80_i2cdev_s *priv, uint8_t readbit)
|
static int i2c_sendaddr(struct ez80_i2cdev_s *priv, uint8_t readbit)
|
||||||
{
|
{
|
||||||
uint8_t sr;
|
uint8_t sr;
|
||||||
int ret = OK;
|
|
||||||
|
|
||||||
/* Wait for the IFLG bit to transition to 1. At this point, we should
|
/* Wait for the IFLG bit to transition to 1. At this point, we should
|
||||||
* have status == 8 meaning that the start bit was sent successfully.
|
* have status == 8 meaning that the start bit was sent successfully.
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ static uint8_t spi_waitspif(void)
|
|||||||
* Name: spi_transfer
|
* Name: spi_transfer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send one byte on SPI, return th response
|
* Send one byte on SPI, return the response
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ch - the byte to send
|
* ch - the byte to send
|
||||||
@@ -361,7 +361,7 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
|||||||
FAR const uint8_t *ptr = (FAR const uint8_t*)buffer;
|
FAR const uint8_t *ptr = (FAR const uint8_t*)buffer;
|
||||||
uint8_t response;
|
uint8_t response;
|
||||||
|
|
||||||
/* Loop while thre are bytes remaining to be sent */
|
/* Loop while there are bytes remaining to be sent */
|
||||||
|
|
||||||
while (buflen-- > 0)
|
while (buflen-- > 0)
|
||||||
{
|
{
|
||||||
@@ -392,7 +392,6 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
|||||||
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
|
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR uint8_t *ptr = (FAR uint8_t*)buffer;
|
FAR uint8_t *ptr = (FAR uint8_t*)buffer;
|
||||||
uint8_t response;
|
|
||||||
|
|
||||||
/* Loop while thre are bytes remaining to be sent */
|
/* Loop while thre are bytes remaining to be sent */
|
||||||
|
|
||||||
|
|||||||
@@ -438,7 +438,6 @@ int up_addrenv_destroy(task_addrenv_t addrenv)
|
|||||||
int up_addrenv_assign(task_addrenv_t addrenv, FAR struct tcb_s *tcb)
|
int up_addrenv_assign(task_addrenv_t addrenv, FAR struct tcb_s *tcb)
|
||||||
{
|
{
|
||||||
FAR struct z180_cbr_s *cbr = (FAR struct z180_cbr_s *)addrenv;
|
FAR struct z180_cbr_s *cbr = (FAR struct z180_cbr_s *)addrenv;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Make sure that there is no address environment in place on this TCB */
|
/* Make sure that there is no address environment in place on this TCB */
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,6 @@ static uint8_t z8_disableuartirq(FAR struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void z8_restoreuartirq(FAR struct uart_dev_s *dev, uint8_t state)
|
static void z8_restoreuartirq(FAR struct uart_dev_s *dev, uint8_t state)
|
||||||
{
|
{
|
||||||
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
|
|
||||||
irqstate_t flags = irqsave();
|
irqstate_t flags = irqsave();
|
||||||
|
|
||||||
z8_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
z8_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
||||||
@@ -322,7 +321,6 @@ static void z8_consoleput(uint8_t ch)
|
|||||||
|
|
||||||
void z8_uartconfigure(void)
|
void z8_uartconfigure(void)
|
||||||
{
|
{
|
||||||
uint16_t brg;
|
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
|
|
||||||
/* Configure GPIO Port A pins 4 & 5 for alternate function */
|
/* Configure GPIO Port A pins 4 & 5 for alternate function */
|
||||||
@@ -421,7 +419,6 @@ static int z8_setup(FAR struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void z8_shutdown(FAR struct uart_dev_s *dev)
|
static void z8_shutdown(FAR struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
|
|
||||||
(void)z8_disableuartirq(dev);
|
(void)z8_disableuartirq(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,12 +124,13 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
|
|||||||
readlen = loadinfo->buflen - bytesread;
|
readlen = loadinfo->buflen - bytesread;
|
||||||
if (offset + readlen > loadinfo->filelen)
|
if (offset + readlen > loadinfo->filelen)
|
||||||
{
|
{
|
||||||
readlen = loadinfo->filelen - offset;
|
if (loadinfo->filelen <= offset)
|
||||||
if (readlen <= 0)
|
|
||||||
{
|
{
|
||||||
bdbg("At end of file\n");
|
bdbg("At end of file\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readlen = loadinfo->filelen - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read that number of bytes into the array */
|
/* Read that number of bytes into the array */
|
||||||
|
|||||||
@@ -110,12 +110,13 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
|
|||||||
readlen = loadinfo->buflen - bytesread;
|
readlen = loadinfo->buflen - bytesread;
|
||||||
if (offset + readlen > loadinfo->filelen)
|
if (offset + readlen > loadinfo->filelen)
|
||||||
{
|
{
|
||||||
readlen = loadinfo->filelen - offset;
|
if (loadinfo->filelen <= offset)
|
||||||
if (readlen <= 0)
|
|
||||||
{
|
{
|
||||||
bdbg("At end of file\n");
|
bdbg("At end of file\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readlen = loadinfo->filelen - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read that number of bytes into the array */
|
/* Read that number of bytes into the array */
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
|||||||
{
|
{
|
||||||
uint32_t datastart;
|
uint32_t datastart;
|
||||||
uint32_t dataend;
|
uint32_t dataend;
|
||||||
uint32_t bssstart;
|
|
||||||
uint32_t bssend;
|
uint32_t bssend;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -152,7 +151,6 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
|||||||
|
|
||||||
datastart = ntohl(loadinfo->header.h_datastart);
|
datastart = ntohl(loadinfo->header.h_datastart);
|
||||||
dataend = ntohl(loadinfo->header.h_dataend);
|
dataend = ntohl(loadinfo->header.h_dataend);
|
||||||
bssstart = dataend;
|
|
||||||
bssend = ntohl(loadinfo->header.h_bssend);
|
bssend = ntohl(loadinfo->header.h_bssend);
|
||||||
|
|
||||||
/* And put this information into the loadinfo structure as well.
|
/* And put this information into the loadinfo structure as well.
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ static int nsh_spifi_initialize(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Initialize to provide NXFFS on the MTD interface */1G
|
/* Initialize to provide NXFFS on the MTD interface */
|
||||||
|
|
||||||
ret = nxffs_initialize(mtd);
|
ret = nxffs_initialize(mtd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ void stm32_board_clockconfig(void)
|
|||||||
regval |= STM32_RCC_CFGR_PPRE1;
|
regval |= STM32_RCC_CFGR_PPRE1;
|
||||||
putreg32(regval, STM32_RCC_CFGR);
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
/* Set the PLL dividers and multiplers to configure the main PLL */
|
/* Set the PLL dividers and multipliers to configure the main PLL */
|
||||||
|
|
||||||
regval = (STM32_PLLCFG_PLLM | STM32_PLLCFG_PLLN |STM32_PLLCFG_PLLP |
|
regval = (STM32_PLLCFG_PLLM | STM32_PLLCFG_PLLN |STM32_PLLCFG_PLLP |
|
||||||
RCC_PLLCFG_PLLSRC_HSI | STM32_PLLCFG_PLLQ);
|
RCC_PLLCFG_PLLSRC_HSI | STM32_PLLCFG_PLLQ);
|
||||||
|
|||||||
@@ -181,9 +181,6 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR)
|
|
||||||
int ret;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32_SPI3
|
#ifdef CONFIG_STM32_SPI3
|
||||||
FAR struct spi_dev_s *spi;
|
FAR struct spi_dev_s *spi;
|
||||||
FAR struct mtd_dev_s *mtd;
|
FAR struct mtd_dev_s *mtd;
|
||||||
|
|||||||
@@ -125,11 +125,10 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NSH_HAVEMMCSD
|
||||||
FAR struct spi_dev_s *spi;
|
FAR struct spi_dev_s *spi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#ifdef NSH_HAVEMMCSD
|
|
||||||
|
|
||||||
/* Get the SPI port */
|
/* Get the SPI port */
|
||||||
|
|
||||||
message("nsh_archinitialize: Initializing SPI port %d\n",
|
message("nsh_archinitialize: Initializing SPI port %d\n",
|
||||||
|
|||||||
@@ -1365,9 +1365,6 @@ int arch_tcinitialize(int minor)
|
|||||||
{
|
{
|
||||||
FAR struct tc_dev_s *priv;
|
FAR struct tc_dev_s *priv;
|
||||||
char devname[DEV_NAMELEN];
|
char devname[DEV_NAMELEN];
|
||||||
#ifdef CONFIG_TOUCHSCREEN_MULTIPLE
|
|
||||||
irqstate_t flags;
|
|
||||||
#endif
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ivdbg("minor: %d\n", minor);
|
ivdbg("minor: %d\n", minor);
|
||||||
|
|||||||
@@ -195,7 +195,9 @@ void stm32_boardinitialize(void)
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_MMCSD
|
||||||
int ret;
|
int ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configure ADC pins */
|
/* Configure ADC pins */
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
|||||||
sam_gpioirq(IRQ_SW0);
|
sam_gpioirq(IRQ_SW0);
|
||||||
(void)irq_attach(IRQ_SW0, irqhandler);
|
(void)irq_attach(IRQ_SW0, irqhandler);
|
||||||
sam_gpioirqenable(IRQ_SW0);
|
sam_gpioirqenable(IRQ_SW0);
|
||||||
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the old button handler (so that it can be restored) */
|
/* Return the old button handler (so that it can be restored) */
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
|||||||
sam_gpioirq(IRQ_BP2);
|
sam_gpioirq(IRQ_BP2);
|
||||||
(void)irq_attach(IRQ_BP2, irqhandler);
|
(void)irq_attach(IRQ_BP2, irqhandler);
|
||||||
sam_gpioirqenable(IRQ_BP2);
|
sam_gpioirqenable(IRQ_BP2);
|
||||||
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the old button handler (so that it can be restored) */
|
/* Return the old button handler (so that it can be restored) */
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ static inline void up_setrs(bool data)
|
|||||||
{
|
{
|
||||||
regval &= ~(1 << 0); /* Low = control */
|
regval &= ~(1 << 0); /* Low = control */
|
||||||
}
|
}
|
||||||
|
|
||||||
putreg8(regval, M16C_P6);
|
putreg8(regval, M16C_P6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ static inline void up_seten(void)
|
|||||||
/* Set bit 1 of port 6 */
|
/* Set bit 1 of port 6 */
|
||||||
|
|
||||||
register uint8_t regval = getreg8(M16C_P6);
|
register uint8_t regval = getreg8(M16C_P6);
|
||||||
regval = (1 << 1);
|
regval |= (1 << 1);
|
||||||
putreg8(regval, M16C_P6);
|
putreg8(regval, M16C_P6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,13 +82,11 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
#ifdef CONFIG_STM32_LCD
|
||||||
|
|
||||||
/* Initialize the SLCD and register the SLCD device as /dev/slcd */
|
/* Initialize the SLCD and register the SLCD device as /dev/slcd */
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_LCD
|
return stm32_slcd_initialize();
|
||||||
ret = stm32_slcd_initialize();
|
#else
|
||||||
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
xcpt_t oldhandler;
|
||||||
uint32_t pinset;
|
uint32_t pinset;
|
||||||
|
|
||||||
/* Map the button id to the GPIO bit set. */
|
/* Map the button id to the GPIO bit set. */
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ static void putconsole(char ch)
|
|||||||
{
|
{
|
||||||
(void)putc(ch, g_logstream);
|
(void)putc(ch, g_logstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)putchar(ch);
|
(void)putchar(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +140,7 @@ static void printconsole(const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
(void)vfprintf(g_logstream, fmt, ap);
|
(void)vfprintf(g_logstream, fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)vprintf(fmt, ap);
|
(void)vprintf(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
@@ -435,7 +437,7 @@ static void close_tty(void)
|
|||||||
(void)close(g_fd);
|
(void)close(g_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_logstream >= 0)
|
if (g_logstream)
|
||||||
{
|
{
|
||||||
(void)fclose(g_logstream);
|
(void)fclose(g_logstream);
|
||||||
}
|
}
|
||||||
@@ -717,7 +719,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
{
|
{
|
||||||
sendfile(g_fd, filename, 0);
|
sendfile(g_fd, filename, 0);
|
||||||
}
|
}
|
||||||
else if (ch1 == 'v' || ch1 == 'v')
|
else if (ch1 == 'v' || ch1 == 'V')
|
||||||
{
|
{
|
||||||
sendfile(g_fd, filename, 1);
|
sendfile(g_fd, filename, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ static int adc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct adc_dev_s *dev = inode->i_private;
|
FAR struct adc_dev_s *dev = inode->i_private;
|
||||||
int ret = OK;
|
int ret;
|
||||||
|
|
||||||
ret = dev->ad_ops->ao_ioctl(dev, cmd, arg);
|
ret = dev->ad_ops->ao_ioctl(dev, cmd, arg);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
+29
-15
@@ -175,11 +175,15 @@ static uint8_t getspsreg(uint16_t sps)
|
|||||||
0x03,0x13,0x23,0x33,0x43,0x53,0x63,0x72,0x82,0x92,0xa1,0xb0,0xc0,0xd0,0xe0,0xf0,
|
0x03,0x13,0x23,0x33,0x43,0x53,0x63,0x72,0x82,0x92,0xa1,0xb0,0xc0,0xd0,0xe0,0xf0,
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
{
|
{
|
||||||
if (sps<sps_tab[i])
|
if (sps<sps_tab[i])
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sps_reg[i];
|
return sps_reg[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,8 +191,8 @@ static uint8_t getspsreg(uint16_t sps)
|
|||||||
* ad_private Functions
|
* ad_private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Reset the ADC device. Called early to initialize the hardware. This
|
/* Reset the ADC device. Called early to initialize the hardware. This
|
||||||
* is called, before ao_setup() and on error conditions.
|
* is called, before ao_setup() and on error conditions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void adc_reset(FAR struct adc_dev_s *dev)
|
static void adc_reset(FAR struct adc_dev_s *dev)
|
||||||
{
|
{
|
||||||
@@ -200,46 +204,53 @@ static void adc_reset(FAR struct adc_dev_s *dev)
|
|||||||
SPI_SETFREQUENCY(spi, CONFIG_ADS1255_FREQUENCY);
|
SPI_SETFREQUENCY(spi, CONFIG_ADS1255_FREQUENCY);
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
SPI_SELECT(spi, priv->devno, true);
|
SPI_SELECT(spi, priv->devno, true);
|
||||||
SPI_SEND(spi,ADS125X_WREG+0x03); //WRITE SPS REG
|
SPI_SEND(spi,ADS125X_WREG+0x03); /* WRITE SPS REG */
|
||||||
SPI_SEND(spi,0x00); //count=1
|
SPI_SEND(spi,0x00); /* count=1 */
|
||||||
SPI_SEND(spi,0x63);
|
SPI_SEND(spi,0x63);
|
||||||
SPI_SELECT(spi, priv->devno, false);
|
SPI_SELECT(spi, priv->devno, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure the ADC. This method is called the first time that the ADC
|
/* Configure the ADC. This method is called the first time that the ADC
|
||||||
* device is opened. This will occur when the port is first opened.
|
* device is opened. This will occur when the port is first opened.
|
||||||
* This setup includes configuring and attaching ADC interrupts. Interrupts
|
* This setup includes configuring and attaching ADC interrupts. Interrupts
|
||||||
* are all disabled upon return.
|
* are all disabled upon return.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int adc_setup(FAR struct adc_dev_s *dev)
|
static int adc_setup(FAR struct adc_dev_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv;
|
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv;
|
||||||
FAR struct spi_dev_s *spi = priv->spi;
|
FAR struct spi_dev_s *spi = priv->spi;
|
||||||
int ret = irq_attach(priv->irq, adc_interrupt);
|
int ret = irq_attach(priv->irq, adc_interrupt);
|
||||||
|
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
SPI_SELECT(spi, priv->devno, true);
|
SPI_SELECT(spi, priv->devno, true);
|
||||||
SPI_SEND(spi,ADS125X_WREG); //WRITE REG from 0
|
SPI_SEND(spi,ADS125X_WREG); /* WRITE REG from 0 */
|
||||||
SPI_SEND(spi,0x03); //count=4+1
|
SPI_SEND(spi,0x03); /* count=4+1 */
|
||||||
if (priv->buf)
|
if (priv->buf)
|
||||||
SPI_SEND(spi,ADS125X_BUFON); //REG0 STATUS BUFFER ON
|
{
|
||||||
|
SPI_SEND(spi,ADS125X_BUFON); /* REG0 STATUS BUFFER ON */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SPI_SEND(spi,ADS125X_BUFOFF);
|
SPI_SEND(spi,ADS125X_BUFOFF);
|
||||||
|
}
|
||||||
|
|
||||||
SPI_SEND(spi,priv->mux[0]);
|
SPI_SEND(spi,priv->mux[0]);
|
||||||
SPI_SEND(spi,priv->pga); //REG2 ADCON PGA=2
|
SPI_SEND(spi,priv->pga); /* REG2 ADCON PGA=2 */
|
||||||
SPI_SEND(spi,getspsreg(priv->sps));
|
SPI_SEND(spi,getspsreg(priv->sps));
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
SPI_SEND(spi,ADS125X_SELFCAL);
|
SPI_SEND(spi,ADS125X_SELFCAL);
|
||||||
SPI_SELECT(spi, priv->devno, false);
|
SPI_SELECT(spi, priv->devno, false);
|
||||||
up_enable_irq(priv->irq);
|
up_enable_irq(priv->irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable the ADC. This method is called when the ADC device is closed.
|
/* Disable the ADC. This method is called when the ADC device is closed.
|
||||||
* This method reverses the operation the setup method.
|
* This method reverses the operation the setup method.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void adc_shutdown(FAR struct adc_dev_s *dev)
|
static void adc_shutdown(FAR struct adc_dev_s *dev)
|
||||||
{
|
{
|
||||||
@@ -254,9 +265,13 @@ static void adc_rxint(FAR struct adc_dev_s *dev, bool enable)
|
|||||||
{
|
{
|
||||||
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv;
|
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv;
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
up_enable_irq(priv->irq);
|
up_enable_irq(priv->irq);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
up_disable_irq(priv->irq);
|
up_disable_irq(priv->irq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All ioctl calls will be routed through this method */
|
/* All ioctl calls will be routed through this method */
|
||||||
@@ -269,7 +284,6 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
static int adc_interrupt(int irq, void *context)
|
static int adc_interrupt(int irq, void *context)
|
||||||
{
|
{
|
||||||
uint32_t regval;
|
|
||||||
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv;
|
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv;
|
||||||
FAR struct spi_dev_s *spi = priv->spi;
|
FAR struct spi_dev_s *spi = priv->spi;
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
|
|||||||
+34
-16
@@ -68,7 +68,6 @@
|
|||||||
#define HALF_SECOND_MSEC 500
|
#define HALF_SECOND_MSEC 500
|
||||||
#define HALF_SECOND_USEC 500000L
|
#define HALF_SECOND_USEC 500000L
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -155,11 +154,14 @@ static int dac_open(FAR struct file *filep)
|
|||||||
|
|
||||||
dev->ad_ocount = tmp;
|
dev->ad_ocount = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_post(&dev->ad_closesem);
|
sem_post(&dev->ad_closesem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +222,7 @@ static int dac_close(FAR struct file *filep)
|
|||||||
sem_post(&dev->ad_closesem);
|
sem_post(&dev->ad_closesem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +263,7 @@ static int dac_xmit(FAR struct dac_dev_s *dev)
|
|||||||
|
|
||||||
enable = (ret == OK ? true : false);
|
enable = (ret == OK ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->ad_ops->ao_txint(dev, enable);
|
dev->ad_ops->ao_txint(dev, enable);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -274,7 +278,7 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
FAR struct dac_dev_s *dev = inode->i_private;
|
FAR struct dac_dev_s *dev = inode->i_private;
|
||||||
FAR struct dac_fifo_s *fifo = &dev->ad_xmit;
|
FAR struct dac_fifo_s *fifo = &dev->ad_xmit;
|
||||||
FAR struct dac_msg_s *msg;
|
FAR struct dac_msg_s *msg;
|
||||||
bool empty = false;
|
bool empty;
|
||||||
ssize_t nsent = 0;
|
ssize_t nsent = 0;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int nexttail;
|
int nexttail;
|
||||||
@@ -295,18 +299,30 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
* shorter than the minimum.
|
* shorter than the minimum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (buflen % 5 ==0 )
|
if (buflen % 5 == 0 )
|
||||||
msglen=5;
|
{
|
||||||
else if (buflen % 4 ==0 )
|
msglen = 5;
|
||||||
msglen=4;
|
}
|
||||||
else if (buflen % 3 ==0 )
|
else if (buflen % 4 == 0)
|
||||||
msglen=3;
|
{
|
||||||
else if (buflen % 2 ==0 )
|
msglen = 4;
|
||||||
msglen=2;
|
}
|
||||||
|
else if (buflen % 3 == 0)
|
||||||
|
{
|
||||||
|
msglen = 3;
|
||||||
|
}
|
||||||
|
else if (buflen % 2 == 0)
|
||||||
|
{
|
||||||
|
msglen = 2;
|
||||||
|
}
|
||||||
else if (buflen == 1)
|
else if (buflen == 1)
|
||||||
msglen=1;
|
{
|
||||||
|
msglen = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
msglen=5;
|
{
|
||||||
|
msglen = 5;
|
||||||
|
}
|
||||||
|
|
||||||
while ((buflen - nsent) >= msglen )
|
while ((buflen - nsent) >= msglen )
|
||||||
{
|
{
|
||||||
@@ -336,6 +352,7 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
{
|
{
|
||||||
ret = nsent;
|
ret = nsent;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto return_with_irqdisabled;
|
goto return_with_irqdisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,12 +387,12 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
* CAN message at the tail of the FIFO.
|
* CAN message at the tail of the FIFO.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (msglen==5)
|
if (msglen == 5)
|
||||||
{
|
{
|
||||||
msg = (FAR struct dac_msg_s *)&buffer[nsent];
|
msg = (FAR struct dac_msg_s *)&buffer[nsent];
|
||||||
memcpy(&fifo->af_buffer[fifo->af_tail], msg, msglen);
|
memcpy(&fifo->af_buffer[fifo->af_tail], msg, msglen);
|
||||||
}
|
}
|
||||||
else if(msglen == 4)
|
else if (msglen == 4)
|
||||||
{
|
{
|
||||||
fifo->af_buffer[fifo->af_tail].am_channel=buffer[nsent];
|
fifo->af_buffer[fifo->af_tail].am_channel=buffer[nsent];
|
||||||
fifo->af_buffer[fifo->af_tail].am_data=*(uint32_t *)&buffer[nsent];
|
fifo->af_buffer[fifo->af_tail].am_data=*(uint32_t *)&buffer[nsent];
|
||||||
@@ -399,6 +416,7 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
fifo->af_buffer[fifo->af_tail].am_data=buffer[nsent];
|
fifo->af_buffer[fifo->af_tail].am_data=buffer[nsent];
|
||||||
fifo->af_buffer[fifo->af_tail].am_data<<=24;
|
fifo->af_buffer[fifo->af_tail].am_data<<=24;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increment the tail of the circular buffer */
|
/* Increment the tail of the circular buffer */
|
||||||
|
|
||||||
fifo->af_tail = nexttail;
|
fifo->af_tail = nexttail;
|
||||||
@@ -434,7 +452,7 @@ static int dac_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct dac_dev_s *dev = inode->i_private;
|
FAR struct dac_dev_s *dev = inode->i_private;
|
||||||
int ret = OK;
|
int ret;
|
||||||
|
|
||||||
ret = dev->ad_ops->ao_ioctl(dev, cmd, arg);
|
ret = dev->ad_ops->ao_ioctl(dev, cmd, arg);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -480,6 +498,7 @@ int dac_txdone(FAR struct dac_dev_s *dev)
|
|||||||
ret = sem_post(&dev->ad_xmit.af_sem);
|
ret = sem_post(&dev->ad_xmit.af_sem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,4 +515,3 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev)
|
|||||||
|
|
||||||
return register_driver(path, &dac_fops, 0555, dev);
|
return register_driver(path, &dac_fops, 0555, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1256,8 +1256,11 @@ static void *vs1053_workerthread(pthread_addr_t pvarg)
|
|||||||
FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) pvarg;
|
FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) pvarg;
|
||||||
struct audio_msg_s msg;
|
struct audio_msg_s msg;
|
||||||
FAR struct ap_buffer_s *pBuf;
|
FAR struct ap_buffer_s *pBuf;
|
||||||
int size, prio;
|
int size;
|
||||||
|
int prio;
|
||||||
|
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
|
||||||
uint16_t reg;
|
uint16_t reg;
|
||||||
|
#endif
|
||||||
uint8_t timeout;
|
uint8_t timeout;
|
||||||
|
|
||||||
auddbg("Entry\n");
|
auddbg("Entry\n");
|
||||||
@@ -1454,7 +1457,7 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
|
|||||||
|
|
||||||
/* Pop the first enqueued buffer */
|
/* Pop the first enqueued buffer */
|
||||||
|
|
||||||
if ((ret = (sem_wait(&dev->apbq_sem)) == OK))
|
if ((ret = sem_wait(&dev->apbq_sem)) == OK)
|
||||||
{
|
{
|
||||||
dev->pBuf = (FAR struct ap_buffer_s *) dq_remfirst(&dev->apbq);
|
dev->pBuf = (FAR struct ap_buffer_s *) dq_remfirst(&dev->apbq);
|
||||||
apb_reference(dev->pBuf); /* Add our buffer reference */
|
apb_reference(dev->pBuf); /* Add our buffer reference */
|
||||||
|
|||||||
@@ -1082,7 +1082,7 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct ads7843e_dev_s *priv;
|
FAR struct ads7843e_dev_s *priv;
|
||||||
int ret = OK;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ivdbg("setup: %d\n", (int)setup);
|
ivdbg("setup: %d\n", (int)setup);
|
||||||
|
|||||||
@@ -1063,9 +1063,7 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct max11802_dev_s *priv;
|
FAR struct max11802_dev_s *priv;
|
||||||
pollevent_t eventset;
|
int ret;
|
||||||
int ndx;
|
|
||||||
int ret = OK;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ivdbg("setup: %d\n", (int)setup);
|
ivdbg("setup: %d\n", (int)setup);
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ int stmpe811_gpioattach(STMPE811_HANDLE handle, uint8_t pinconfig,
|
|||||||
{
|
{
|
||||||
/* Enable interrupts for this GPIO */
|
/* Enable interrupts for this GPIO */
|
||||||
|
|
||||||
regval &= ~GPIO_PIN(pin);
|
regval |= GPIO_PIN(pin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -389,6 +389,7 @@ int stmpe811_gpioattach(STMPE811_HANDLE handle, uint8_t pinconfig,
|
|||||||
|
|
||||||
regval &= ~GPIO_PIN(pin);
|
regval &= ~GPIO_PIN(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
stmpe811_putreg8(priv, STMPE811_GPIO_EN, regval);
|
stmpe811_putreg8(priv, STMPE811_GPIO_EN, regval);
|
||||||
|
|
||||||
sem_post(&priv->exclsem);
|
sem_post(&priv->exclsem);
|
||||||
|
|||||||
@@ -769,7 +769,7 @@ static void stmpe811_timeout(int argc, uint32_t arg1, ...)
|
|||||||
|
|
||||||
/* Are we still stuck in the pen down state? */
|
/* Are we still stuck in the pen down state? */
|
||||||
|
|
||||||
if (priv->sample.contact == CONTACT_MOVE ||
|
if (priv->sample.contact == CONTACT_DOWN ||
|
||||||
priv->sample.contact == CONTACT_MOVE)
|
priv->sample.contact == CONTACT_MOVE)
|
||||||
{
|
{
|
||||||
/* Yes... is the worker thread available? If not, then apparently
|
/* Yes... is the worker thread available? If not, then apparently
|
||||||
@@ -1127,7 +1127,7 @@ void stmpe811_tscworker(FAR struct stmpe811_dev_s *priv, uint8_t intsta)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ignored:
|
ignored:
|
||||||
if (priv->sample.contact == CONTACT_MOVE ||
|
if (priv->sample.contact == CONTACT_DOWN ||
|
||||||
priv->sample.contact == CONTACT_MOVE)
|
priv->sample.contact == CONTACT_MOVE)
|
||||||
{
|
{
|
||||||
(void)wd_start(priv->wdog, STMPE811_PENUP_TICKS, stmpe811_timeout,
|
(void)wd_start(priv->wdog, STMPE811_PENUP_TICKS, stmpe811_timeout,
|
||||||
|
|||||||
@@ -455,7 +455,6 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buff
|
|||||||
FAR struct st7567_dev_s *priv = &g_st7567dev;
|
FAR struct st7567_dev_s *priv = &g_st7567dev;
|
||||||
FAR uint8_t *fbptr;
|
FAR uint8_t *fbptr;
|
||||||
FAR uint8_t *ptr;
|
FAR uint8_t *ptr;
|
||||||
uint8_t devcol;
|
|
||||||
uint8_t fbmask;
|
uint8_t fbmask;
|
||||||
uint8_t page;
|
uint8_t page;
|
||||||
uint8_t usrmask;
|
uint8_t usrmask;
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ static int mtdconfig_open(FAR struct file *filep)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct mtdconfig_struct_s *dev = inode->i_private;
|
FAR struct mtdconfig_struct_s *dev = inode->i_private;
|
||||||
int ret = OK;
|
int ret;
|
||||||
|
|
||||||
/* Get exclusive access to the device */
|
/* Get exclusive access to the device */
|
||||||
|
|
||||||
|
|||||||
+254
-137
File diff suppressed because it is too large
Load Diff
@@ -152,7 +152,7 @@ static int bat_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct battery_dev_s *dev = inode->i_private;
|
FAR struct battery_dev_s *dev = inode->i_private;
|
||||||
int ret = -EINVAL;
|
int ret;
|
||||||
|
|
||||||
/* Inforce mutually exclusive access to the battery driver */
|
/* Inforce mutually exclusive access to the battery driver */
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,12 @@
|
|||||||
#include <nuttx/sercomm/sercomm.h>
|
#include <nuttx/sercomm/sercomm.h>
|
||||||
|
|
||||||
/* stubs to make serial driver happy */
|
/* stubs to make serial driver happy */
|
||||||
|
|
||||||
void sercomm_recvchars(void *a) { }
|
void sercomm_recvchars(void *a) { }
|
||||||
void sercomm_xmitchars(void *a) { }
|
void sercomm_xmitchars(void *a) { }
|
||||||
|
|
||||||
/* Stubs to make memory allocator happy */
|
/* Stubs to make memory allocator happy */
|
||||||
|
|
||||||
void cons_puts(void *foo){}
|
void cons_puts(void *foo){}
|
||||||
void delay_ms(int ms){}
|
void delay_ms(int ms){}
|
||||||
|
|
||||||
@@ -83,11 +85,13 @@ static const struct file_operations g_sercom_console_ops =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static FAR uart_dev_t *readdev = NULL;
|
||||||
|
static struct msgb *recvmsg = NULL;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Helper functions
|
* Helper functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static FAR uart_dev_t *readdev = NULL;
|
|
||||||
static struct msgb *recvmsg = NULL;
|
|
||||||
static void recv_cb(uint8_t dlci, struct msgb *msg)
|
static void recv_cb(uint8_t dlci, struct msgb *msg)
|
||||||
{
|
{
|
||||||
sem_post(&readdev->recvsem);
|
sem_post(&readdev->recvsem);
|
||||||
@@ -105,15 +109,19 @@ static ssize_t sc_console_read(file_t *filep, FAR char *buffer, size_t buflen)
|
|||||||
struct msgb *tmp;
|
struct msgb *tmp;
|
||||||
|
|
||||||
/* Wait until data is received */
|
/* Wait until data is received */
|
||||||
while(recvmsg == NULL) {
|
|
||||||
|
while (recvmsg == NULL)
|
||||||
|
{
|
||||||
sem_wait(&readdev->recvsem);
|
sem_wait(&readdev->recvsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = recvmsg->len > buflen ? buflen : recvmsg->len;
|
len = recvmsg->len > buflen ? buflen : recvmsg->len;
|
||||||
memcpy(buffer, msgb_get(recvmsg, len), len);
|
memcpy(buffer, msgb_get(recvmsg, len), len);
|
||||||
|
|
||||||
if(recvmsg->len == 0) {
|
if (recvmsg->len == 0)
|
||||||
|
{
|
||||||
/* prevent inconsistent msg by first invalidating it, then free it */
|
/* prevent inconsistent msg by first invalidating it, then free it */
|
||||||
|
|
||||||
tmp = recvmsg;
|
tmp = recvmsg;
|
||||||
recvmsg = NULL;
|
recvmsg = NULL;
|
||||||
msgb_free(tmp);
|
msgb_free(tmp);
|
||||||
@@ -123,30 +131,39 @@ static ssize_t sc_console_read(file_t *filep, FAR char *buffer, size_t buflen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: redirect to old Osmocom-BB comm/sercomm_cons.c -> 2 buffers */
|
/* XXX: redirect to old Osmocom-BB comm/sercomm_cons.c -> 2 buffers */
|
||||||
|
|
||||||
extern int sercomm_puts(const char *s);
|
extern int sercomm_puts(const char *s);
|
||||||
|
|
||||||
static ssize_t sc_console_write(file_t *filep, FAR const char *buffer, size_t buflen)
|
static ssize_t sc_console_write(file_t *filep, FAR const char *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
int i, cnt;
|
|
||||||
char dstbuf[32];
|
char dstbuf[32];
|
||||||
|
int cnt;
|
||||||
|
|
||||||
if (buflen >= 31)
|
if (buflen >= 31)
|
||||||
|
{
|
||||||
cnt = 31;
|
cnt = 31;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cnt = buflen;
|
cnt = buflen;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(dstbuf, buffer, cnt);
|
memcpy(dstbuf, buffer, cnt);
|
||||||
dstbuf[cnt] = '\0';
|
dstbuf[cnt] = '\0';
|
||||||
|
|
||||||
/* print part of our buffer */
|
/* print part of our buffer */
|
||||||
|
|
||||||
sercomm_puts(dstbuf);
|
sercomm_puts(dstbuf);
|
||||||
|
|
||||||
/* wait a little bit to get data transfered */
|
/* wait a little bit to get data transfered */
|
||||||
|
|
||||||
up_mdelay(1);
|
up_mdelay(1);
|
||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Forward ioctl to uart driver */
|
/* Forward ioctl to uart driver */
|
||||||
|
|
||||||
static int sc_console_ioctl(struct file *filep, int cmd, unsigned long arg)
|
static int sc_console_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
@@ -160,9 +177,11 @@ static int sc_console_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/* Use sercomm on uart driver, register console driver */
|
/* Use sercomm on uart driver, register console driver */
|
||||||
|
|
||||||
int sercomm_register(FAR const char *path, FAR uart_dev_t *dev)
|
int sercomm_register(FAR const char *path, FAR uart_dev_t *dev)
|
||||||
{
|
{
|
||||||
/* XXX: initialize MODEMUART to be used for sercomm*/
|
/* XXX: initialize MODEMUART to be used for sercomm*/
|
||||||
|
|
||||||
uart_init(SERCOMM_UART_NR, 1);
|
uart_init(SERCOMM_UART_NR, 1);
|
||||||
uart_baudrate(SERCOMM_UART_NR, UART_115200);
|
uart_baudrate(SERCOMM_UART_NR, UART_115200);
|
||||||
readdev = dev;
|
readdev = dev;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user