summaryrefslogtreecommitdiff
path: root/src/serial.c
blob: 3ef1a432ffd210881a3ec79f76662368660a773b (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
#include "serial.h"
#include "string.h"

void serial_init( serial_t *serial )
{
	memset( serial, 0, sizeof( serial_t ) );

	port8_init( &serial->port_3F8, 0x3F8 );
	port8_init( &serial->port_3FD, 0x3FD );
}

void serial_put_char( serial_t *serial, const char c )
{
	uint8_t status;
	do {
		status = port8_read( &serial->port_3FD );
	} while( ( status & 0x20 ) == 0 );
	
	port8_write( &serial->port_3F8, c );
}

    //~ outb(0x3FB, 0x83); /* DLAB = 1 */
    //~ outb(0x3F8, 0x0C); /* 9600 Baud */
    //~ outb(0x3F9, 0x00);
    //~ outb(0x3FB, 0x03); /* DLAB = 0 */
    //~ outb(0x3F9, 0x00); /* keine Interrupts auslösen */
    //~ outb(0x3FA, 0x00); /* FIFOs deaktiviert (8250, 16450) */
    //~ outb(0x3FC, 0x00); /* Loopback deaktivieren, Aux1 & Aux2 deaktivieren */

    //~ outb(0xe9, c);
    //~ outb(0x3f8, c);
    //~ while ((inb(0x3fd) & 0x20) == 0) asm("nop");

//~ int is_transmit_empty() {
   //~ return inb(PORT + 5) & 0x20;
//~ }
 
//~ void write_serial(char a) {
   //~ while (is_transmit_empty() == 0);

 
   //~ outb(PORT,a);
//~ }