Fix a error the the STM32 I2C timeout logic
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3940 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
00b807d2e3
commit
235cbdc179
|
@ -187,7 +187,7 @@ int arg_decimal(FAR char **arg, FAR long *value)
|
||||||
{
|
{
|
||||||
FAR char *string;
|
FAR char *string;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = arg_string(arg, &string);
|
ret = arg_string(arg, &string);
|
||||||
*value = strtol(string, NULL, 10);
|
*value = strtol(string, NULL, 10);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -253,7 +253,7 @@ FAR char *i2c_argument(FAR struct i2ctool_s *i2ctool, int argc, char *argv[], in
|
||||||
|
|
||||||
int i2c_parse(FAR struct i2ctool_s *i2ctool, int argc, char *argv[])
|
int i2c_parse(FAR struct i2ctool_s *i2ctool, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FAR char *newargs[MAX_ARGUMENTS+1];
|
FAR char *newargs[MAX_ARGUMENTS+2];
|
||||||
FAR char *cmd;
|
FAR char *cmd;
|
||||||
int nargs;
|
int nargs;
|
||||||
int index;
|
int index;
|
||||||
|
@ -278,7 +278,7 @@ int i2c_parse(FAR struct i2ctool_s *i2ctool, int argc, char *argv[])
|
||||||
/* Parse all of the arguments following the command name. */
|
/* Parse all of the arguments following the command name. */
|
||||||
|
|
||||||
newargs[0] = cmd;
|
newargs[0] = cmd;
|
||||||
for (nargs = 1; nargs < MAX_ARGUMENTS; nargs++)
|
for (nargs = 1; nargs <= MAX_ARGUMENTS; nargs++)
|
||||||
{
|
{
|
||||||
newargs[nargs] = i2c_argument(i2ctool, argc, argv, &index);
|
newargs[nargs] = i2c_argument(i2ctool, argc, argv, &index);
|
||||||
if (!newargs[nargs])
|
if (!newargs[nargs])
|
||||||
|
|
|
@ -91,10 +91,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is the maximum number of arguments that will be accepted for a
|
/* This is the maximum number of arguments that will be accepted for a
|
||||||
* command
|
* command. The only real limit is in the OS configuration that limits
|
||||||
|
* the number of parameters passed to a task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_ARGUMENTS 6
|
#define MAX_ARGUMENTS (CONFIG_MAX_TASK_ARGS-1)
|
||||||
|
|
||||||
/* Maximum size of one command line */
|
/* Maximum size of one command line */
|
||||||
|
|
||||||
|
|
|
@ -2052,3 +2052,8 @@
|
||||||
* lib/time/lib_gmtimer.c: Correct several calculations that could lead
|
* lib/time/lib_gmtimer.c: Correct several calculations that could lead
|
||||||
to errors in dates.
|
to errors in dates.
|
||||||
* drivers/pm: Add the beginnings of a NuttX power management sub-system.
|
* drivers/pm: Add the beginnings of a NuttX power management sub-system.
|
||||||
|
* arch/arm/src/stm32/stm32_irq.c: Fix a error introduced in 6.8.
|
||||||
|
Timeout calculation uses clock_settime() instead of clock_gettime().
|
||||||
|
Pretty gross error, but actually it works with the side effect of setting
|
||||||
|
a bad time.
|
||||||
|
|
||||||
|
|
|
@ -1497,7 +1497,7 @@ ping [-c <count>] [-i <interval>] <ip-address>
|
||||||
Test the network communication with a remote peer. Example,
|
Test the network communication with a remote peer. Example,
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
nsh> 10.0.0.1
|
nsh> ping 10.0.0.1
|
||||||
PING 10.0.0.1 56 bytes of data
|
PING 10.0.0.1 56 bytes of data
|
||||||
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
|
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
|
||||||
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
|
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
|
||||||
|
|
|
@ -200,7 +200,7 @@ int inline stm32_i2c_sem_waitisr(FAR struct i2c_dev_s *dev)
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
(void)clock_settime(CLOCK_REALTIME, &abstime);
|
(void)clock_gettime(CLOCK_REALTIME, &abstime);
|
||||||
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
|
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
|
||||||
if (abstime.tv_nsec > 1000 * 1000 * 1000)
|
if (abstime.tv_nsec > 1000 * 1000 * 1000)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,7 +129,7 @@ enum pm_state_e pm_checkstate(void)
|
||||||
now = clock_systimer();
|
now = clock_systimer();
|
||||||
if (now - g_pmglobals.stime >= TIME_SLICE_TICKS)
|
if (now - g_pmglobals.stime >= TIME_SLICE_TICKS)
|
||||||
{
|
{
|
||||||
int16_t accum;
|
int16_t accum;
|
||||||
|
|
||||||
/* Sample the count, reset the time and count, and assess the PM
|
/* Sample the count, reset the time and count, and assess the PM
|
||||||
* state. This is an atomic operation because interrupts are
|
* state. This is an atomic operation because interrupts are
|
||||||
|
|
|
@ -458,5 +458,22 @@ EXTERN int pm_changestate(enum pm_state_e newstate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Stubs
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#else /* CONFIG_PM */
|
||||||
|
|
||||||
|
/* Stubbed out versions of all of PM interface functions that may be used to
|
||||||
|
* avoid so much conditional compilation in driver code when PM is disabled:
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define pm_initialize()
|
||||||
|
# define pm_register(cb) (0)
|
||||||
|
# define pm_activity(prio)
|
||||||
|
# define pm_checkstate() (0)
|
||||||
|
# define pm_changestate(state)
|
||||||
|
|
||||||
#endif /* CONFIG_PM */
|
#endif /* CONFIG_PM */
|
||||||
#endif /* __INCLUDE_NUTTX_PM_H */
|
#endif /* __INCLUDE_NUTTX_PM_H */
|
||||||
|
|
Loading…
Reference in New Issue