You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uart.h 777B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _BITS_UART_H
  2. #define _BITS_UART_H
  3. /** @file
  4. *
  5. * 16550-compatible UART
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/io.h>
  11. /**
  12. * Write to UART register
  13. *
  14. * @v uart UART
  15. * @v addr Register address
  16. * @v data Data
  17. */
  18. static inline __attribute__ (( always_inline )) void
  19. uart_write ( struct uart *uart, unsigned int addr, uint8_t data ) {
  20. outb ( data, ( uart->base + addr ) );
  21. }
  22. /**
  23. * Read from UART register
  24. *
  25. * @v uart UART
  26. * @v addr Register address
  27. * @ret data Data
  28. */
  29. static inline __attribute__ (( always_inline )) uint8_t
  30. uart_read ( struct uart *uart, unsigned int addr ) {
  31. return inb ( uart->base + addr );
  32. }
  33. extern int uart_select ( struct uart *uart, unsigned int port );
  34. #endif /* _BITS_UART_H */