iPXE
ns16550.h
Go to the documentation of this file.
1#ifndef _BITS_NS16550_H
2#define _BITS_NS16550_H
3
4/** @file
5 *
6 * 16550-compatible UART
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12#include <stdint.h>
13#include <ipxe/io.h>
14
15/**
16 * Write to UART register
17 *
18 * @v ns16550 16550 UART
19 * @v address Register address
20 * @v data Data
21 */
22static inline __attribute__ (( always_inline )) void
23ns16550_write ( struct ns16550_uart *ns16550, unsigned int address,
25
26 iowrite8 ( data, ( ns16550->base + address ) );
27}
28
29/**
30 * Read from UART register
31 *
32 * @v ns16550 16550 UART
33 * @v address Register address
34 * @ret data Data
35 */
36static inline __attribute__ (( always_inline )) uint8_t
37ns16550_read ( struct ns16550_uart *ns16550, unsigned int address ) {
38
39 return ioread8 ( ns16550->base + address );
40}
41
42/* Fixed ISA serial port base addresses */
43#define COM1_BASE 0x3f8
44#define COM2_BASE 0x2f8
45#define COM3_BASE 0x3e8
46#define COM4_BASE 0x2e8
47
48/* Fixed ISA serial ports */
49extern struct uart com1;
50extern struct uart com2;
51extern struct uart com3;
52extern struct uart com4;
53
54/* Fixed ISA serial port names */
55#define COM1 &com1
56#define COM2 &com2
57#define COM3 &com3
58#define COM4 &com4
59
60#endif /* _BITS_NS16550_H */
unsigned char uint8_t
Definition stdint.h:10
struct uart com3
struct uart com4
struct uart com2
struct uart com1
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint64_t address
Base address.
Definition ena.h:13
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define __attribute__(x)
Definition compiler.h:10
iPXE I/O API
#define iowrite8(data, io_addr)
Definition io.h:370
#define ioread8(io_addr)
Definition io.h:340
uint8_t ns16550_read(struct ns16550_uart *ns16550, unsigned int address)
void ns16550_write(struct ns16550_uart *ns16550, unsigned int address, uint8_t data)
Dummy COM1 UART for non-x86 platforms.
A 16550-compatible UART.
Definition ns16550.h:80
void * base
Register base address.
Definition ns16550.h:82
A generic UART.
Definition uart.h:17