mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
Fix some bugs in the oneshot driver logic
This commit is contained in:
@@ -77,7 +77,7 @@ struct sim_oneshot_lowerhalf_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void sim_oneshot_handler(void *arg);
|
||||
static void sim_oneshot_handler(int argc, wdparm_t arg1, ...);
|
||||
|
||||
static int sim_max_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts);
|
||||
@@ -119,14 +119,14 @@ static const struct oneshot_operations_s g_oneshot_ops =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void sim_oneshot_handler(void *arg)
|
||||
static void sim_oneshot_handler(int argc, wdparm_t arg1, ...)
|
||||
{
|
||||
FAR struct sim_oneshot_lowerhalf_s *priv =
|
||||
(FAR struct sim_oneshot_lowerhalf_s *)arg;
|
||||
(FAR struct sim_oneshot_lowerhalf_s *)arg1;
|
||||
oneshot_callback_t callback;
|
||||
FAR void *cbarg;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
DEBUGASSERT(argc == 1 && priv != NULL);
|
||||
|
||||
/* Perhaps the callback was nullified in a race condition with
|
||||
* sim_cancel?
|
||||
|
||||
@@ -239,9 +239,8 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Handle built-in ioctl commands */
|
||||
/* Handle oneshot timer ioctl commands */
|
||||
|
||||
ret = -EINVAL;
|
||||
switch (cmd)
|
||||
{
|
||||
/* OSIOC_MAXDELAY - Return the maximum delay that can be supported
|
||||
@@ -286,7 +285,7 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
/* Start the oneshot timer */
|
||||
|
||||
ret = ONESHOT_START(priv->od_lower, oneshot_callback, start->arg,
|
||||
ret = ONESHOT_START(priv->od_lower, oneshot_callback, priv,
|
||||
&start->ts);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user