Fixed compile errors, added Semaphore code
[tpg/acess2.git] / Modules / Display / VESA / main.c
index ff9e514..479be30 100644 (file)
@@ -2,7 +2,7 @@
  * AcessOS 1\r
  * Video BIOS Extensions (Vesa) Driver\r
  */\r
-#define DEBUG  0\r
+#define DEBUG  1\r
 #define VERSION        0x100\r
 \r
 #include <acess.h>\r
@@ -44,7 +44,7 @@ tDevFS_Driver gVesa_DriverStruct = {
        .IOCtl = Vesa_Ioctl\r
        }\r
 };\r
-tSpinlock      glVesa_Lock;\r
+tMutex glVesa_Lock;\r
 tVM8086        *gpVesa_BiosState;\r
  int   giVesaDriverId = -1;\r
 // --- Video Modes ---\r
@@ -93,13 +93,15 @@ int Vesa_Install(char **Arguments)
                return MODULE_ERR_NOTNEEDED;\r
        }\r
        \r
-       Log_Debug("VESA", "info->VideoModes = %04x:%04x", info->VideoModes.seg, info->VideoModes.ofs);\r
+       //Log_Debug("VESA", "info->VideoModes = %04x:%04x", info->VideoModes.seg, info->VideoModes.ofs);\r
        modes = (Uint16 *) VM8086_GetPointer(gpVesa_BiosState, info->VideoModes.seg, info->VideoModes.ofs);\r
        \r
        // Read Modes\r
        for( giVesaModeCount = 0; modes[giVesaModeCount] != 0xFFFF; giVesaModeCount++ );\r
        gVesa_Modes = (tVesa_Mode *)malloc( giVesaModeCount * sizeof(tVesa_Mode) );\r
        \r
+       Log_Debug("VESA", "%i Modes", giVesaModeCount);\r
+       \r
        // Insert Text Mode\r
        gVesa_Modes[0].width = 80;\r
        gVesa_Modes[0].height = 25;\r
@@ -421,7 +423,7 @@ int Vesa_Int_SetMode(int mode)
        Time_RemoveTimer(giVesaCursorTimer);\r
        giVesaCursorTimer = -1;\r
        \r
-       LOCK( &glVesa_Lock );\r
+       Mutex_Acquire( &glVesa_Lock );\r
        \r
        gpVesa_BiosState->AX = 0x4F02;\r
        gpVesa_BiosState->BX = gVesa_Modes[mode].code;\r
@@ -446,7 +448,7 @@ int Vesa_Int_SetMode(int mode)
        giVesaCurrentMode = mode;\r
        gpVesaCurMode = &gVesa_Modes[giVesaCurrentMode];\r
        \r
-       RELEASE( &glVesa_Lock );\r
+       Mutex_Release( &glVesa_Lock );\r
        \r
        return 1;\r
 }\r
@@ -516,10 +518,10 @@ void Vesa_FlipCursor(void *Arg)
        \r
        //Debug("Cursor flip");\r
        \r
-       // Sanity 1\r
+       // Sanity check\r
        if(giVesaCursorX < 0 || giVesaCursorY < 0\r
-       || y*pitch + x + giVT_CharHeight*pitch > (int)gpVesaCurMode->fbSize/4) {\r
-               Debug("Cursor OOB (%i,%i)", x, y);\r
+       || y*pitch + x + (giVT_CharHeight-1)*pitch > (int)gpVesaCurMode->fbSize/4) {\r
+               Log_Notice("VESA", "Cursor OOB (%i,%i)", x, y);\r
                giVesaCursorTimer = -1;\r
                return;\r
        }\r

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