From d4f6f737a30e3a86daaac7861dc17545dd1aba84 Mon Sep 17 00:00:00 2001 From: Diego Nehab <1635557+diegonehab@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:06:32 +0000 Subject: [PATCH] fixup! refactor: split reasons for manual and auto yields --- sys-utils/ioctl-echo-loop/ioctl-echo-loop.c | 10 ++--- sys-utils/libcmt/doc/examples/io.c | 6 +-- sys-utils/libcmt/doc/examples/rollup.c | 4 +- sys-utils/libcmt/include/libcmt/io.h | 33 +++++++++------- sys-utils/libcmt/include/libcmt/rollup.h | 2 +- sys-utils/libcmt/src/mock/io.c | 28 +++++++------- sys-utils/libcmt/src/rollup.c | 42 ++++++++++----------- sys-utils/libcmt/src/tests/io_echo.c | 24 ++++++------ sys-utils/libcmt/src/tests/io_exception.c | 6 +-- sys-utils/libcmt/src/tests/rollup_echo.c | 4 +- sys-utils/rollup/rollup.cpp | 4 +- sys-utils/yield/yield.c | 18 ++++----- 12 files changed, 93 insertions(+), 88 deletions(-) diff --git a/sys-utils/ioctl-echo-loop/ioctl-echo-loop.c b/sys-utils/ioctl-echo-loop/ioctl-echo-loop.c index 2b3d206e..4e1c1107 100644 --- a/sys-utils/ioctl-echo-loop/ioctl-echo-loop.c +++ b/sys-utils/ioctl-echo-loop/ioctl-echo-loop.c @@ -147,9 +147,9 @@ static int handle_inspect_state_request(cmt_rollup_t *me, struct parsed_args *ar static int handle_request(cmt_rollup_t *me, struct parsed_args *args, cmt_rollup_finish_t *finish) { switch (finish->next_request_type) { - case CMT_IO_REASON_ADVANCE: + case HTIF_YIELD_REASON_ADVANCE: return handle_advance_state_request(me, args); - case CMT_IO_REASON_INSPECT: + case HTIF_YIELD_REASON_INSPECT: return handle_inspect_state_request(me, args); default: /* unknown request type */ @@ -184,10 +184,10 @@ int main(int argc, char *argv[]) { break; } reject_advance = - (finish.next_request_type == CMT_IO_REASON_ADVANCE) && (args.reject == input_index); - reject_inspect = (finish.next_request_type == CMT_IO_REASON_INSPECT) && args.reject_inspects; + (finish.next_request_type == HTIF_YIELD_REASON_ADVANCE) && (args.reject == input_index); + reject_inspect = (finish.next_request_type == HTIF_YIELD_REASON_INSPECT) && args.reject_inspects; throw_exception = - (finish.next_request_type == CMT_IO_REASON_ADVANCE) && (args.exception == input_index); + (finish.next_request_type == HTIF_YIELD_REASON_ADVANCE) && (args.exception == input_index); if (throw_exception) { const char message[] = "exception"; cmt_rollup_emit_exception(&rollup, sizeof message -1, message); diff --git a/sys-utils/libcmt/doc/examples/io.c b/sys-utils/libcmt/doc/examples/io.c index 75bf2954..154dc1a6 100644 --- a/sys-utils/libcmt/doc/examples/io.c +++ b/sys-utils/libcmt/doc/examples/io.c @@ -20,9 +20,9 @@ int exception(union cmt_io_driver *io) { /* exception -------------------------------------------------------- */ struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_TX_EXCEPTION, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION, .data = n, }}; if (cmt_io_yield(io, req)) { diff --git a/sys-utils/libcmt/doc/examples/rollup.c b/sys-utils/libcmt/doc/examples/rollup.c index de203230..1ce59f96 100644 --- a/sys-utils/libcmt/doc/examples/rollup.c +++ b/sys-utils/libcmt/doc/examples/rollup.c @@ -17,7 +17,7 @@ int main(void) { if (cmt_rollup_finish(&rollup, &finish) < 0) return EXIT_FAILURE; switch (finish.next_request_type) { - case CMT_IO_REASON_ADVANCE: + case HTIF_YIELD_REASON_ADVANCE: rc = cmt_rollup_read_advance_state(&rollup, &advance); if (rc < 0) { fprintf(stderr, "%s:%d Error on advance %s (%d)\n", __FILE__, __LINE__, strerror(-rc), (-rc)); @@ -36,7 +36,7 @@ int main(void) { break; } break; - case CMT_IO_REASON_INSPECT: + case HTIF_YIELD_REASON_INSPECT: break; } } diff --git a/sys-utils/libcmt/include/libcmt/io.h b/sys-utils/libcmt/include/libcmt/io.h index bbe2da08..19b5603e 100644 --- a/sys-utils/libcmt/include/libcmt/io.h +++ b/sys-utils/libcmt/include/libcmt/io.h @@ -57,30 +57,35 @@ #include #include +/** Device */ enum { - CMT_IO_DEV = 2, /**< IO Device */ + HTIF_DEVICE_YIELD = 2, /**< Yield device */ }; -/** Request */ +/** Commands */ enum { - CMT_IO_CMD_AUTOMATIC = 0, /**< Automatic */ - CMT_IO_CMD_MANUAL = 1, /**< Manual */ + HTIF_YIELD_CMD_AUTOMATIC = 0, /**< Automatic yield */ + HTIF_YIELD_CMD_MANUAL = 1, /**< Manual yield */ }; -/** Request */ +/** Automatic reasons */ enum { - CMT_IO_AUTOMATIC_REASON_PROGRESS = 1, /**< Progress */ - CMT_IO_AUTOMATIC_REASON_TX_OUTPUT = 2, /**< emit an output */ - CMT_IO_AUTOMATIC_REASON_TX_REPORT = 4, /**< emit a report */ - CMT_IO_MANUAL_REASON_RX_ACCEPTED = 1, /**< Accept and load next input */ - CMT_IO_MANUAL_REASON_RX_REJECTED = 2, /**< Reject and revert */ - CMT_IO_MANUAL_REASON_TX_EXCEPTION = 4, /**< emit a exception and halt execution */ + HTIF_YIELD_AUTOMATIC_REASON_PROGRESS = 1, /**< Progress */ + HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT = 2, /**< emit an output */ + HTIF_YIELD_AUTOMATIC_REASON_TX_REPORT = 4, /**< emit a report */ }; -/** Reply reason when requesting @ref CMT_IO_REASON_RX_ACCEPTED */ +/** Manual reasons */ enum { - CMT_IO_REASON_ADVANCE = 0, /**< Input is advance */ - CMT_IO_REASON_INSPECT = 1, /**< Input is inspect */ + HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED = 1, /**< Accept and load next input */ + HTIF_YIELD_MANUAL_REASON_RX_REJECTED = 2, /**< Reject and revert */ + HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION = 4, /**< emit a exception and halt execution */ +}; + +/** Reply reason when requesting @ref HTIF_YIELD_REASON_RX_ACCEPTED or HTIF_YIELD_REASON_RX_REJECTED */ +enum { + HTIF_YIELD_REASON_ADVANCE = 0, /**< Input is advance */ + HTIF_YIELD_REASON_INSPECT = 1, /**< Input is inspect */ }; typedef struct { diff --git a/sys-utils/libcmt/include/libcmt/rollup.h b/sys-utils/libcmt/include/libcmt/rollup.h index 57f522f1..5dea9d91 100644 --- a/sys-utils/libcmt/include/libcmt/rollup.h +++ b/sys-utils/libcmt/include/libcmt/rollup.h @@ -44,7 +44,7 @@ typedef struct cmt_rollup { /** Public struct with the advance state contents */ typedef struct cmt_rollup_advance { uint64_t chain_id; /**< network */ - uint8_t app[CMT_ADDRESS_LENGTH]; /**< application address */ + uint8_t app[CMT_ADDRESS_LENGTH]; /**< application contract address */ uint8_t sender[CMT_ADDRESS_LENGTH]; /**< input sender */ uint64_t block_number; /**< block number of this input */ uint64_t block_timestamp; /**< block timestamp of this input UNIX epoch format) */ diff --git a/sys-utils/libcmt/src/mock/io.c b/sys-utils/libcmt/src/mock/io.c index e99222ca..1aa937da 100644 --- a/sys-utils/libcmt/src/mock/io.c +++ b/sys-utils/libcmt/src/mock/io.c @@ -124,7 +124,7 @@ static int store_next_output(cmt_io_driver_mock_t *me, char *ns, int *seq, struc static int mock_progress(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { (void) me; - if (rr->cmd != CMT_IO_CMD_AUTOMATIC) { + if (rr->cmd != HTIF_YIELD_CMD_AUTOMATIC) { fprintf(stderr, "Expected cmd to be AUTOMATIC\n"); return -EINVAL; } @@ -133,7 +133,7 @@ static int mock_progress(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { } static int mock_rx_accepted(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { - if (rr->cmd != CMT_IO_CMD_MANUAL) { + if (rr->cmd != HTIF_YIELD_CMD_MANUAL) { fprintf(stderr, "Expected cmd to be MANUAL\n"); return -EINVAL; } @@ -150,7 +150,7 @@ static int mock_rx_accepted(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { } static int mock_rx_rejected(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { - if (rr->cmd != CMT_IO_CMD_MANUAL) { + if (rr->cmd != HTIF_YIELD_CMD_MANUAL) { fprintf(stderr, "Expected cmd to be MANUAL\n"); return -EINVAL; } @@ -161,7 +161,7 @@ static int mock_rx_rejected(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { } static int mock_tx_output(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { - if (rr->cmd != CMT_IO_CMD_AUTOMATIC) { + if (rr->cmd != HTIF_YIELD_CMD_AUTOMATIC) { fprintf(stderr, "Expected cmd to be AUTOMATIC\n"); return -EINVAL; } @@ -169,7 +169,7 @@ static int mock_tx_output(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { } static int mock_tx_report(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { - if (rr->cmd != CMT_IO_CMD_AUTOMATIC) { + if (rr->cmd != HTIF_YIELD_CMD_AUTOMATIC) { fprintf(stderr, "Expected cmd to be AUTOMATIC\n"); return -EINVAL; } @@ -177,7 +177,7 @@ static int mock_tx_report(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { } static int mock_tx_exception(cmt_io_driver_mock_t *me, struct cmt_io_yield *rr) { - if (rr->cmd != CMT_IO_CMD_MANUAL) { + if (rr->cmd != HTIF_YIELD_CMD_MANUAL) { fprintf(stderr, "Expected cmd to be MANUAL\n"); return -EINVAL; } @@ -201,24 +201,24 @@ int cmt_io_yield(cmt_io_driver_t *_me, struct cmt_io_yield *rr) { rr->dev, rr->cmd, rr->reason, rr->data); } - if (rr->cmd == CMT_IO_CMD_MANUAL) { + if (rr->cmd == HTIF_YIELD_CMD_MANUAL) { switch (rr->reason) { - case CMT_IO_MANUAL_REASON_RX_ACCEPTED: + case HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED: return mock_rx_accepted(me, rr); - case CMT_IO_MANUAL_REASON_RX_REJECTED: + case HTIF_YIELD_MANUAL_REASON_RX_REJECTED: return mock_rx_rejected(me, rr); - case CMT_IO_MANUAL_REASON_TX_EXCEPTION: + case HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION: return mock_tx_exception(me, rr); default: return -EINVAL; } - } else if (rr->cmd == CMT_IO_CMD_AUTOMATIC) { + } else if (rr->cmd == HTIF_YIELD_CMD_AUTOMATIC) { switch (rr->reason) { - case CMT_IO_AUTOMATIC_REASON_PROGRESS: + case HTIF_YIELD_AUTOMATIC_REASON_PROGRESS: return mock_progress(me, rr); - case CMT_IO_AUTOMATIC_REASON_TX_OUTPUT: + case HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT: return mock_tx_output(me, rr); - case CMT_IO_AUTOMATIC_REASON_TX_REPORT: + case HTIF_YIELD_AUTOMATIC_REASON_TX_REPORT: return mock_tx_report(me, rr); default: return -EINVAL; diff --git a/sys-utils/libcmt/src/rollup.c b/sys-utils/libcmt/src/rollup.c index 3b341d63..601dc58f 100644 --- a/sys-utils/libcmt/src/rollup.c +++ b/sys-utils/libcmt/src/rollup.c @@ -94,9 +94,9 @@ int cmt_rollup_emit_voucher(cmt_rollup_t *me, size_t m = wr->begin - tx->begin; struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_TX_OUTPUT, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT, .data = m, }}; int rc = DBG(cmt_io_yield(me->io, req)); @@ -122,9 +122,9 @@ int cmt_rollup_emit_notice(cmt_rollup_t *me, uint32_t length, const void *data) size_t m = wr->begin - tx->begin; struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_TX_OUTPUT, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT, .data = m, }}; int rc = DBG(cmt_io_yield(me->io, req)); @@ -146,9 +146,9 @@ int cmt_rollup_emit_report(cmt_rollup_t *me, uint32_t length, const void *data) memcpy(wr->begin, data, length); struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_TX_REPORT, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_TX_REPORT, .data = length, }}; return DBG(cmt_io_yield(me->io, req)); @@ -167,9 +167,9 @@ int cmt_rollup_emit_exception(cmt_rollup_t *me, uint32_t length, const void *dat memcpy(tx->begin, data, length); struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_TX_EXCEPTION, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION, .data = length, }}; return DBG(cmt_io_yield(me->io, req)); @@ -220,9 +220,9 @@ int cmt_rollup_read_inspect_state(cmt_rollup_t *me, cmt_rollup_inspect_t *inspec static int accepted(union cmt_io_driver *io, uint32_t *n) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_RX_ACCEPTED, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED, .data = *n, }}; int rc = DBG(cmt_io_yield(io, req)); @@ -235,9 +235,9 @@ static int accepted(union cmt_io_driver *io, uint32_t *n) { static int revert(union cmt_io_driver *io) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_RX_REJECTED, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_RX_REJECTED, .data = 0, }}; return DBG(cmt_io_yield(io, req)); @@ -267,9 +267,9 @@ int cmt_rollup_finish(cmt_rollup_t *me, cmt_rollup_finish_t *finish) { int cmt_rollup_progress(cmt_rollup_t *me, uint32_t progress) { cmt_io_yield_t req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_PROGRESS, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_PROGRESS, .data = progress, }}; return DBG(cmt_io_yield(me->io, req)); diff --git a/sys-utils/libcmt/src/tests/io_echo.c b/sys-utils/libcmt/src/tests/io_echo.c index ae4399ee..75655690 100644 --- a/sys-utils/libcmt/src/tests/io_echo.c +++ b/sys-utils/libcmt/src/tests/io_echo.c @@ -6,9 +6,9 @@ int next(union cmt_io_driver *io, uint32_t *n) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_RX_ACCEPTED, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED, .data = *n, }}; if (cmt_io_yield(io, req)) { @@ -21,9 +21,9 @@ int next(union cmt_io_driver *io, uint32_t *n) { int voucher(union cmt_io_driver *io, uint32_t n) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_TX_OUTPUT, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT, .data = n, }}; return cmt_io_yield(io, req); @@ -31,9 +31,9 @@ int voucher(union cmt_io_driver *io, uint32_t n) { int report(union cmt_io_driver *io, uint32_t n) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_AUTOMATIC, - .reason = CMT_IO_AUTOMATIC_REASON_TX_REPORT, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_AUTOMATIC, + .reason = HTIF_YIELD_AUTOMATIC_REASON_TX_REPORT, .data = n, }}; return cmt_io_yield(io, req); @@ -41,9 +41,9 @@ int report(union cmt_io_driver *io, uint32_t n) { int exception(union cmt_io_driver *io, uint32_t n) { struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_TX_EXCEPTION, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION, .data = n, }}; return cmt_io_yield(io, req); diff --git a/sys-utils/libcmt/src/tests/io_exception.c b/sys-utils/libcmt/src/tests/io_exception.c index 97ec5ebf..2289d49c 100644 --- a/sys-utils/libcmt/src/tests/io_exception.c +++ b/sys-utils/libcmt/src/tests/io_exception.c @@ -24,9 +24,9 @@ int main(void) { /* exception -------------------------------------------------------- */ struct cmt_io_yield req[1] = {{ - .dev = CMT_IO_DEV, - .cmd = CMT_IO_CMD_MANUAL, - .reason = CMT_IO_MANUAL_REASON_TX_EXCEPTION, + .dev = HTIF_DEVICE_YIELD, + .cmd = HTIF_YIELD_CMD_MANUAL, + .reason = HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION, .data = n, }}; if (cmt_io_yield(io, req)) { diff --git a/sys-utils/libcmt/src/tests/rollup_echo.c b/sys-utils/libcmt/src/tests/rollup_echo.c index baf391ec..ab3f9320 100644 --- a/sys-utils/libcmt/src/tests/rollup_echo.c +++ b/sys-utils/libcmt/src/tests/rollup_echo.c @@ -39,7 +39,7 @@ int main(void) { goto teardown; switch (finish.next_request_type) { - case CMT_IO_REASON_ADVANCE: + case HTIF_YIELD_REASON_ADVANCE: rc = cmt_rollup_read_advance_state(&rollup, &advance); if (rc < 0) { fprintf(stderr, "%s:%d Error on advance %s (%d)\n", __FILE__, __LINE__, strerror(-rc), (-rc)); @@ -64,7 +64,7 @@ int main(void) { break; } break; - case CMT_IO_REASON_INSPECT: + case HTIF_YIELD_REASON_INSPECT: break; } } diff --git a/sys-utils/rollup/rollup.cpp b/sys-utils/rollup/rollup.cpp index fc1ff5f0..5b42780e 100644 --- a/sys-utils/rollup/rollup.cpp +++ b/sys-utils/rollup/rollup.cpp @@ -296,9 +296,9 @@ static int finish_request_and_get_next(bool accept) try { f.accept_previous_request = accept; if (cmt_rollup_finish(r, &f)) return 1; - if (f.next_request_type == CMT_IO_REASON_ADVANCE) { + if (f.next_request_type == HTIF_YIELD_REASON_ADVANCE) { write_advance_state(r, &f); - } else if (f.next_request_type == CMT_IO_REASON_INSPECT) { + } else if (f.next_request_type == HTIF_YIELD_REASON_INSPECT) { write_inspect_state(r, &f); } return 0; diff --git a/sys-utils/yield/yield.c b/sys-utils/yield/yield.c index 8f8b59c6..513e9ef9 100644 --- a/sys-utils/yield/yield.c +++ b/sys-utils/yield/yield.c @@ -53,20 +53,20 @@ static int find_value(const struct name_value *pairs, size_t n, const char *s, u int get_mode(const char *s, uint64_t *mode) { struct name_value modes[] = { - {"manual", CMT_IO_CMD_MANUAL}, - {"automatic", CMT_IO_CMD_AUTOMATIC}, + {"manual", HTIF_YIELD_CMD_MANUAL}, + {"automatic", HTIF_YIELD_CMD_AUTOMATIC}, }; return find_value(modes, sizeof(modes)/sizeof(*modes), s, mode); } int get_reason(const char *s, uint64_t *reason) { struct name_value reasons[] = { - {"progress", CMT_IO_AUTOMATIC_REASON_PROGRESS}, - {"tx-output", CMT_IO_AUTOMATIC_REASON_TX_OUTPUT}, - {"tx-report", CMT_IO_AUTOMATIC_REASON_TX_REPORT}, - {"rx-accepted", CMT_IO_MANUAL_REASON_RX_ACCEPTED}, - {"rx-rejected", CMT_IO_MANUAL_REASON_RX_REJECTED}, - {"tx-exception", CMT_IO_MANUAL_REASON_TX_EXCEPTION}, + {"progress", HTIF_YIELD_AUTOMATIC_REASON_PROGRESS}, + {"tx-output", HTIF_YIELD_AUTOMATIC_REASON_TX_OUTPUT}, + {"tx-report", HTIF_YIELD_AUTOMATIC_REASON_TX_REPORT}, + {"rx-accepted", HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED}, + {"rx-rejected", HTIF_YIELD_MANUAL_REASON_RX_REJECTED}, + {"tx-exception", HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION}, }; return find_value(reasons, sizeof(reasons)/sizeof(*reasons), s, reason); } @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) { parse_args(argc, argv, &args); cmt_io_yield_t req[1] = {{ - .dev = CMT_IO_DEV, + .dev = HTIF_DEVICE_YIELD, .cmd = args.mode, .reason = args.reason, .data = args.data,