2018-09-28 20:35:51 +02:00
|
|
|
/*******************************************************************************/
|
|
|
|
/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */
|
|
|
|
/* */
|
2018-10-07 12:57:38 +02:00
|
|
|
|
2018-10-12 22:31:34 +02:00
|
|
|
#ifndef VIDEO
|
|
|
|
# define VIDEO
|
|
|
|
|
2018-10-07 12:57:38 +02:00
|
|
|
#include "stdarg.h"
|
|
|
|
|
2018-10-13 13:23:00 +02:00
|
|
|
#define MAXDRIVERS 10
|
|
|
|
|
|
|
|
#define FONT8X16 0
|
|
|
|
#define FONT8X8 1
|
2018-10-12 20:37:26 +02:00
|
|
|
|
|
|
|
typedef struct videoinfos {
|
2018-10-12 22:31:34 +02:00
|
|
|
u8 currentmode;
|
2018-10-12 20:37:26 +02:00
|
|
|
u16 currentwidth;
|
|
|
|
u16 currentheight;
|
|
|
|
u8 currentdepth;
|
|
|
|
u8 currentactivepage;
|
|
|
|
u8 currentshowedpage;
|
|
|
|
u16 currentcursorX;
|
|
|
|
u16 currentcursorY;
|
|
|
|
u8 currentfont1;
|
|
|
|
u8 currentfont2;
|
|
|
|
u16 currentpitch;
|
|
|
|
bool isgraphic;
|
|
|
|
bool isblinking;
|
|
|
|
bool iscursorvisible;
|
|
|
|
u8 pagesnumber;
|
|
|
|
u32 pagesize;
|
|
|
|
u32 baseaddress;
|
|
|
|
} videoinfos __attribute__ ((packed));
|
|
|
|
|
2018-10-12 22:31:34 +02:00
|
|
|
typedef struct videofonction {
|
|
|
|
u8 *(*detect_hardware)();
|
|
|
|
u8 (*setvideo_mode) ();
|
|
|
|
u8 *(*getvideo_drivername) ();
|
|
|
|
u8 *(*getvideo_capabilities) ();
|
|
|
|
videoinfos *(*getvideo_info) ();
|
|
|
|
u32 (*mem_to_video) ();
|
|
|
|
u32 (*video_to_mem) ();
|
|
|
|
u32 (*video_to_video) ();
|
|
|
|
void (*wait_vretrace) ();
|
|
|
|
void (*wait_hretrace) ();
|
|
|
|
void (*page_set) ();
|
|
|
|
void (*page_show) ();
|
|
|
|
void (*page_split) ();
|
|
|
|
void (*cursor_enable) ();
|
|
|
|
void (*cursor_disable) ();
|
|
|
|
void (*cursor_set) ();
|
|
|
|
u32 (*font_load) ();
|
|
|
|
void (*font1_set) ();
|
|
|
|
void (*font2_set) ();
|
|
|
|
void (*blink_enable) ();
|
|
|
|
void (*blink_disable) ();
|
|
|
|
} videofonction __attribute__ ((packed));
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct drivers {
|
|
|
|
u8* nom;
|
|
|
|
videofonction* pointer;
|
|
|
|
} drivers __attribute__ ((packed));
|
|
|
|
|
|
|
|
typedef struct capabilities {
|
|
|
|
u8 modenumber;
|
|
|
|
u16 width;
|
|
|
|
u16 height;
|
|
|
|
bool graphic;
|
|
|
|
u8 depth;
|
2018-10-13 13:23:00 +02:00
|
|
|
u8 refresh;
|
2018-10-12 22:31:34 +02:00
|
|
|
} capabilities __attribute__ ((packed));
|
|
|
|
|
2007-04-02 16:02:21 +02:00
|
|
|
typedef struct console {
|
2018-10-12 20:37:26 +02:00
|
|
|
u8 attrib;
|
|
|
|
s16 cursX;
|
|
|
|
s16 cursY;
|
|
|
|
u8 ansi;
|
|
|
|
u8 param1;
|
|
|
|
u8 param2;
|
|
|
|
u8 param3;
|
|
|
|
u8 page;
|
2018-10-13 05:35:08 +02:00
|
|
|
bool scroll;
|
2007-04-02 16:02:21 +02:00
|
|
|
} console __attribute__ ((packed));
|
|
|
|
|
2018-10-12 20:37:26 +02:00
|
|
|
/* Fonctions de bas niveau */
|
|
|
|
void fill(u8 attrib);
|
|
|
|
void scroll (u8 lines, u8 attrib);
|
|
|
|
void scroll_enable(void);
|
|
|
|
void scroll_disable(void);
|
|
|
|
void showchar (u16 coordx, u16 coordy, u8 thechar, u8 attrib);
|
|
|
|
u8 getchar (u16 coordx, u16 coordy);
|
|
|
|
u8 getattrib (u16 coordx, u16 coordy);
|
2018-10-13 11:25:55 +02:00
|
|
|
void writepxl (u16 x, u16 y, u32 color);
|
|
|
|
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color);
|
2018-10-13 13:23:00 +02:00
|
|
|
void changemode(u8 mode);
|
2018-10-14 16:18:51 +02:00
|
|
|
u32 egatorgb(u8 ega);
|
2018-10-14 11:14:34 +02:00
|
|
|
u8 egatovga(u8 ega);
|
2007-04-02 16:02:21 +02:00
|
|
|
|
2018-10-12 20:37:26 +02:00
|
|
|
/* Fonctions de console */
|
|
|
|
void changevc(u8 vc);
|
2007-04-02 15:39:09 +02:00
|
|
|
void putchar(u8 thechar);
|
2018-10-07 14:53:48 +02:00
|
|
|
void clearscreen(void);
|
2018-10-13 13:23:00 +02:00
|
|
|
u16 getwidth(void);
|
|
|
|
u16 getheight(void);
|
2018-10-12 20:37:26 +02:00
|
|
|
|
|
|
|
/* Fonctions de haut niveau */
|
2018-08-29 10:12:00 +02:00
|
|
|
u32 print(u8* string);
|
|
|
|
u32 printf (const u8 *string, ...);
|
2018-10-08 21:50:40 +02:00
|
|
|
u32 sprintf(u8 *variable, const u8 *string, ...);
|
|
|
|
u32 snprintf(u8 *variable, u32 maxsize, const u8 *string, ...);
|
|
|
|
u32 vprintf(const u8 * string, va_list args);
|
|
|
|
u32 vsprintf(u8 *variable, const u8 *string, va_list args);
|
|
|
|
u32 vsnprintf(u8 *variable, u32 maxsize, const u8 *string, va_list args);
|
2018-10-12 20:37:26 +02:00
|
|
|
|
2018-09-27 21:01:02 +02:00
|
|
|
u8* itoa(u64 num, u8* str, u8 base, u64 dim, u8 achar);
|
2018-09-28 00:03:45 +02:00
|
|
|
u8* sitoa(u64 num, u8 * str, u64 dim);
|
2018-10-05 22:56:58 +02:00
|
|
|
u8* rtoadouble(double num, u8 * str, u8 precisioni , u8 precisionf);
|
|
|
|
u8* rtoasingle(float num, u8 * str, u8 precisioni , u8 precisionf);
|
2018-10-08 21:50:40 +02:00
|
|
|
u32 format(const u8 * string, va_list args, u32 maxsize, u32 (*fonction)(u8* src, u8** dest, u32 len), u8* dest);
|
2018-10-12 20:37:26 +02:00
|
|
|
|
|
|
|
/* Fonction pour gérer le pilote */
|
|
|
|
void initdriver();
|
|
|
|
void registerdriver(videofonction *pointer);
|
|
|
|
void apply_bestdriver(void);
|
|
|
|
void apply_nextdriver(void);
|
|
|
|
void apply_driver(u8* name);
|
|
|
|
void apply_nextvideomode(void);
|
|
|
|
|
|
|
|
/* Fonctions du pilote */
|
|
|
|
u8 *(*detect_hardware) (void);
|
|
|
|
u8 (*setvideo_mode) (u8 mode);
|
|
|
|
u8 *(*getvideo_drivername) (void);
|
|
|
|
u8 *(*getvideo_capabilities) (void);
|
|
|
|
videoinfos *(*getvideo_info) (void);
|
2018-10-13 11:25:55 +02:00
|
|
|
u32 (*mem_to_video) (void *src,u32 dst, u32 size, bool increment_src);
|
|
|
|
u32 (*video_to_mem) (u32 src,void *dst, u32 size);
|
|
|
|
u32 (*video_to_video) (u32 src,u32 dst, u32 size);
|
2018-10-12 20:37:26 +02:00
|
|
|
void (*wait_vretrace) (void);
|
|
|
|
void (*wait_hretrace) (void);
|
|
|
|
void (*page_set) (u8 page);
|
|
|
|
void (*page_show) (u8 page);
|
|
|
|
void (*page_split) (u16 y);
|
|
|
|
void (*cursor_enable) (void);
|
|
|
|
void (*cursor_disable) (void);
|
|
|
|
void (*cursor_set) (u16 x,u16 y);
|
|
|
|
u32 (*font_load) (u8 * def, u8 size, u8 font);
|
|
|
|
void (*font1_set) (u8 num);
|
|
|
|
void (*font2_set) (u8 num);
|
|
|
|
void (*blink_enable) (void);
|
|
|
|
void (*blink_disable) (void);
|
2018-10-12 22:31:34 +02:00
|
|
|
|
|
|
|
#endif
|