Fix error in timer_settime()

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3117 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-11-17 12:08:25 +00:00
parent 54e86016ae
commit e9b173f594
3 changed files with 12 additions and 6 deletions
+3
View File
@@ -1337,5 +1337,8 @@
verify the LPC17xx ethernet driver currently under development. verify the LPC17xx ethernet driver currently under development.
* arch/arm/src/lpc17xx/lpc17xx_ethernet.c/.h - Began development of * arch/arm/src/lpc17xx/lpc17xx_ethernet.c/.h - Began development of
the LPC17xx Ethernet driver. the LPC17xx Ethernet driver.
* sched/timer_settime.c - Fix an error in set-up of one-shot timer. It was
using the repititive timer value (which is zero in the one-shot case,
always resulting in a 10Ms timer! Found and fixed by Wilton Tong.
+4 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: November 11, 2010</p> <p>Last Updated: November 17, 2010</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1986,6 +1986,9 @@ nuttx-5.14 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
verify the LPC17xx ethernet driver currently under development. verify the LPC17xx ethernet driver currently under development.
* arch/arm/src/lpc17xx/lpc17xx_ethernet.c/.h - Began development of * arch/arm/src/lpc17xx/lpc17xx_ethernet.c/.h - Began development of
the LPC17xx Ethernet driver. the LPC17xx Ethernet driver.
* sched/timer_settime.c - Fix an error in set-up of one-shot timer. It was
using the repititive timer value (which is zero in the one-shot case,
always resulting in a 10Ms timer! Found and fixed by Wilton Tong.
pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+5 -5
View File
@@ -1,7 +1,7 @@
/******************************************************************************** /********************************************************************************
* sched/timer_settime.c * sched/timer_settime.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -308,7 +308,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
if (!timer || !value) if (!timer || !value)
{ {
*get_errno_ptr() = EINVAL; errno = EINVAL;
return ERROR; return ERROR;
} }
@@ -349,7 +349,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
#ifdef CONFIG_DISABLE_CLOCK #ifdef CONFIG_DISABLE_CLOCK
/* Absolute timing depends upon having access to clock functionality */ /* Absolute timing depends upon having access to clock functionality */
*get_errno_ptr() = ENOSYS; errno = ENOSYS;
return ERROR; return ERROR;
#else #else
/* Calculate a delay corresponding to the absolute time in 'value'. /* Calculate a delay corresponding to the absolute time in 'value'.
@@ -371,7 +371,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
} }
/* If the time is in the past or now, then set up the next interval /* If the time is in the past or now, then set up the next interval
* instead. * instead (assuming a repititive timer).
*/ */
if (delay <= 0) if (delay <= 0)
@@ -385,7 +385,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
if (delay > 0) if (delay > 0)
{ {
timer->pt_last = delay; timer->pt_last = delay;
ret = wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, (uint32_t)((uintptr_t)timer)); ret = wd_start(timer->pt_wdog, delay, (wdentry_t)timer_timeout, 1, (uint32_t)((uintptr_t)timer));
} }
irqrestore(state); irqrestore(state);