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 
10 FILE_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  */
22 static inline __attribute__ (( always_inline )) void
23 ns16550_write ( struct ns16550_uart *ns16550, unsigned int address,
25 
26  iowrite8 ( data, ( ns16550->base + ( address << ns16550->shift ) ) );
27 }
28 
29 /**
30  * Read from UART register
31  *
32  * @v ns16550 16550 UART
33  * @v address Register address
34  * @ret data Data
35  */
36 static inline __attribute__ (( always_inline )) uint8_t
37 ns16550_read ( struct ns16550_uart *ns16550, unsigned int address ) {
38 
39  return ioread8 ( ns16550->base + ( address << ns16550->shift ) );
40 }
41 
42 #endif /* _BITS_NS16550_H */
iPXE I/O API
void * base
Register base address.
Definition: ns16550.h:82
unsigned int shift
Register shift.
Definition: ns16550.h:84
uint8_t ioread8(volatile uint8_t *io_addr)
Read byte from I/O-mapped or memory-mapped device.
static unsigned int address
Definition: ns16550.h:23
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void iowrite8(uint8_t data, volatile uint8_t *io_addr)
Write byte to I/O-mapped or memory-mapped device.
A 16550-compatible UART.
Definition: ns16550.h:80
unsigned char uint8_t
Definition: stdint.h:10
uint8_t ns16550_read(struct ns16550_uart *ns16550, unsigned int address)
static __attribute__((always_inline)) void ns16550_write(struct ns16550_uart *ns16550
Write to UART register.
static unsigned int uint8_t data
Definition: ns16550.h:24
void ns16550_write(struct ns16550_uart *ns16550, unsigned int address, uint8_t data)
Dummy COM1 UART for non-x86 platforms.