diff --git a/include/vesa.h b/include/vesa.h new file mode 100755 index 0000000..2fc4c35 --- /dev/null +++ b/include/vesa.h @@ -0,0 +1,47 @@ +/*******************************************************************************/ +/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */ +/* */ +#include "types.h" +#include "video.h" + +#define STATE 0x3da + +/* fonction obligatoires */ +u8 *VESA_detect_hardware (void); +u8 VESA_setvideo_mode (u8 mode); +u8 *VESA_getvideo_drivername (void); +u8 *VESA_getvideo_capabilities (void); +videoinfos *VESA_getvideo_info (void); +u32 VESA_mem_to_video (void *src,u32 dst, u32 size, bool increment_src); +u32 VESA_video_to_mem (u32 src,void *dst, u32 size); +u32 VESA_video_to_video (u32 src,u32 dst, u32 size); +void VESA_wait_vretrace (void); +void VESA_wait_hretrace (void); +void VESA_page_set (u8 page); +void VESA_page_show (u8 page); +void VESA_dummy (); + +static videofonction vesafonctions = +{ + &VESA_detect_hardware, + &VESA_setvideo_mode, + &VESA_getvideo_drivername, + &VESA_getvideo_capabilities, + &VESA_getvideo_info, + &VESA_mem_to_video, + &VESA_video_to_mem, + &VESA_video_to_video, + &VESA_wait_vretrace, + &VESA_wait_hretrace, + &VESA_page_set, + &VESA_page_show, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy, + &VESA_dummy +}; diff --git a/include/vga.h b/include/vga.h index 9aef4e7..678c3ce 100755 --- a/include/vga.h +++ b/include/vga.h @@ -115,7 +115,7 @@ void VGA_font2_set (u8 num); void VGA_blink_enable (void); void VGA_blink_disable (void); -static videofonction fonctions = +static videofonction vgafonctions = { &VGA_detect_hardware, &VGA_setvideo_mode, diff --git a/lib/shell.c b/lib/shell.c index f85861f..0fc5f71 100644 --- a/lib/shell.c +++ b/lib/shell.c @@ -365,7 +365,7 @@ int mode(u8* commandline) } strgetitem(commandline, &arg, ' ', 1); argint=strtoint(&arg); - setvideo_mode(argint); + changemode(argint); return 0; } diff --git a/lib/vesa.c b/lib/vesa.c new file mode 100755 index 0000000..02388d2 --- /dev/null +++ b/lib/vesa.c @@ -0,0 +1,112 @@ +/*******************************************************************************/ +/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */ +/* */ +#include "vesa.h" +#include "video.h" +#include "memory.h" +#include "asm.h" +#include "types.h" + +static videoinfos infos; + +static capabilities vesacapabilities[] = { + {0xFF,000,000,false, 0, 0}, +}; + +/*******************************************************************************/ +/* Detecte si le hardware est disponible, return NULL ou pointeur sur le type de pilote */ +u8 *VESA_detect_hardware(void) { + return "LEGACY"; +} + +/*******************************************************************************/ +/* Change le mode video courant */ +/* ERR 0 aucune +/* ERR 1 mode non existant */ + +static u8 realsize; + +u8 VESA_setvideo_mode(u8 mode) +{ + +} + +/*******************************************************************************/ +/* Renvoie le nom du driver */ +u8 *VESA_getvideo_drivername (void) { + return "VESA"; +} + +/*******************************************************************************/ +/* Renvoie un pointeur sur la structure des capacités graphiques */ + +u8 *VESA_getvideo_capabilities (void) { + return vesacapabilities; +} + +/*******************************************************************************/ +/* Renvoie un pointeur sur l'état courant de la carte */ +videoinfos *VESA_getvideo_info (void) { + return &infos; +} + +/*******************************************************************************/ +/* Effecture un mouvement de la mémoire centrale vers la mémoire video (linéarisée) */ +u32 VESA_mem_to_video (void *src,u32 dst, u32 size, bool increment_src) { + +} + +/*******************************************************************************/ +/* Effecture un mouvement de la mémoire video (linéarisée) vers la mémoire centrale*/ +u32 VESA_video_to_mem (u32 src,void *dst, u32 size) +{ + +} + +/*******************************************************************************/ +/* Effecture un mouvement de la mémoire video (linéarisé) vers la mémoire vidéo (linéarisée) */ +u32 VESA_video_to_video (u32 src,u32 dst, u32 size) +{ + +} + +/*******************************************************************************/ +/* Fixe la page ecran de travail */ + +void VESA_page_set(u8 page) +{ + +} + +/*******************************************************************************/ +/* Affiche la page ecran specifié */ + +void VESA_page_show(u8 page) +{ + +} + +/*******************************************************************************/ +/* Fonction inutile */ + +void VESA_dummy(void) +{ + +} + +/*******************************************************************************/ +/* Attend la retrace verticale */ + +void VESA_wait_vretrace(void) +{ + while ((inb(STATE) & 8) == 0) ; +} + +/*******************************************************************************/ +/* Attend la retrace horizontale */ + +void VESA_wait_hretrace(void) +{ + while ((inb(STATE) & 1) == 0) ; +} + diff --git a/lib/video.c b/lib/video.c index 3f9b3cd..88f3194 100755 --- a/lib/video.c +++ b/lib/video.c @@ -2,6 +2,7 @@ /* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */ /* */ #include "vga.h" +#include "vesa.h" #include "asm.h" #include "video.h" #include "stdarg.h" @@ -213,6 +214,7 @@ void changemode(u8 mode) width=(vinfo->currentwidth>>3); height=(vinfo->currentheight>>3); } + clearscreen(); } /*******************************************************************************/ @@ -974,9 +976,10 @@ void apply_nextvideomode(void) { void initvideo(void) { initdriver(); - registerdriver(&fonctions); + registerdriver(&vgafonctions); + registerdriver(&vesafonctions); apply_driver("VGA"); - changemode(0x83); + changemode(0x01); } /******************************************************************************/