iPXE
uart.h
Go to the documentation of this file.
00001 #ifndef _BITS_UART_H
00002 #define _BITS_UART_H
00003 
00004 /** @file
00005  *
00006  * 16550-compatible UART
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/io.h>
00014 
00015 /**
00016  * Write to UART register
00017  *
00018  * @v uart              UART
00019  * @v addr              Register address
00020  * @v data              Data
00021  */
00022 static inline __attribute__ (( always_inline )) void
00023 uart_write ( struct uart *uart, unsigned int addr, uint8_t data ) {
00024         outb ( data, ( uart->base + addr ) );
00025 }
00026 
00027 /**
00028  * Read from UART register
00029  *
00030  * @v uart              UART
00031  * @v addr              Register address
00032  * @ret data            Data
00033  */
00034 static inline __attribute__ (( always_inline )) uint8_t
00035 uart_read ( struct uart *uart, unsigned int addr ) {
00036         return inb ( uart->base + addr );
00037 }
00038 
00039 extern int uart_select ( struct uart *uart, unsigned int port );
00040 
00041 #endif /* _BITS_UART_H */