Skip to content

Commit f8116f8

Browse files
committed
[h89] next phase of bring-up begins.
1 parent 8385fec commit f8116f8

File tree

4 files changed

+42
-18
lines changed

4 files changed

+42
-18
lines changed

lib/bus/h89/H89IOChannel.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "H89IOChannel.h"
2+
#include "h89.h"
3+
4+
size_t H89IOChannel::dataOut(const void *buffer, size_t length)
5+
{
6+
SYSTEM_BUS.port_putbuf(buffer,length);
7+
}
8+
9+
void H89IOChannel::updateFIFO()
10+
{
11+
while(SYSTEM_BUS.bus_available())
12+
{
13+
_fifo += SYSTEM_BUS.port_getc();
14+
}
15+
}

lib/bus/h89/H89IOChannel.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "IOChannel.h"
2+
3+
class H89IOChannel : public IOChannel
4+
{
5+
6+
protected:
7+
virtual size_t dataOut(const void *buffer, size_t length) = 0;
8+
virtual void updateFIFO() = 0;
9+
};

lib/bus/h89/h89.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ int systemBus::port_putc(uint8_t c)
164164
* @param len Length of buffer to send
165165
* @return number of bytes actually sent.
166166
*/
167-
uint16_t systemBus::port_putbuf(void *buf, uint16_t len)
167+
uint16_t systemBus::port_putbuf(const void *buf, uint16_t len)
168168
{
169169
uint16_t l = 0;
170170
uint8_t *p = (uint8_t *)buf;

lib/bus/h89/h89.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,6 @@ class systemBus
9595
private:
9696
std::map<uint8_t, virtualDevice *> _daisyChain;
9797

98-
int bus_available();
99-
100-
// returns signed int with data or -1 if no data is available
101-
int port_getc();
102-
103-
// return data if it arrives before timeout or -1 if timeout expires
104-
int port_getc_timeout(uint16_t timeout);
105-
106-
// returns length of data received, if timeout expires returns all data received until then
107-
uint16_t port_getbuf(void *buf, uint16_t len, uint16_t timeout);
108-
109-
// writes character to port
110-
int port_putc(uint8_t c);
111-
112-
// writes data to port, returns number of bytes written
113-
uint16_t port_putbuf(void *buf, uint16_t len);
114-
11598
public:
11699
void setup(); // one time setup
117100
void service(); // this runs in a loop
@@ -132,6 +115,23 @@ class systemBus
132115

133116
bool shuttingDown = false; // TRUE if we are in shutdown process
134117
bool getShuttingDown() { return shuttingDown; };
118+
119+
int bus_available();
120+
121+
// returns signed int with data or -1 if no data is available
122+
int port_getc();
123+
124+
// return data if it arrives before timeout or -1 if timeout expires
125+
int port_getc_timeout(uint16_t timeout);
126+
127+
// returns length of data received, if timeout expires returns all data received until then
128+
uint16_t port_getbuf(void *buf, uint16_t len, uint16_t timeout);
129+
130+
// writes character to port
131+
int port_putc(uint8_t c);
132+
133+
// writes data to port, returns number of bytes written
134+
uint16_t port_putbuf(const void *buf, uint16_t len);
135135
};
136136

137137
extern systemBus SYSTEM_BUS;

0 commit comments

Comments
 (0)