MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_cga_init

Function rt_cga_init

bsp/x86/drivers/console.c:39–67  ·  view source on GitHub ↗

* This function initializes cga * */

Source from the content-addressed store, hash-verified

37 *
38 */
39void rt_cga_init(void)
40{
41 rt_uint16_t volatile *cp;
42 rt_uint16_t was;
43 rt_uint32_t pos;
44
45 cp = (rt_uint16_t *) (CGA_BUF);
46 was = *cp;
47 *cp = (rt_uint16_t) 0xA55A;
48 if (*cp != 0xA55A)
49 {
50 cp = (rt_uint16_t *) (MONO_BUF);
51 addr_6845 = MONO_BASE;
52 }
53 else
54 {
55 *cp = was;
56 addr_6845 = CGA_BASE;
57 }
58
59 /* Extract cursor location */
60 outb(addr_6845, 14);
61 pos = inb(addr_6845+1) << 8;
62 outb(addr_6845, 15);
63 pos |= inb(addr_6845+1);
64
65 crt_buf = (rt_uint16_t *)cp;
66 crt_pos = pos;
67}
68
69/**
70 * This function will write a character to cga

Callers 1

rt_hw_console_initFunction · 0.85

Calls 2

outbFunction · 0.85
inbFunction · 0.85

Tested by

no test coverage detected