uart: Style Cleanup, no functional change
This commit is contained in:
@@ -10,33 +10,37 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#include <arch/generic/debug_uart.h>
|
#include <arch/generic/debug_uart.h>
|
||||||
|
|
||||||
|
|
||||||
class ArchUARTPL011 : public DebugUART {
|
class ArchUARTPL011 : public DebugUART {
|
||||||
public:
|
public:
|
||||||
ArchUARTPL011(addr_t base, int64 clock);
|
ArchUARTPL011(addr_t base, int64 clock);
|
||||||
~ArchUARTPL011();
|
~ArchUARTPL011();
|
||||||
|
|
||||||
void InitEarly();
|
void InitEarly();
|
||||||
void InitPort(uint32 baud);
|
void InitPort(uint32 baud);
|
||||||
|
|
||||||
void Enable();
|
void Enable();
|
||||||
void Disable();
|
void Disable();
|
||||||
|
|
||||||
int PutChar(char c);
|
int PutChar(char c);
|
||||||
int GetChar(bool wait);
|
int GetChar(bool wait);
|
||||||
|
|
||||||
void FlushTx();
|
void FlushTx();
|
||||||
void FlushRx();
|
void FlushRx();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Out32(int reg, uint32 value);
|
void Out32(int reg, uint32 value);
|
||||||
uint32 In32(int reg);
|
uint32 In32(int reg);
|
||||||
virtual void Barrier();
|
virtual void Barrier();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock);
|
ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
#define _KERNEL_ARCH_DEBUG_UART_H
|
#define _KERNEL_ARCH_DEBUG_UART_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
class DebugUART {
|
class DebugUART {
|
||||||
public:
|
public:
|
||||||
@@ -21,35 +22,35 @@ public:
|
|||||||
fEnabled(true) {};
|
fEnabled(true) {};
|
||||||
~DebugUART() {};
|
~DebugUART() {};
|
||||||
|
|
||||||
virtual void InitEarly() {};
|
virtual void InitEarly() {};
|
||||||
virtual void Init() {};
|
virtual void Init() {};
|
||||||
virtual void InitPort(uint32 baud) {};
|
virtual void InitPort(uint32 baud) {};
|
||||||
|
|
||||||
virtual void Enable() { fEnabled = true; }
|
virtual void Enable() { fEnabled = true; }
|
||||||
virtual void Disable() { fEnabled = false; }
|
virtual void Disable() { fEnabled = false; }
|
||||||
|
|
||||||
virtual int PutChar(char c) = 0;
|
virtual int PutChar(char c) = 0;
|
||||||
virtual int GetChar(bool wait) = 0;
|
virtual int GetChar(bool wait) = 0;
|
||||||
|
|
||||||
virtual void FlushTx() = 0;
|
virtual void FlushTx() = 0;
|
||||||
virtual void FlushRx() = 0;
|
virtual void FlushRx() = 0;
|
||||||
|
|
||||||
addr_t Base() const { return fBase; }
|
addr_t Base() const { return fBase; }
|
||||||
int64 Clock() const { return fClock; }
|
int64 Clock() const { return fClock; }
|
||||||
bool Enabled() const { return fEnabled; }
|
bool Enabled() const { return fEnabled; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// default MMIO
|
// default MMIO
|
||||||
virtual void Out8(int reg, uint8 value)
|
virtual void Out8(int reg, uint8 value)
|
||||||
{ *((uint8 *)Base() + reg) = value; }
|
{ *((uint8 *)Base() + reg) = value; }
|
||||||
virtual uint8 In8(int reg)
|
virtual uint8 In8(int reg)
|
||||||
{ return *((uint8 *)Base() + reg); }
|
{ return *((uint8 *)Base() + reg); }
|
||||||
virtual void Barrier() {}
|
virtual void Barrier() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
addr_t fBase;
|
addr_t fBase;
|
||||||
int64 fClock;
|
int64 fClock;
|
||||||
bool fEnabled;
|
bool fEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
#define _KERNEL_ARCH_DEBUG_UART_8250_H
|
#define _KERNEL_ARCH_DEBUG_UART_8250_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#include "debug_uart.h"
|
#include "debug_uart.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -20,18 +21,19 @@ public:
|
|||||||
DebugUART8250(addr_t base, int64 clock);
|
DebugUART8250(addr_t base, int64 clock);
|
||||||
~DebugUART8250();
|
~DebugUART8250();
|
||||||
|
|
||||||
void InitEarly();
|
void InitEarly();
|
||||||
void Init();
|
void Init();
|
||||||
void InitPort(uint32 baud);
|
void InitPort(uint32 baud);
|
||||||
|
|
||||||
int PutChar(char c);
|
int PutChar(char c);
|
||||||
int GetChar(bool wait);
|
int GetChar(bool wait);
|
||||||
|
|
||||||
void FlushTx();
|
void FlushTx();
|
||||||
void FlushRx();
|
void FlushRx();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock);
|
extern DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _KERNEL_ARCH_DEBUG_UART_8250_H */
|
#endif /* _KERNEL_ARCH_DEBUG_UART_8250_H */
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ ArchUART8250::~ArchUART8250()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArchUART8250::InitEarly()
|
ArchUART8250::InitEarly()
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,8 @@ ArchUART8250::InitEarly()
|
|||||||
#warning INTITIALIZE UART!!!!!
|
#warning INTITIALIZE UART!!!!!
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArchUART8250::Out8(int reg, uint8 value)
|
ArchUART8250::Out8(int reg, uint8 value)
|
||||||
{
|
{
|
||||||
@@ -75,4 +78,3 @@ DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock)
|
|||||||
ArchUART8250 *uart = new(buffer) ArchUART8250(base, clock);
|
ArchUART8250 *uart = new(buffer) ArchUART8250(base, clock);
|
||||||
return uart;
|
return uart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,8 +210,6 @@ ArchUARTPL011::Barrier()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArchUARTPL011::InitPort(uint32 baud)
|
ArchUARTPL011::InitPort(uint32 baud)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user