Update to use 64-bit timer when available
This commit is contained in:
parent
b6dd44bdcd
commit
5ebd84c890
@ -212,8 +212,8 @@ struct efm32_trace_s
|
|||||||
uint32_t i2c_reg_state; /* I2C register I2Cx_STATES */
|
uint32_t i2c_reg_state; /* I2C register I2Cx_STATES */
|
||||||
uint32_t i2c_reg_if; /* I2C register I2Cx_IF */
|
uint32_t i2c_reg_if; /* I2C register I2Cx_IF */
|
||||||
uint32_t count; /* Interrupt count when status change */
|
uint32_t count; /* Interrupt count when status change */
|
||||||
int dcnt; /* Interrupt count when status change */
|
systime_t time; /* First of event or first status */
|
||||||
uint32_t time; /* First of event or first status */
|
int dcnt; /* Interrupt count when status change */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2C Device hardware configuration */
|
/* I2C Device hardware configuration */
|
||||||
@ -260,7 +260,7 @@ struct efm32_i2c_priv_s
|
|||||||
|
|
||||||
#ifdef CONFIG_I2C_TRACE
|
#ifdef CONFIG_I2C_TRACE
|
||||||
int tndx; /* Trace array index */
|
int tndx; /* Trace array index */
|
||||||
uint32_t start_time; /* Time when the trace was started */
|
systime_t start_time; /* Time when the trace was started */
|
||||||
|
|
||||||
/* The actual trace data */
|
/* The actual trace data */
|
||||||
|
|
||||||
@ -650,9 +650,9 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
|
|||||||
#else
|
#else
|
||||||
static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
|
static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
|
|
||||||
/* Get the timeout value */
|
/* Get the timeout value */
|
||||||
|
|
||||||
@ -759,11 +759,11 @@ static void efm32_i2c_traceclear(FAR struct efm32_i2c_priv_s *priv)
|
|||||||
{
|
{
|
||||||
struct efm32_trace_s *trace = &priv->trace[priv->tndx];
|
struct efm32_trace_s *trace = &priv->trace[priv->tndx];
|
||||||
|
|
||||||
trace->i2c_state = I2CSTATE_NONE; /* I2C current state of state machine */
|
trace->i2c_state = I2CSTATE_NONE; /* I2C current state of state machine */
|
||||||
trace->i2c_reg_if = 0; /* I2C I2Cx_IF register */
|
trace->i2c_reg_if = 0; /* I2C I2Cx_IF register */
|
||||||
trace->i2c_reg_state = 0; /* I2C I2Cx_STATES register */
|
trace->i2c_reg_state = 0; /* I2C I2Cx_STATES register */
|
||||||
trace->count = 0; /* Interrupt count when status change */
|
trace->count = 0; /* Interrupt count when status change */
|
||||||
trace->time = 0; /* Time of first status or event */
|
trace->time = 0; /* Time of first status or event */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void efm32_i2c_tracereset(FAR struct efm32_i2c_priv_s *priv)
|
static void efm32_i2c_tracereset(FAR struct efm32_i2c_priv_s *priv)
|
||||||
@ -826,17 +826,18 @@ static void efm32_i2c_tracedump(FAR struct efm32_i2c_priv_s *priv)
|
|||||||
struct efm32_trace_s *trace;
|
struct efm32_trace_s *trace;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Elapsed time: %d\n", clock_systimer() - priv->start_time);
|
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
|
||||||
|
(long)(clock_systimer() - priv->start_time));
|
||||||
|
|
||||||
for (i = 0; i < priv->tndx; i++)
|
for (i = 0; i < priv->tndx; i++)
|
||||||
{
|
{
|
||||||
trace = &priv->trace[i];
|
trace = &priv->trace[i];
|
||||||
syslog(LOG_DEBUG,
|
syslog(LOG_DEBUG,
|
||||||
"%2d. I2Cx_STATE: %08x I2Cx_PENDING: %08x dcnt %3d COUNT: %3d "
|
"%2d. I2Cx_STATE: %08x I2Cx_PENDING: %08x dcnt %3d COUNT: %3d "
|
||||||
"STATE: %s(%2d) TIME: %d\n",
|
"STATE: %s(%2d) TIME: %ld\n",
|
||||||
i + 1, trace->i2c_reg_state, trace->i2c_reg_if, trace->dcnt,
|
i + 1, trace->i2c_reg_state, trace->i2c_reg_if, trace->dcnt,
|
||||||
trace->count, efm32_i2c_state_str(trace->i2c_state),
|
trace->count, efm32_i2c_state_str(trace->i2c_state),
|
||||||
trace->i2c_state, trace->time - priv->start_time);
|
trace->i2c_state, (long)(trace->time - priv->start_time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_I2C_TRACE */
|
#endif /* CONFIG_I2C_TRACE */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/efm32/efm32_usbhost.c
|
* arch/arm/src/efm32/efm32_usbhost.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -1674,8 +1674,8 @@ static int efm32_ctrl_sendsetup(FAR struct efm32_usbhost_s *priv,
|
|||||||
FAR const struct usb_ctrlreq_s *req)
|
FAR const struct usb_ctrlreq_s *req)
|
||||||
{
|
{
|
||||||
FAR struct efm32_chan_s *chan;
|
FAR struct efm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
||||||
@ -1904,8 +1904,8 @@ static ssize_t efm32_in_transfer(FAR struct efm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct efm32_chan_s *chan;
|
FAR struct efm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||||
@ -2163,8 +2163,8 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct efm32_chan_s *chan;
|
FAR struct efm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
size_t xfrlen;
|
size_t xfrlen;
|
||||||
ssize_t xfrd;
|
ssize_t xfrd;
|
||||||
int ret;
|
int ret;
|
||||||
@ -4373,8 +4373,8 @@ static int efm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct efm32_usbhost_s *priv = (FAR struct efm32_usbhost_s *)drvr;
|
FAR struct efm32_usbhost_s *priv = (FAR struct efm32_usbhost_s *)drvr;
|
||||||
FAR struct efm32_ctrlinfo_s *ep0info = (FAR struct efm32_ctrlinfo_s *)ep0;
|
FAR struct efm32_ctrlinfo_s *ep0info = (FAR struct efm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4458,8 +4458,8 @@ static int efm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct efm32_usbhost_s *priv = (FAR struct efm32_usbhost_s *)drvr;
|
FAR struct efm32_usbhost_s *priv = (FAR struct efm32_usbhost_s *)drvr;
|
||||||
FAR struct efm32_ctrlinfo_s *ep0info = (FAR struct efm32_ctrlinfo_s *)ep0;
|
FAR struct efm32_ctrlinfo_s *ep0info = (FAR struct efm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* With extensions, modifications by:
|
* With extensions, modifications by:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2014, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -226,7 +226,7 @@ struct stm32_trace_s
|
|||||||
uint32_t count; /* Interrupt count when status change */
|
uint32_t count; /* Interrupt count when status change */
|
||||||
enum stm32_intstate_e event; /* Last event that occurred with this status */
|
enum stm32_intstate_e event; /* Last event that occurred with this status */
|
||||||
uint32_t parm; /* Parameter associated with the event */
|
uint32_t parm; /* Parameter associated with the event */
|
||||||
uint32_t time; /* First of event or first status */
|
systime_t time; /* First of event or first status */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2C Device hardware configuration */
|
/* I2C Device hardware configuration */
|
||||||
@ -267,7 +267,7 @@ struct stm32_i2c_priv_s
|
|||||||
|
|
||||||
#ifdef CONFIG_I2C_TRACE
|
#ifdef CONFIG_I2C_TRACE
|
||||||
int tndx; /* Trace array index */
|
int tndx; /* Trace array index */
|
||||||
uint32_t start_time; /* Time when the trace was started */
|
systime_t start_time; /* Time when the trace was started */
|
||||||
|
|
||||||
/* The actual trace data */
|
/* The actual trace data */
|
||||||
|
|
||||||
@ -687,9 +687,9 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
#else
|
#else
|
||||||
static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the timeout value */
|
/* Get the timeout value */
|
||||||
@ -725,8 +725,8 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
||||||
|
|
||||||
i2cvdbg("intstate: %d elapsed: %d threshold: %d status: %08x\n",
|
i2cvdbg("intstate: %d elapsed: %ld threshold: %ld status: %08x\n",
|
||||||
priv->intstate, elapsed, timeout, priv->status);
|
priv->intstate, (long)elapsed, (long)timeout, priv->status);
|
||||||
|
|
||||||
/* Set the interrupt state back to IDLE */
|
/* Set the interrupt state back to IDLE */
|
||||||
|
|
||||||
@ -746,9 +746,9 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t cr1;
|
uint32_t cr1;
|
||||||
uint32_t sr1;
|
uint32_t sr1;
|
||||||
|
|
||||||
@ -946,8 +946,8 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
struct stm32_trace_s *trace;
|
struct stm32_trace_s *trace;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Elapsed time: %d\n",
|
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
|
||||||
clock_systimer() - priv->start_time);
|
(long)(clock_systimer() - priv->start_time));
|
||||||
|
|
||||||
for (i = 0; i <= priv->tndx; i++)
|
for (i = 0; i <= priv->tndx; i++)
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* With extensions, modifications by:
|
* With extensions, modifications by:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2014, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Copyright( C) 2014 Patrizio Simona. All rights reserved.
|
* Copyright( C) 2014 Patrizio Simona. All rights reserved.
|
||||||
@ -253,22 +253,22 @@ struct stm32_trace_s
|
|||||||
uint32_t count; /* Interrupt count when status change */
|
uint32_t count; /* Interrupt count when status change */
|
||||||
uint32_t event; /* Last event that occurred with this status */
|
uint32_t event; /* Last event that occurred with this status */
|
||||||
uint32_t parm; /* Parameter associated with the event */
|
uint32_t parm; /* Parameter associated with the event */
|
||||||
uint32_t time; /* First of event or first status */
|
systime_t time; /* First of event or first status */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2C Device hardware configuration */
|
/* I2C Device hardware configuration */
|
||||||
|
|
||||||
struct stm32_i2c_config_s
|
struct stm32_i2c_config_s
|
||||||
{
|
{
|
||||||
uint32_t base; /* I2C base address */
|
uint32_t base; /* I2C base address */
|
||||||
uint32_t clk_bit; /* Clock enable bit */
|
uint32_t clk_bit; /* Clock enable bit */
|
||||||
uint32_t reset_bit; /* Reset bit */
|
uint32_t reset_bit; /* Reset bit */
|
||||||
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
|
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
|
||||||
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
|
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
|
||||||
#ifndef CONFIG_I2C_POLLED
|
#ifndef CONFIG_I2C_POLLED
|
||||||
int (*isr)(int, void *); /* Interrupt handler */
|
int (*isr)(int, void *); /* Interrupt handler */
|
||||||
uint32_t ev_irq; /* Event IRQ */
|
uint32_t ev_irq; /* Event IRQ */
|
||||||
uint32_t er_irq; /* Error IRQ */
|
uint32_t er_irq; /* Error IRQ */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ struct stm32_i2c_priv_s
|
|||||||
|
|
||||||
#ifdef CONFIG_I2C_TRACE
|
#ifdef CONFIG_I2C_TRACE
|
||||||
int tndx; /* Trace array index */
|
int tndx; /* Trace array index */
|
||||||
uint32_t start_time; /* Time when the trace was started */
|
systime_t start_time; /* Time when the trace was started */
|
||||||
|
|
||||||
/* The actual trace data */
|
/* The actual trace data */
|
||||||
|
|
||||||
@ -695,9 +695,9 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
#else
|
#else
|
||||||
static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the timeout value */
|
/* Get the timeout value */
|
||||||
@ -733,8 +733,8 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
||||||
|
|
||||||
i2cvdbg("intstate: %d elapsed: %d threshold: %d status: %08x\n",
|
i2cvdbg("intstate: %d elapsed: %ld threshold: %ld status: %08x\n",
|
||||||
priv->intstate, elapsed, timeout, priv->status);
|
priv->intstate, (long)elapsed, (long)timeout, priv->status);
|
||||||
|
|
||||||
/* Set the interrupt state back to IDLE */
|
/* Set the interrupt state back to IDLE */
|
||||||
|
|
||||||
@ -754,9 +754,9 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t cr1;
|
uint32_t cr1;
|
||||||
uint32_t sr1;
|
uint32_t sr1;
|
||||||
|
|
||||||
@ -954,8 +954,8 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
struct stm32_trace_s *trace;
|
struct stm32_trace_s *trace;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Elapsed time: %d\n",
|
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
|
||||||
clock_systimer() - priv->start_time);
|
(long)(clock_systimer() - priv->start_time));
|
||||||
|
|
||||||
for (i = 0; i <= priv->tndx; i++)
|
for (i = 0; i <= priv->tndx; i++)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32/stm32_otgfshost.c
|
* arch/arm/src/stm32/stm32_otgfshost.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -1596,8 +1596,8 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
|
|||||||
FAR const struct usb_ctrlreq_s *req)
|
FAR const struct usb_ctrlreq_s *req)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
||||||
@ -1826,8 +1826,8 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||||
@ -2085,8 +2085,8 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
size_t xfrlen;
|
size_t xfrlen;
|
||||||
ssize_t xfrd;
|
ssize_t xfrd;
|
||||||
int ret;
|
int ret;
|
||||||
@ -4305,8 +4305,8 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
||||||
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4390,8 +4390,8 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
||||||
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32/stm32_otghshost.c
|
* arch/arm/src/stm32/stm32_otghshost.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -1596,8 +1596,8 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
|
|||||||
FAR const struct usb_ctrlreq_s *req)
|
FAR const struct usb_ctrlreq_s *req)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
/* Loop while the device reports NAK (and a timeout is not exceeded */
|
||||||
@ -1826,8 +1826,8 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||||
@ -2085,8 +2085,8 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan;
|
FAR struct stm32_chan_s *chan;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
size_t xfrlen;
|
size_t xfrlen;
|
||||||
ssize_t xfrd;
|
ssize_t xfrd;
|
||||||
int ret;
|
int ret;
|
||||||
@ -4305,8 +4305,8 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
||||||
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4390,8 +4390,8 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
|
|||||||
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
||||||
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
FAR struct stm32_ctrlinfo_s *ep0info = (FAR struct stm32_ctrlinfo_s *)ep0;
|
||||||
uint16_t buflen;
|
uint16_t buflen;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int retries;
|
int retries;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* With extensions and modifications for the F1, F2, and F4 by:
|
* With extensions and modifications for the F1, F2, and F4 by:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregroy Nutt <gnutt@nuttx.org>
|
* Author: Gregroy Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* And this version for the STM32 F3 by
|
* And this version for the STM32 F3 by
|
||||||
@ -218,7 +218,7 @@ struct stm32_trace_s
|
|||||||
uint32_t count; /* Interrupt count when status change */
|
uint32_t count; /* Interrupt count when status change */
|
||||||
enum stm32_intstate_e event; /* Last event that occurred with this status */
|
enum stm32_intstate_e event; /* Last event that occurred with this status */
|
||||||
uint32_t parm; /* Parameter associated with the event */
|
uint32_t parm; /* Parameter associated with the event */
|
||||||
uint32_t time; /* First of event or first status */
|
systime_t time; /* First of event or first status */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2C Device hardware configuration */
|
/* I2C Device hardware configuration */
|
||||||
@ -260,7 +260,7 @@ struct stm32_i2c_priv_s
|
|||||||
|
|
||||||
#ifdef CONFIG_I2C_TRACE
|
#ifdef CONFIG_I2C_TRACE
|
||||||
int tndx; /* Trace array index */
|
int tndx; /* Trace array index */
|
||||||
uint32_t start_time; /* Time when the trace was started */
|
systime_t start_time; /* Time when the trace was started */
|
||||||
|
|
||||||
/* The actual trace data */
|
/* The actual trace data */
|
||||||
|
|
||||||
@ -719,9 +719,9 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
#else
|
#else
|
||||||
static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the timeout value */
|
/* Get the timeout value */
|
||||||
@ -757,8 +757,8 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
||||||
|
|
||||||
i2cvdbg("intstate: %d elapsed: %d threshold: %d status: %08x\n",
|
i2cvdbg("intstate: %d elapsed: %ld threshold: %ld status: %08x\n",
|
||||||
priv->intstate, elapsed, timeout, priv->status);
|
priv->intstate, (long)elapsed, (long)timeout, priv->status);
|
||||||
|
|
||||||
/* Set the interrupt state back to IDLE */
|
/* Set the interrupt state back to IDLE */
|
||||||
|
|
||||||
@ -859,9 +859,9 @@ stm32_i2c_disable_autoend(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t cr;
|
uint32_t cr;
|
||||||
uint32_t sr;
|
uint32_t sr;
|
||||||
|
|
||||||
@ -1060,8 +1060,8 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
struct stm32_trace_s *trace;
|
struct stm32_trace_s *trace;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Elapsed time: %d\n",
|
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
|
||||||
clock_systimer() - priv->start_time);
|
(long)(clock_systimer() - priv->start_time));
|
||||||
|
|
||||||
for (i = 0; i <= priv->tndx; i++)
|
for (i = 0; i <= priv->tndx; i++)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* arch/arm/src/tiva/tiva_i2c.c
|
* arch/arm/src/tiva/tiva_i2c.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* The basic structure of this driver derives in spirit (if nothing more) from the
|
* The basic structure of this driver derives in spirit (if nothing more) from the
|
||||||
@ -187,7 +187,7 @@ struct tiva_trace_s
|
|||||||
uint32_t count; /* Interrupt count when status change */
|
uint32_t count; /* Interrupt count when status change */
|
||||||
enum tiva_trace_e event; /* Last event that occurred with this status */
|
enum tiva_trace_e event; /* Last event that occurred with this status */
|
||||||
uint32_t parm; /* Parameter associated with the event */
|
uint32_t parm; /* Parameter associated with the event */
|
||||||
uint32_t time; /* First of event or first status */
|
systime_t time; /* First of event or first status */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2C Device hardware configuration */
|
/* I2C Device hardware configuration */
|
||||||
@ -243,7 +243,7 @@ struct tiva_i2c_priv_s
|
|||||||
|
|
||||||
int tndx; /* Trace array index */
|
int tndx; /* Trace array index */
|
||||||
int tcount; /* Number of events with this status */
|
int tcount; /* Number of events with this status */
|
||||||
uint32_t ttime; /* Time when the trace was started */
|
systime_t ttime; /* Time when the trace was started */
|
||||||
uint32_t tstatus; /* Last status read */
|
uint32_t tstatus; /* Last status read */
|
||||||
|
|
||||||
/* The actual trace data */
|
/* The actual trace data */
|
||||||
@ -861,9 +861,9 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
|
|||||||
#else
|
#else
|
||||||
static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
|
static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
systime_t timeout;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -903,8 +903,8 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
|
|||||||
|
|
||||||
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
while (priv->intstate != INTSTATE_DONE && elapsed < timeout);
|
||||||
|
|
||||||
i2cvdbg("intstate: %d elapsed: %d threshold: %d status: %08x\n",
|
i2cvdbg("intstate: %d elapsed: %ld threshold: %ld status: %08x\n",
|
||||||
priv->intstate, elapsed, timeout, status);
|
priv->intstate, (long)elapsed, (long)timeout, status);
|
||||||
|
|
||||||
/* Set the interrupt state back to IDLE */
|
/* Set the interrupt state back to IDLE */
|
||||||
|
|
||||||
@ -1086,8 +1086,8 @@ static void tiva_i2c_tracedump(struct tiva_i2c_priv_s *priv)
|
|||||||
struct tiva_trace_s *trace;
|
struct tiva_trace_s *trace;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Elapsed time: %d\n",
|
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
|
||||||
clock_systimer() - priv->ttime);
|
(long)(clock_systimer() - priv->ttime));
|
||||||
|
|
||||||
for (i = 0; i <= priv->tndx; i++)
|
for (i = 0; i <= priv->tndx; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user