Main Page | Directories | File List | Globals

textdisp.c

Go to the documentation of this file.
00001 /*
00002  * kernel_drivers/adi_char/textdisp.c
00003  *
00004  * Copyright (c) 2003-2004 Lukasz Dembinski <dembol@nasa.com.pl>
00005  * All Rights Reserved
00006  * 
00007  * Date:        2004/01
00008  * Author:      Lukasz Dembinski
00009  * Info:        textdisp.c core file
00010  * Contact:     mailto: <dembol@nasa.com.pl>
00011  *
00012  */
00013 
00014 #include <agnix/init.h>
00015 #include <agnix/display.h>
00016 #include <agnix/ioport.h>
00017 
00018 #define TEXT_DISP_BASE_ADDR     0xb8000
00019 
00020 struct display_s text_display;
00021 struct display_ops_s text_display_ops;
00022 
00023 int textdisp_putc(struct display_s *disp, char c, int pos_x, int pos_y, char color)
00024 {
00025     int size_x = disp->disp_size_x;
00026     char *addr = (char *)(disp->disp_base_addr) + ((pos_y * size_x + pos_x) << 1);
00027 
00028     *addr = c;
00029     *(addr + 1) = color;    
00030 
00031     return 0;    
00032 }
00033 
00034 int textdisp_init(void) 
00035 {
00036     int i;
00037 
00038     for (i = 0; i < 16; i++) {
00039         inb(0x3da);
00040         outb(i, 0x3c0);
00041         outb(i, 0x3c0);
00042     }
00043     outb(0x20, 0x3c0);
00044     
00045     return 0;
00046 }
00047 
00048 int __init adi_text_display_init(void)
00049 {
00050     text_display_ops.init = textdisp_init;
00051     text_display_ops.putc = textdisp_putc;
00052 
00053     text_display.disp_base_addr = (char *)TEXT_DISP_BASE_ADDR;
00054     text_display.disp_size_x = 80;
00055     text_display.disp_size_y = 25;
00056     text_display.ops = &text_display_ops;
00057 
00058     textdisp_init();
00059 
00060     return 0;
00061 }
00062 
Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix