diff options
author | 2022-05-12 21:10:35 -0600 | |
---|---|---|
committer | 2022-05-12 23:10:35 -0400 | |
commit | 5052eb307a959644677037be52b9a168a68775dd (patch) | |
tree | 9bd5a1a29e81d6cea632ea25449232d9bb62f50e /src/devices/imagedev/bitbngr.cpp | |
parent | bdc0d0dea1f4113bca2ce5162dc044a026b43b58 (diff) |
bitbanger: Add udp multicast support (#9744)
Example usage: -bitb udp.234.99.99.99:15122
Diffstat (limited to 'src/devices/imagedev/bitbngr.cpp')
-rw-r--r-- | src/devices/imagedev/bitbngr.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/devices/imagedev/bitbngr.cpp b/src/devices/imagedev/bitbngr.cpp index dc31c4ccb83..b148b5b684a 100644 --- a/src/devices/imagedev/bitbngr.cpp +++ b/src/devices/imagedev/bitbngr.cpp @@ -45,6 +45,19 @@ void bitbanger_device::output(uint8_t data) fwrite(&data, 1); } +/*------------------------------------------------- + native_output - outputs data buffer to a file +-------------------------------------------------*/ + +int bitbanger_device::send(uint8_t *buf, int len) +{ + if (exists()) + { + return fwrite(buf, len); + } + // Announce we transfered everything + return len; +} /*------------------------------------------------- native_input - inputs data from a file @@ -58,6 +71,21 @@ uint32_t bitbanger_device::input(void *buffer, uint32_t length) return 0; } +/*------------------------------------------------- + flush_rx - Flushes all receive data from stream +-------------------------------------------------*/ +void bitbanger_device::flush_rx(void) +{ + if (exists()) + { + int rx_bytes; + auto tmp_buf = std::make_unique<uint8_t[]>(512); + while ((rx_bytes = fread(tmp_buf.get(), 512))) + { + //printf("Flushing rx %d bytes\n", rx_bytes); + } + } +} /*------------------------------------------------- |