2012-05-17 06:03:16 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Alexander von Gluck, kallisti5@unixzen.com
|
|
|
|
*/
|
|
|
|
#ifndef __DEV_UART_PL011_H
|
|
|
|
#define __DEV_UART_PL011_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2012-05-17 12:31:02 +04:00
|
|
|
|
2012-05-17 06:03:16 +04:00
|
|
|
#include <SupportDefs.h>
|
2012-05-17 12:31:02 +04:00
|
|
|
|
2012-05-17 06:03:16 +04:00
|
|
|
#include <arch/generic/debug_uart.h>
|
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
|
2012-05-17 06:03:16 +04:00
|
|
|
class ArchUARTPL011 : public DebugUART {
|
|
|
|
public:
|
|
|
|
ArchUARTPL011(addr_t base, int64 clock);
|
|
|
|
~ArchUARTPL011();
|
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
void InitEarly();
|
|
|
|
void InitPort(uint32 baud);
|
2012-05-17 06:03:16 +04:00
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
void Enable();
|
|
|
|
void Disable();
|
2012-05-17 06:03:16 +04:00
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
int PutChar(char c);
|
|
|
|
int GetChar(bool wait);
|
2012-05-17 06:03:16 +04:00
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
void FlushTx();
|
|
|
|
void FlushRx();
|
2012-05-17 06:03:16 +04:00
|
|
|
|
|
|
|
private:
|
2012-05-17 12:31:02 +04:00
|
|
|
void Out32(int reg, uint32 value);
|
|
|
|
uint32 In32(int reg);
|
|
|
|
virtual void Barrier();
|
2012-05-17 06:03:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock);
|
|
|
|
|
2012-05-17 12:31:02 +04:00
|
|
|
|
2012-05-17 06:03:16 +04:00
|
|
|
#endif
|