The uart virtual address changes as soon as we apply the kernel memory map. gUART is used only after that, from serial_init() onwards. So it should use the virtual address, and not the physical address it was previously created with while parsing the FDT. Change-Id: I8c8a024fe564b49d6555f8e48f5ab31652d30708 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10068 Reviewed-by: Fredrik Holmqvist <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/*
|
|
* Copyright 2012 Haiku, Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* François Revol, [email protected]
|
|
*/
|
|
#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;
|
|
|
|
void SetBase(addr_t base) { fBase = base; }
|
|
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 */
|