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 );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/io.h>
15
16/**
17 * Write to UART register
18 *
19 * @v ns16550 16550 UART
20 * @v address Register address
21 * @v data Data
22 */
23static inline __attribute__ (( always_inline )) void
24ns16550_write ( struct ns16550_uart *ns16550, unsigned int address,
26
27 iowrite8 ( data, ( ns16550->base + ( address << ns16550->shift ) ) );
28}
29
30/**
31 * Read from UART register
32 *
33 * @v ns16550 16550 UART
34 * @v address Register address
35 * @ret data Data
36 */
37static inline __attribute__ (( always_inline )) uint8_t
38ns16550_read ( struct ns16550_uart *ns16550, unsigned int address ) {
39
40 return ioread8 ( ns16550->base + ( address << ns16550->shift ) );
41}
42
43#endif /* _BITS_NS16550_H */
unsigned char uint8_t
Definition stdint.h:10
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 FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#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
unsigned int shift
Register shift.
Definition ns16550.h:84
void * base
Register base address.
Definition ns16550.h:82