Kernel/timers - Cleaning up timer code... might have made more mess
[tpg/acess2.git] / KernelLand / Modules / Display / VESA / main.c
index a85d313..c57d57d 100644 (file)
@@ -12,6 +12,7 @@
 #include <modules.h>\r
 #include <vm8086.h>\r
 #include "common.h"\r
+#include <timers.h>\r
 \r
 // === CONSTANTS ===\r
 #define        FLAG_LFB        0x1\r
@@ -59,7 +60,9 @@ char  *gpVesa_Framebuffer = (void*)VESA_DEFAULT_FRAMEBUFFER;
 // --- Cursor Control ---\r
  int   giVesaCursorX = -1;\r
  int   giVesaCursorY = -1;\r
- int   giVesaCursorTimer = -1; // Invalid timer\r
+#if BLINKING_CURSOR\r
+tTimer *gpVesaCursorTimer;\r
+#endif\r
  int   gbVesa_CursorVisible = 0;\r
 // --- 2D Video Stream Handlers ---\r
 tDrvUtil_Video_BufInfo gVesa_BufInfo;\r
@@ -112,10 +115,15 @@ int Vesa_Install(char **Arguments)
 \r
 //     VM8086_Deallocate( info );\r
        \r
+       #if BLINKING_CURSOR\r
+       // Create blink timer\r
+       gpVesaCursorTimer = Time_AllocateTimer( Vesa_FlipCursor, NULL );\r
+       #endif\r
+\r
        // Install Device\r
        giVesaDriverId = DevFS_AddDevice( &gVesa_DriverStruct );\r
        if(giVesaDriverId == -1)        return MODULE_ERR_MISC;\r
-       \r
+\r
        return MODULE_ERR_OK;\r
 }\r
 \r
@@ -246,8 +254,7 @@ int Vesa_Int_SetMode(int mode)
        \r
        Vesa_int_FillModeList();\r
 \r
-       Time_RemoveTimer(giVesaCursorTimer);\r
-       giVesaCursorTimer = -1;\r
+       Time_RemoveTimer(gpVesaCursorTimer);\r
        \r
        Mutex_Acquire( &glVesa_Lock );\r
        \r
@@ -365,9 +372,8 @@ void Vesa_int_HideCursor(void)
 {\r
        DrvUtil_Video_RemoveCursor( &gVesa_BufInfo );\r
        #if BLINKING_CURSOR\r
-       if(giVesaCursorTimer != -1) {\r
-               Time_RemoveTimer(giVesaCursorTimer);\r
-               giVesaCursorTimer = -1;\r
+       if(gpVesaCursorTimer) {\r
+               Time_RemoveTimer(gpVesaCursorTimer);\r
        }\r
        #endif\r
 }\r
@@ -383,7 +389,7 @@ void Vesa_int_ShowCursor(void)
                        giVesaCursorY*giVT_CharHeight\r
                        );\r
                #if BLINKING_CURSOR\r
-               giVesaCursorTimer = Time_CreateTimer(VESA_CURSOR_PERIOD, Vesa_FlipCursor, NULL);\r
+               Time_ScheduleTimer( gpVesaCursorTimer, VESA_CURSOR_PERIOD );\r
                #endif\r
        }\r
        else\r
@@ -412,7 +418,7 @@ void Vesa_FlipCursor(void *Arg)
        gbVesa_CursorVisible = !gbVesa_CursorVisible;\r
                \r
        #if BLINKING_CURSOR\r
-       giVesaCursorTimer = Time_CreateTimer(VESA_CURSOR_PERIOD, Vesa_FlipCursor, Arg);\r
+       Time_ScheduleTimer( gpVesaCursorTimer, VESA_CURSOR_PERIOD );\r
        #endif\r
 }\r
 \r

UCC git Repository :: git.ucc.asn.au