2009-07-27 16:23:08 +00:00
|
|
|
/*
|
2012-05-06 16:26:08 -05:00
|
|
|
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2009-07-27 16:23:08 +00:00
|
|
|
*
|
2012-05-06 16:26:08 -05:00
|
|
|
* Authors:
|
|
|
|
* Alexander von Gluck, kallisti5@unixzen.com
|
2009-07-27 16:23:08 +00:00
|
|
|
*/
|
|
|
|
#ifndef __DEV_UART_H
|
|
|
|
#define __DEV_UART_H
|
|
|
|
|
2012-05-06 16:26:08 -05:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "uart_8250.h"
|
2012-05-06 19:30:03 -05:00
|
|
|
#include "uart_pl011.h"
|
2012-05-06 16:26:08 -05:00
|
|
|
|
|
|
|
|
2009-07-27 16:23:08 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-05-06 16:26:08 -05:00
|
|
|
struct uart_info {
|
|
|
|
addr_t base;
|
|
|
|
|
|
|
|
// Pointers to functions based on port type
|
|
|
|
void (*init)(addr_t base);
|
|
|
|
void (*init_early)(void);
|
|
|
|
void (*init_port)(addr_t base, uint baud);
|
2012-05-06 17:02:42 -05:00
|
|
|
int (*putchar)(addr_t base, char c);
|
|
|
|
int (*getchar)(addr_t base, bool wait);
|
2012-05-06 16:26:08 -05:00
|
|
|
void (*flush_tx)(addr_t base);
|
|
|
|
void (*flush_rx)(addr_t base);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
uart_info* uart_create(void);
|
|
|
|
void uart_destroy();
|
|
|
|
addr_t uart_base_port(int port);
|
|
|
|
addr_t uart_debug_port(void);
|
2009-07-27 16:23:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|