mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 02:21:35 +08:00
A couple of minor tracing fixes; print the state names in the trace dump, and set the timestamp for each entry (not really a useful number yet…)
This commit is contained in:
@@ -185,6 +185,22 @@ enum stm32_trace_e
|
|||||||
I2CEVENT_ERROR /* Error occurred, param = 0 */
|
I2CEVENT_ERROR /* Error occurred, param = 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_TRACE
|
||||||
|
static const char *stm32_trace_names[] = {
|
||||||
|
"NONE ",
|
||||||
|
"SENDADDR ",
|
||||||
|
"SENDBYTE ",
|
||||||
|
"ITBUFEN ",
|
||||||
|
"RCVBYTE ",
|
||||||
|
"REITBUFEN ",
|
||||||
|
"DISITBUFEN",
|
||||||
|
"BTFNOSTART",
|
||||||
|
"BTFRESTART",
|
||||||
|
"BTFSTOP ",
|
||||||
|
"ERROR "
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Trace data */
|
/* Trace data */
|
||||||
|
|
||||||
struct stm32_trace_s
|
struct stm32_trace_s
|
||||||
@@ -847,6 +863,7 @@ static void stm32_i2c_traceevent(FAR struct stm32_i2c_priv_s *priv,
|
|||||||
|
|
||||||
trace->event = event;
|
trace->event = event;
|
||||||
trace->parm = parm;
|
trace->parm = parm;
|
||||||
|
trace->time = clock_systimer();
|
||||||
|
|
||||||
/* Bump up the trace index (unless we are out of trace entries) */
|
/* Bump up the trace index (unless we are out of trace entries) */
|
||||||
|
|
||||||
@@ -870,8 +887,8 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
|
|||||||
for (i = 0; i <= priv->tndx; i++)
|
for (i = 0; i <= priv->tndx; i++)
|
||||||
{
|
{
|
||||||
trace = &priv->trace[i];
|
trace = &priv->trace[i];
|
||||||
lib_rawprintf("%2d. STATUS: %08x COUNT: %3d EVENT: %2d PARM: %08x TIME: %d\n",
|
lib_rawprintf("%2d. STATUS: %08x COUNT: %3d EVENT: %s PARM: %08x TIME: %d\n",
|
||||||
i+1, trace->status, trace->count, trace->event, trace->parm,
|
i+1, trace->status, trace->count, stm32_trace_names[trace->event], trace->parm,
|
||||||
trace->time - priv->start_time);
|
trace->time - priv->start_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1613,8 +1630,8 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
status = stm32_i2c_getstatus(priv);
|
status = stm32_i2c_getstatus(priv);
|
||||||
errval = ETIMEDOUT;
|
errval = ETIMEDOUT;
|
||||||
|
|
||||||
i2cdbg("Timed out: CR1: %04x status: %08x\n",
|
i2cdbg("Timed out: CR1: %04x status: %08x after %d\n",
|
||||||
stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET), status);
|
stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET), status, timeout_us);
|
||||||
|
|
||||||
/* "Note: When the STOP, START or PEC bit is set, the software must
|
/* "Note: When the STOP, START or PEC bit is set, the software must
|
||||||
* not perform any write access to I2C_CR1 before this bit is
|
* not perform any write access to I2C_CR1 before this bit is
|
||||||
|
|||||||
Reference in New Issue
Block a user