diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-14 20:48:16 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-14 20:48:16 +0200 |
commit | 8fb9efc08388d3a866cfdf911b07e372de24b556 (patch) | |
tree | 3afaf07e27fb37bd5a88b187d505137abdaa817b /src/drivers/video/vga.h | |
parent | 7a3b38c6462587657f20d684a833f0264de230b5 (diff) | |
download | abaos-8fb9efc08388d3a866cfdf911b07e372de24b556.tar.gz abaos-8fb9efc08388d3a866cfdf911b07e372de24b556.tar.bz2 |
got switch to graphical VGA mode working
Diffstat (limited to 'src/drivers/video/vga.h')
-rw-r--r-- | src/drivers/video/vga.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/drivers/video/vga.h b/src/drivers/video/vga.h index 9b7f5c3..7c710c3 100644 --- a/src/drivers/video/vga.h +++ b/src/drivers/video/vga.h @@ -1,6 +1,8 @@ #ifndef VGA_H #define VGA_H +#include <stdbool.h> + #include "string.h" #include "interrupts.h" @@ -8,11 +10,30 @@ #include "driver.h" +#define NOF_MODE_REGS 66 + +typedef struct { + int x; + int y; + int color_depth; + uint8_t regs[NOF_MODE_REGS]; +} vga_mode_t; + typedef struct { driver_t base; interrupt_t *interrupts; - port8_t command_port; - port8_t data_port; + port8_t misc_port; + port8_t crtc_index_port; + port8_t crtc_data_port; + port8_t sequencer_index_port; + port8_t sequencer_data_port; + port8_t graphics_controller_index_port; + port8_t graphics_controller_data_port; + port8_t attribute_controller_index_port; + port8_t attribute_controller_read_port; + port8_t attribute_controller_write_port; + port8_t attribute_controller_reset_port; + vga_mode_t mode; void *context; } vga_t; @@ -26,4 +47,19 @@ void vga_deactivate( void *obj ); void vga_deinit( void *obj ); void vga_print_info( void *obj ); +vga_mode_t vga_make_mode( const int x, const int y, const int color_depth ); +bool vga_set_mode( vga_t *vga, const vga_mode_t mode ); +bool vga_supports_mode( const vga_mode_t mode ); + +typedef struct { + int R; + int G; + int B; +} vga_color_t; + +vga_color_t vga_make_RGB( int R, int G, int B ); + +void vga_set_pixel( vga_t *vga, const int x, const int y, const vga_color_t color ); +void vga_draw_rectangle( vga_t *vga, const int x, const int y, const int w, const int h, const vga_color_t color ); + #endif // VGA_H |