48 lines
828 B
C++
48 lines
828 B
C++
#ifndef _UART_HH_
|
|
#define _UART_HH_
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
|
|
class OMAP35x_prcm;
|
|
|
|
#include "interfaces.hh"
|
|
|
|
class UART_impl;
|
|
|
|
class UART : public ICharacterDevice {
|
|
public:
|
|
UART(uintptr_t base, int irq);
|
|
~UART();
|
|
|
|
virtual void write(char const* data, int const& len);
|
|
|
|
virtual int read(char *buf, int const& len);
|
|
|
|
private:
|
|
std::unique_ptr<UART_impl> impl_;
|
|
};
|
|
|
|
class EarlyUART : public ICharacterDevice {
|
|
public:
|
|
EarlyUART() {}
|
|
~EarlyUART() {}
|
|
|
|
virtual void write(char const* data, int const& len);
|
|
virtual int read(char *buf, int const& len);
|
|
|
|
private:
|
|
void _wait_txnotfull();
|
|
void _wait_rxnotempty();
|
|
void sendb(char b);
|
|
char recvb();
|
|
|
|
uint8_t volatile& r_data();
|
|
uint8_t volatile& r_lsr();
|
|
uint8_t volatile& r_ssr();
|
|
|
|
static const uintptr_t base_ = 0xfffff000;
|
|
};
|
|
|
|
#endif
|