blob: c6841f29cb943a7ea6873d3190c98c6a3859e8b0 (
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
|
#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
|