3 class Cuart : public Iext {
5 Cuart() : m_writeAddress(0), m_fetchCount(0), m_readCount(0), m_recRdy(0), m_txRdy(0), m_recVal(0), m_txVal(0) {};
7 void loadData(const int address, CDat value);
8 CDat readData(const int);
9 void parseInput(const vector<string>& in);
11 int m_writeAddress, m_fetchCount, m_readCount;
12 bool m_recRdy, m_txRdy;
13 CDat m_recVal, m_txVal;
17 void Cuart::parseInput(const vector<string>& in)
20 if((in[1].compare("h") == 0)) {
21 cout << "UART:" << endl;
22 cout << "\textension uart r 0xXX \t -- to load the module with a value" << endl;
23 cout << "\textension uart f \t-- to load a value from the module" << endl;
29 if(in[1].compare("uart") == 0) {
30 if(in[2].compare("r") == 0) {
34 if(in[3].substr(0,2) == "0x") {
35 m_recVal = lexical_cast<uint32_from_hex>(in[3]);
38 m_recVal = lexical_cast<unsigned int>(in[3]);
40 cout << "UART: loaded 0x" << std::hex << m_recVal << std::dec << endl;
45 else if(in[2].compare("f") == 0) {
46 cout << "UART: sended 0x" << std::hex << m_txVal << std::dec << endl;
51 else if(in[2].compare("s") == 0) {
52 cout << "UART:" << endl;
53 cout << "\ttx busy: " << m_txRdy << endl;
54 cout << "\trx_newdata: " << m_recRdy << endl;
59 CDat Cuart::readData(const int address)
61 if(address == 0x2000) {
63 /* cout << "rx: " << m_recRdy << endl;
64 cout << "tx: " << m_txRdy << endl;
65 CDat helpme = m_recRdy;
68 cout << "rx<<1 | tx: " << helpme << endl;
77 if(m_fetchCount >= 5) {
81 cout << "UART: force fetched 0x" << std::hex << m_txVal << std::dec << endl;
83 if(m_readCount >= 5) {
87 cout << "UART: force inserted 0x48 ('H')" << endl;
90 return (m_recRdy<<1)|(m_txRdy);
92 else if(address == 0x2008) {
96 else if(address == 0x200c) {
106 void Cuart::loadData(const int address, CDat value)
109 if(address == 0x2000) {
112 else if(address == 0x2008) {
114 cout << "UART: byte ready to fetch" << endl;
120 else if(address == 0x200c) {