summaryrefslogtreecommitdiff
path: root/driver/serial.h
blob: cd767077946724d61bd7a6f60b49bd3731ed3434 (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
#ifndef FOOLOS_SERIAL_H
#define FOOLOS_SERIAL_H


/**
 * @file
 * MINIMALISTIC SERIAL PORT DRIVER for COM1
 * ========================================
 * Call serial_init() **once** before _reading_ or _writing_ with 
 * serial_read() or serial_write(). 
 *
 * Blocking
 * --------
 * Please note that the calls will block if the buffers 
 * are full (and not read on the other end) _or_ no data is available 
 * for reading.
 *
 * Dependencies
 * ------------
 * The implmentation relies on x86_inb() and x86_outb() 
 * to be defined in _asm/x86.h_.
 *
 * Reference
 * ---------
 * The implementation was ruthlessly copied from here: https://wiki.osdev.org/Serial_Ports
 */

// We need uint8_t and uint_32t //
#include <stdint.h>

/** Initialize COM1 **/
void serial_init();

/** read one byte from COM1 (blocking) **/
uint8_t serial_read();
 
/** write one byte from COM1 (blocking) **/
void serial_write(uint8_t a);


#endif