summaryrefslogtreecommitdiff
path: root/driver/vesa.h
blob: 7122d68d0516e25e95648a761efd3935909300c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdint.h>

void vesa_update_cursor(uint32_t col,uint32_t row);
void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y);

typedef struct foolfont_struct
{
    uint8_t line[10]; //every single fool font consists of 10 lines a 8 bit

}foolfont;

typedef struct vbeinfo_struct{
   char VbeSignature[4];             // == "VESA"
   uint16_t VbeVersion;                 // == 0x0300 for VBE 3.0
   uint16_t OemStringPtr[2];            // isa vbeFarPtr
   uint8_t Capabilities[4];
   uint16_t VideoModePtr[2];         // isa vbeFarPtr
   uint16_t TotalMemory;             // as # of 64KB blocks
}vbeinfo;

typedef struct ModeInfoBlock {
  uint16_t attributes;
  uint8_t winA,winB;
  uint16_t granularity;
  uint16_t winsize;
  uint16_t segmentA, segmentB;
  uint16_t realFctPtr[2];
//  VBE_FAR(realFctPtr);
  uint16_t pitch; // bytes per scanline
 
  uint16_t Xres, Yres;
  uint8_t Wchar, Ychar, planes, bpp, banks;
  uint8_t memory_model, bank_size, image_pages;
  uint8_t reserved0;
 
  uint8_t red_mask, red_position;
  uint8_t green_mask, green_position;
  uint8_t blue_mask, blue_position;
  uint8_t rsv_mask, rsv_position;
  uint8_t directcolor_attributes;
 
  volatile  uint32_t physbase;  // your LFB (Linear Framebuffer) address ;)
  uint32_t reserved1;
  uint16_t reserved2;
}vbemodeinfo;

uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont);

void PutConsoleChar(char c, int color);
void PutConsole(char *str, int color);
void vesa_put_rect(int x, int y, int w , int h, int color);
void PutFont(char c, int x,int y, int color_fg,int color_bg);