~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/arch/x86/include/bits/uart.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 */