haiku/headers/private/kernel/arch/generic/debug_uart.h
Alexander von Gluck IV 7068c45485 system/uart: refactor debug_uart, fix arm uart
* Drop ArchUART8260 layer to reduce complexity. It's whole
  existance in life was to adjust the mmio alignment.
* Fold architecture mmio alignment into DebugUart
* We could potentially pass a Init(int mmioAlignment)
  arg in the future if the macros get too messy.
* Move Barrier code back a layer into DebugUART
* Fixes the arm uart and EFI build

Change-Id: I0f127d902993e9f6e6a03cac8c7c37c0363134bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4422
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-09-06 20:37:14 +00:00

55 lines
1.1 KiB
C++

/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* François Revol, revol@free.fr
*/
#ifndef _KERNEL_ARCH_DEBUG_UART_H
#define _KERNEL_ARCH_DEBUG_UART_H
#include <sys/types.h>
#include <SupportDefs.h>
class DebugUART {
public:
DebugUART(addr_t base, int64 clock)
: fBase(base),
fClock(clock),
fEnabled(true) {};
~DebugUART() {};
virtual void InitEarly() {};
virtual void Init() {};
virtual void InitPort(uint32 baud) {};
virtual void Enable() { fEnabled = true; }
virtual void Disable() { fEnabled = false; }
virtual int PutChar(char c) = 0;
virtual int GetChar(bool wait) = 0;
virtual void FlushTx() = 0;
virtual void FlushRx() = 0;
addr_t Base() const { return fBase; }
int64 Clock() const { return fClock; }
bool Enabled() const { return fEnabled; }
protected:
virtual void Out8(int reg, uint8 value);
virtual uint8 In8(int reg);
virtual void Barrier();
private:
addr_t fBase;
int64 fClock;
bool fEnabled;
};
#endif /* _KERNEL_ARCH_DEBUG_UART_H */