Fix a error the the STM32 I2C timeout logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3940 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-09-06 21:00:48 +00:00
parent a4a6c0f075
commit d1e82b4568
5 changed files with 25 additions and 3 deletions

View File

@ -2052,3 +2052,8 @@
* lib/time/lib_gmtimer.c: Correct several calculations that could lead
to errors in dates.
* 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.

View File

@ -1497,7 +1497,7 @@ ping [-c <count>] [-i <interval>] <ip-address>
Test the network communication with a remote peer. Example,
</p>
<ul><pre>
nsh&gt; 10.0.0.1
nsh&gt; ping 10.0.0.1
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=2 time=0 ms

View File

@ -200,7 +200,7 @@ int inline stm32_i2c_sem_waitisr(FAR struct i2c_dev_s *dev)
flags = irqsave();
do
{
(void)clock_settime(CLOCK_REALTIME, &abstime);
(void)clock_gettime(CLOCK_REALTIME, &abstime);
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
{

View File

@ -129,7 +129,7 @@ enum pm_state_e pm_checkstate(void)
now = clock_systimer();
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
* state. This is an atomic operation because interrupts are

View File

@ -458,5 +458,22 @@ EXTERN int pm_changestate(enum pm_state_e newstate);
#endif
#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 /* __INCLUDE_NUTTX_PM_H */