EGL - delay function implementation file DELAY.INC

xiaoxiao2021-03-06  79

/ * Delay.inc * /

Void initTimer () / * Initialize the entire delay system, end must call EndTimer * / {INT I; if (isinit) return; disable (); OLD_INT8 = GetVect (0x8); setVect (0x8, new_int8); / * Installation Clock interrupt to ensure accurate delay * / enable (); for (i = 0; i

INT CREATTIMER (UINT DIDA, UINT ID) / * Create an example * / {/ * DID tip number of request delay; ID, ID, ID must be an integer, used to identify different examples * / INT i; for (i = 0; i

INT CheckTimeout / * Call in the main program to determine the example delay in the ID * / {INT i; for (i = 0; i

Void delay (uint Dida) / * is used to replace the code of the delay function, delay in DIDA * / {Ticks [maxTimers-1] .ID = 1; ticks [maxTimers-1] .delayticks = DIDA; TICKS [ MaxTimers-1] .ticks = 0; ticks [maxTimers-1] .timeout = 0; While (! Ticks [maxTimers-1] .timeout); ticks [maxTimers-1] .id = -1; ticks [maxTimers-1 ] .timeout = 0;}

Void ReleaseTimer (UINT ID) / * When the required example is not available, it should be released to save resources * / {INT i; for (i = 0; i

Void endtimer () / * When the delay is completed, it should be called after the program exits, the system crashes * / {if (! isinit) return; disable (); setVect (0x8, OLD_INT8); Enable (); isinit = 0 }

转载请注明原文地址:https://www.9cbs.com/read-88703.html

New Post(0)