vga.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* VGA: VESA LFB (from boot) or legacy mode 13h / text mode 03h. */
  2. #ifndef VGA_H
  3. #define VGA_H
  4. /* Legacy mode 13h (320x200 256-color); used only when no VESA. */
  5. #define VGA_GFX_WIDTH 320
  6. #define VGA_GFX_HEIGHT 200
  7. /* Boot video info at 0x600 (written by boot.S in safe conventional memory).
  8. Layout: valid(1) width(2) height(2) pitch(2) bpp(1) lfb_base(4) = 12 bytes. */
  9. struct vga_boot_fb_info {
  10. unsigned char valid;
  11. unsigned short width;
  12. unsigned short height;
  13. unsigned short pitch;
  14. unsigned char bpp;
  15. unsigned int lfb_base;
  16. } __attribute__((packed));
  17. #define VGA_BOOT_FB ((volatile struct vga_boot_fb_info *)0x600)
  18. void vga_set_mode_13(void);
  19. void vga_set_mode_text(void);
  20. void vga_put_pixel(int x, int y, unsigned char color);
  21. void vga_clear(unsigned char color);
  22. /* LFB API (use when VESA valid). RGB 0..255. */
  23. unsigned int vga_fb_width(void);
  24. unsigned int vga_fb_height(void);
  25. unsigned int vga_fb_pitch(void);
  26. unsigned int vga_fb_bpp(void);
  27. void *vga_fb_ptr(void);
  28. int vga_has_vesa(void);
  29. void vga_put_pixel_rgb(unsigned int x, unsigned int y, unsigned int r, unsigned int g, unsigned int b);
  30. void vga_clear_rgb(unsigned int r, unsigned int g, unsigned int b);
  31. #endif