17 if ( arg->m_isActive )
22 arg->m_callbackProc = func;
23 arg->m_callbackArg = cbArg;
24 for ( pos = memPool->m_timerListStart; pos && delay >= (int)pos->m_delayCount;
25 delay -= pos->m_delayCount, pos = pos->m_prev )
30 arg->m_next = pos->m_next;
32 pos->m_next->m_prev = arg;
34 memPool->m_timerListStart = arg;
37 pos->m_delayCount -= delay;
41 arg->m_next = memPool->m_timerListEnd;
42 if ( memPool->m_timerListEnd )
43 memPool->m_timerListEnd->m_prev = arg;
45 memPool->m_timerListStart = arg;
46 memPool->m_timerListEnd = arg;
49 arg->m_delayCount = delay;
50 memPool->m_ohciRegs->HcInterruptEnable = OHCI_INT_SF;
56 if ( !arg->m_isActive )
61 arg->m_prev->m_next = arg->m_next;
63 memPool->m_timerListEnd = arg->m_next;
65 arg->m_next->m_prev = arg->m_prev;
67 memPool->m_timerListStart = arg->m_prev;
74void handleTimerList(
void)
78 timer = memPool->m_timerListStart;
81 if ( timer->m_delayCount > 0 )
82 timer->m_delayCount -= 1;
85 timer = memPool->m_timerListStart;
86 if ( !timer || (
int)timer->m_delayCount > 0 )
88 dbg_printf(
"timer expired\n");
89 memPool->m_timerListStart = timer->m_prev;
91 timer->m_prev->m_next = NULL;
93 memPool->m_timerListEnd = NULL;
96 timer->m_isActive = 0;
97 timer->m_callbackProc(timer->m_callbackArg);
101 if ( !memPool->m_timerListStart )
102 memPool->m_ohciRegs->HcInterruptDisable = OHCI_INT_SF;