mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Update the type passed to watchdog timer handlers. Using uint32_t is a problem for 64-bit machines.
This commit is contained in:
+11
-14
@@ -1,7 +1,7 @@
|
||||
/********************************************************************************
|
||||
* sched/timer/timer_settime.c
|
||||
*
|
||||
* Copyright (C) 2007-2010, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2010, 2013-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -67,8 +67,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
static inline void timer_sigqueue(FAR struct posix_timer_s *timer);
|
||||
static inline void timer_restart(FAR struct posix_timer_s *timer, uint32_t itimer);
|
||||
static void timer_timeout(int argc, uint32_t itimer);
|
||||
static inline void timer_restart(FAR struct posix_timer_s *timer, wdparm_t itimer);
|
||||
static void timer_timeout(int argc, wdparm_t itimer);
|
||||
|
||||
/********************************************************************************
|
||||
* Private Functions
|
||||
@@ -128,11 +128,12 @@ static inline void timer_sigqueue(FAR struct posix_timer_s *timer)
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* This function executes in the context of the watchod timer interrupt.
|
||||
* This function executes in the context of the watchdog timer interrupt.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
static inline void timer_restart(FAR struct posix_timer_s *timer, uint32_t itimer)
|
||||
static inline void timer_restart(FAR struct posix_timer_s *timer,
|
||||
wdparm_t itimer)
|
||||
{
|
||||
/* If this is a repetitive timer, then restart the watchdog */
|
||||
|
||||
@@ -164,17 +165,17 @@ static inline void timer_restart(FAR struct posix_timer_s *timer, uint32_t itime
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
static void timer_timeout(int argc, uint32_t itimer)
|
||||
static void timer_timeout(int argc, wdparm_t itimer)
|
||||
{
|
||||
#ifndef CONFIG_CAN_PASS_STRUCTS
|
||||
/* On many small machines, pointers are encoded and cannot be simply cast from
|
||||
* uint32_t to struct tcb_s*. The following union works around this (see wdogparm_t).
|
||||
* wdparm_t to struct tcb_s*. The following union works around this (see wdogparm_t).
|
||||
*/
|
||||
|
||||
union
|
||||
{
|
||||
FAR struct posix_timer_s *timer;
|
||||
uint32_t itimer;
|
||||
wdparm_t itimer;
|
||||
} u;
|
||||
|
||||
u.itimer = itimer;
|
||||
@@ -198,11 +199,7 @@ static void timer_timeout(int argc, uint32_t itimer)
|
||||
timer_restart(u.timer, itimer);
|
||||
}
|
||||
#else
|
||||
/* (casting to uintptr_t first eliminates complaints on some architectures
|
||||
* where the sizeof uint32_t is different from the size of a pointer).
|
||||
*/
|
||||
|
||||
FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)((uintptr_t)itimer);
|
||||
FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)itimer;
|
||||
|
||||
/* Send the specified signal to the specified task. Increment the reference
|
||||
* count on the timer first so that will not be deleted until after the
|
||||
@@ -375,7 +372,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
|
||||
{
|
||||
timer->pt_last = delay;
|
||||
ret = wd_start(timer->pt_wdog, delay, (wdentry_t)timer_timeout,
|
||||
1, (uint32_t)((uintptr_t)timer));
|
||||
1, (uint32_t)((wdparm_t)timer));
|
||||
}
|
||||
|
||||
irqrestore(state);
|
||||
|
||||
Reference in New Issue
Block a user