From eb93f2661d536dcb074a0a4e49842227e3023427 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 17 May 2012 03:31:02 -0500 Subject: [PATCH] uart: Style Cleanup, no functional change --- .../private/kernel/arch/arm/arch_uart_pl011.h | 26 +++++++------ .../private/kernel/arch/generic/debug_uart.h | 39 ++++++++++--------- .../kernel/arch/generic/debug_uart_8250.h | 18 +++++---- src/system/kernel/arch/arm/arch_uart_8250.cpp | 4 +- .../kernel/arch/arm/arch_uart_pl011.cpp | 2 - 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/headers/private/kernel/arch/arm/arch_uart_pl011.h b/headers/private/kernel/arch/arm/arch_uart_pl011.h index 19a25e27f8..de335baccd 100644 --- a/headers/private/kernel/arch/arm/arch_uart_pl011.h +++ b/headers/private/kernel/arch/arm/arch_uart_pl011.h @@ -10,33 +10,37 @@ #include + #include + #include + class ArchUARTPL011 : public DebugUART { public: ArchUARTPL011(addr_t base, int64 clock); ~ArchUARTPL011(); - void InitEarly(); - void InitPort(uint32 baud); + void InitEarly(); + void InitPort(uint32 baud); - void Enable(); - void Disable(); + void Enable(); + void Disable(); - int PutChar(char c); - int GetChar(bool wait); + int PutChar(char c); + int GetChar(bool wait); - void FlushTx(); - void FlushRx(); + void FlushTx(); + void FlushRx(); private: - void Out32(int reg, uint32 value); - uint32 In32(int reg); - virtual void Barrier(); + void Out32(int reg, uint32 value); + uint32 In32(int reg); + virtual void Barrier(); }; ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock); + #endif diff --git a/headers/private/kernel/arch/generic/debug_uart.h b/headers/private/kernel/arch/generic/debug_uart.h index 4a2cf0398b..3d2fae7e35 100644 --- a/headers/private/kernel/arch/generic/debug_uart.h +++ b/headers/private/kernel/arch/generic/debug_uart.h @@ -9,9 +9,10 @@ #define _KERNEL_ARCH_DEBUG_UART_H -#include #include +#include + class DebugUART { public: @@ -21,35 +22,35 @@ public: fEnabled(true) {}; ~DebugUART() {}; - virtual void InitEarly() {}; - virtual void Init() {}; - virtual void InitPort(uint32 baud) {}; + virtual void InitEarly() {}; + virtual void Init() {}; + virtual void InitPort(uint32 baud) {}; - virtual void Enable() { fEnabled = true; } - virtual void Disable() { fEnabled = false; } + virtual void Enable() { fEnabled = true; } + virtual void Disable() { fEnabled = false; } - virtual int PutChar(char c) = 0; - virtual int GetChar(bool wait) = 0; + virtual int PutChar(char c) = 0; + virtual int GetChar(bool wait) = 0; - virtual void FlushTx() = 0; - virtual void FlushRx() = 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; } + addr_t Base() const { return fBase; } + int64 Clock() const { return fClock; } + bool Enabled() const { return fEnabled; } protected: // default MMIO - virtual void Out8(int reg, uint8 value) + virtual void Out8(int reg, uint8 value) { *((uint8 *)Base() + reg) = value; } - virtual uint8 In8(int reg) + virtual uint8 In8(int reg) { return *((uint8 *)Base() + reg); } - virtual void Barrier() {} + virtual void Barrier() {} private: - addr_t fBase; - int64 fClock; - bool fEnabled; + addr_t fBase; + int64 fClock; + bool fEnabled; }; diff --git a/headers/private/kernel/arch/generic/debug_uart_8250.h b/headers/private/kernel/arch/generic/debug_uart_8250.h index d4887c91c0..e7f211f2a5 100644 --- a/headers/private/kernel/arch/generic/debug_uart_8250.h +++ b/headers/private/kernel/arch/generic/debug_uart_8250.h @@ -9,9 +9,10 @@ #define _KERNEL_ARCH_DEBUG_UART_8250_H -#include #include +#include + #include "debug_uart.h" @@ -20,18 +21,19 @@ public: DebugUART8250(addr_t base, int64 clock); ~DebugUART8250(); - void InitEarly(); - void Init(); - void InitPort(uint32 baud); + void InitEarly(); + void Init(); + void InitPort(uint32 baud); - int PutChar(char c); - int GetChar(bool wait); + int PutChar(char c); + int GetChar(bool wait); - void FlushTx(); - void FlushRx(); + void FlushTx(); + void FlushRx(); }; extern DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock); + #endif /* _KERNEL_ARCH_DEBUG_UART_8250_H */ diff --git a/src/system/kernel/arch/arm/arch_uart_8250.cpp b/src/system/kernel/arch/arm/arch_uart_8250.cpp index 94d07d3db2..6e91e6faa7 100644 --- a/src/system/kernel/arch/arm/arch_uart_8250.cpp +++ b/src/system/kernel/arch/arm/arch_uart_8250.cpp @@ -34,6 +34,7 @@ ArchUART8250::~ArchUART8250() { } + void ArchUART8250::InitEarly() { @@ -55,6 +56,8 @@ ArchUART8250::InitEarly() #warning INTITIALIZE UART!!!!! #endif } + + void 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); return uart; } - diff --git a/src/system/kernel/arch/arm/arch_uart_pl011.cpp b/src/system/kernel/arch/arm/arch_uart_pl011.cpp index ea2bc663da..0794324c9e 100644 --- a/src/system/kernel/arch/arm/arch_uart_pl011.cpp +++ b/src/system/kernel/arch/arm/arch_uart_pl011.cpp @@ -210,8 +210,6 @@ ArchUARTPL011::Barrier() } - - void ArchUARTPL011::InitPort(uint32 baud) {