From 68019ff9624747d3505ef60d3dfb3cfc9b5d7720 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 9 Sep 2017 02:08:16 -0400 Subject: Whack with club until compiles. --- hal_internal.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'hal_internal.h') diff --git a/hal_internal.h b/hal_internal.h index 2486fd2..7ab300d 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -68,6 +68,41 @@ inline uint32_t htonl(uint32_t w) #define ntohl htonl #endif +/* + * Low-level I/O convenience functions, moved here from hal.h + * because they use symbols defined in verilog_constants.h. + */ + +static inline hal_error_t hal_io_zero(const hal_core_t *core) +{ + const uint8_t buf[4] = { 0, 0, 0, 0 }; + return hal_io_write(core, ADDR_CTRL, buf, sizeof(buf)); +} + +static inline hal_error_t hal_io_init(const hal_core_t *core) +{ + const uint8_t buf[4] = { 0, 0, 0, CTRL_INIT }; + return hal_io_write(core, ADDR_CTRL, buf, sizeof(buf)); +} + +static inline hal_error_t hal_io_next(const hal_core_t *core) +{ + const uint8_t buf[4] = { 0, 0, 0, CTRL_NEXT }; + return hal_io_write(core, ADDR_CTRL, buf, sizeof(buf)); +} + +static inline hal_error_t hal_io_wait_ready(const hal_core_t *core) +{ + int limit = -1; + return hal_io_wait(core, STATUS_READY, &limit); +} + +static inline hal_error_t hal_io_wait_valid(const hal_core_t *core) +{ + int limit = -1; + return hal_io_wait(core, STATUS_VALID, &limit); +} + /* * Static memory allocation on start-up. Don't use this except where * really necessary. By design, there's no way to free this, we don't -- cgit v1.2.3