Skip to content

Commit

Permalink
Fix warnings related to timeval vs timeval32 operations
Browse files Browse the repository at this point in the history
  • Loading branch information
deadwood committed May 4, 2022
1 parent c061262 commit 62cd19b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rom/timer/lowlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void addToWaitList(struct MinList *list, struct timerequest *iotr, struct
ForeachNode(list, tr)
{
/* If the time in the new request is less than the next request */
if (CMPTIME(&tr->tr_time, &iotr->tr_time) < 0)
if (CMPTIME3232(&tr->tr_time, &iotr->tr_time) < 0)
{
/* Add the node before the next request */
Insert((struct List *)list, &iotr->tr_node.io_Message.mn_Node, tr->tr_node.io_Message.mn_Node.ln_Pred);
Expand Down Expand Up @@ -116,14 +116,18 @@ BOOL common_BeginIO(struct timerequest *timereq, struct TimerBase *TimerBase)
#endif

case TR_GETSYSTIME:
GetSysTime(&timereq->tr_time);
{
struct timeval tv;
GetSysTime(&tv);
timereq->tr_time.tv_secs = tv.tv_secs;
timereq->tr_time.tv_micro = tv.tv_micro;

if (!(timereq->tr_node.io_Flags & IOF_QUICK))
ReplyMsg(&timereq->tr_node.io_Message);

replyit = FALSE; /* Because replyit will clear the timeval */
break;

}
case TR_SETSYSTIME:
Disable();

Expand All @@ -146,7 +150,7 @@ BOOL common_BeginIO(struct timerequest *timereq, struct TimerBase *TimerBase)
/* Query the hardware first */
EClockUpdate(TimerBase);

if (CMPTIME(&TimerBase->tb_CurrentTime, &timereq->tr_time) <= 0)
if (CMPTIMEXX32(&TimerBase->tb_CurrentTime, &timereq->tr_time) <= 0)
{
timereq->tr_time.tv_secs = timereq->tr_time.tv_micro = 0;
timereq->tr_node.io_Error = 0;
Expand Down Expand Up @@ -274,7 +278,7 @@ void TimerProcessMicroHZ(struct TimerBase *TimerBase, struct ExecBase *SysBase,
#endif
ForeachNodeSafe(unit, tr, next)
{
if (CMPTIME(&TimerBase->tb_Elapsed, &tr->tr_time) <= 0)
if (CMPTIMEXX32(&TimerBase->tb_Elapsed, &tr->tr_time) <= 0)
{
/* This request has finished */
REMOVE(tr);
Expand Down Expand Up @@ -360,7 +364,7 @@ void TimerProcessVBlank(struct TimerBase *TimerBase, struct ExecBase *SysBase, B
#endif
ForeachNodeSafe(&TimerBase->tb_Lists[TL_VBLANK], tr, next)
{
if (CMPTIME(&TimerBase->tb_Elapsed, &tr->tr_time) <= 0)
if (CMPTIMEXX32(&TimerBase->tb_Elapsed, &tr->tr_time) <= 0)
{
/* This request has finished */
REMOVE(tr);
Expand All @@ -380,7 +384,7 @@ void TimerProcessVBlank(struct TimerBase *TimerBase, struct ExecBase *SysBase, B
*/
ForeachNodeSafe(&TimerBase->tb_Lists[TL_WAITVBL], tr, next)
{
if (CMPTIME(&TimerBase->tb_CurrentTime, &tr->tr_time) <= 0)
if (CMPTIMEXX32(&TimerBase->tb_CurrentTime, &tr->tr_time) <= 0)
{
/* This request has finished */
REMOVE(tr);
Expand Down
10 changes: 10 additions & 0 deletions rom/timer/timer_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ static inline LONG CMPTIME(struct timeval *dest, struct timeval *src)
return 0;
}

static inline LONG CMPTIME3232(struct timeval32 *dest, struct timeval32 *src)
{
return CMPTIME((struct timeval *)dest, (struct timeval *)src);
}

static inline LONG CMPTIMEXX32(struct timeval *dest, struct timeval32 *src)
{
return CMPTIME(dest, (struct timeval *)src);
}

/*
* Add 'diff' EClock ticks to timeval in 'time'.
* Fraction of second value is stored in in 'frac'.
Expand Down

0 comments on commit 62cd19b

Please sign in to comment.