iPXE
uart.h
Go to the documentation of this file.
1 #ifndef _BITS_UART_H
2 #define _BITS_UART_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 uart UART
19  * @v addr Register address
20  * @v data Data
21  */
22 static inline __attribute__ (( always_inline )) void
23 uart_write ( struct uart *uart, unsigned int addr, uint8_t data ) {
24  outb ( data, ( uart->base + addr ) );
25 }
26 
27 /**
28  * Read from UART register
29  *
30  * @v uart UART
31  * @v addr Register address
32  * @ret data Data
33  */
34 static inline __attribute__ (( always_inline )) uint8_t
35 uart_read ( struct uart *uart, unsigned int addr ) {
36  return inb ( uart->base + addr );
37 }
38 
39 extern int uart_select ( struct uart *uart, unsigned int port );
40 
41 #endif /* _BITS_UART_H */
iPXE I/O API
static __attribute__((always_inline)) void uart_write(struct uart *uart
Write to UART register.
static unsigned int addr
Definition: uart.h:23
A 16550-compatible UART.
Definition: uart.h:80
void * base
I/O port base address.
Definition: uart.h:82
static unsigned int uint8_t data
Definition: uart.h:23
int uart_select(struct uart *uart, unsigned int port)
Select UART port.
Definition: x86_uart.c:50
u8 port
Port number.
Definition: CIB_PRM.h:31
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void uart_write(struct uart *uart, unsigned int addr, uint8_t data)
uint8_t uart_read(struct uart *uart, unsigned int addr)
unsigned char uint8_t
Definition: stdint.h:10
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define outb(data, io_addr)
Definition: io.h:309