feat: update API signature regex and enhance DMA function selections in tests

This commit is contained in:
maksyuki committed 2026-10-09 17:13:52 +08:00
1 parent 352b2007fd
commit 3e46cc80e2
3 files changed
+17 -11

No files matched your search

@@ -1,5 +1,6 @@
# R2-P3 software experiment only: external SAFE24, no hardware acceleration changes.
include $(dir $(lastword $(MAKEFILE_LIST)))../ci/ics55-tiny.mk
AUD_CLK_HZ := 24000000
SW_ISA_PROFILE := TINY_PERF
SW_OPT := O2
SW_LTO := NO
@@ -5285,7 +5285,7 @@
{
"id": "premain",
"file": "crt/arch/riscv/startup.S",
"text": "main_start:\n# call main\n#ifdef CSR_ENABLE\ncall _premain_init # init irq\n#endif\ncall main\nloop:\nj loop"
"text": "main_start:\n#ifdef RS_SOC_TINY\n/* Hazard3 implements Zifencei even for compatible RV32IM images. */\n.option push\n.option arch, +zifencei\nfence.i\n.option pop\n#endif\n# call main\n#ifdef CSR_ENABLE\ncall _premain_init # init irq\n#endif\ncall main\nloop:\nj loop"
},
{
"id": "debug-start",
@@ -5812,22 +5812,22 @@
{
"name": "rs_dma_start",
"source": "crt/src/hal/dma.c",
"body_sha256": "159bc71910716dbdc95a6218282d98bd1fbdede26571d46ae870cf9bdd4ff5d0",
"body_sha256": "71fa042fbb83bda8c77fb1f2ccc6f8ec8fda606c419d323191275a14b5b1b924",
"budget": "No timeout argument; no completion polling.",
"zero": "Not applicable: no timeout parameter.",
"success": "For a valid channel, software cleared event flags and wrote START. It did not independently confirm command admission or completion.",
"failure": "An invalid channel is rejected locally; hardware may later report a command or transfer error.",
"next": "Observe channel status and completion/error records before consuming output or reusing buffers."
"success": "For a valid channel not owned by a session, software clears event flags, fences preceding writes and writes START. It does not independently confirm command admission or completion.",
"failure": "An invalid channel or a channel owned by a session is rejected locally; hardware may later report a command or transfer error.",
"next": "Observe channel status and completion/error records before consuming output or reusing buffers; use the session API when ownership is required."
},
{
"name": "rs_dma_abort",
"source": "crt/src/hal/dma.c",
"body_sha256": "218dcfacb4d4af383b8f4dab44d3d4158f9cc580aeef690abbcdfcbea4a62749",
"body_sha256": "458c564bec971320d488fb2699e9a88ec8283a7083930d8c05af9b3fc6af15c7",
"budget": "No timeout argument; no drain polling.",
"zero": "Not applicable: no timeout parameter.",
"success": "For a valid channel, the ABORT command was written. Accepted transactions may still be draining.",
"failure": "The return does not confirm that BUSY is clear or that the buffer is reusable.",
"next": "Use rs_dma_abort_wait or an equivalent status/drain observation, then preserve completion and error details."
"success": "For a valid channel not owned by a session, the ABORT command is written. Accepted transactions may still be draining.",
"failure": "An invalid channel or a channel owned by a session is rejected locally; the return does not confirm that BUSY is clear.",
"next": "Use rs_dma_abort_wait or an equivalent status/drain observation, then preserve completion and error details; use the session API when ownership is required."
},
{
"name": "rs_dma_abort_wait",
+7 -2
View File
@@ -251,7 +251,7 @@ int main(int argc, char **argv) {
def real_definition(source: str, name: str) -> str:
body = function_body(source, name)
signature = re.search(r"\b((?:static\s+)?(?:bool|uint32_t|rs_status_t)\s+" + re.escape(name)
signature = re.search(r"\b((?:static\s+)?(?:bool|uint32_t|rs_status_t|void)\s+" + re.escape(name)
+ r"\s*\([^;{}]*\))\s*\{", source)
assert signature is not None
return signature[1] + " {" + body + "}\n"
@@ -274,9 +274,14 @@ def c_behavior(tmp_path_factory):
constants += "\n" + "\n".join(line for line in sources["uart"].splitlines()
if re.match(r"#define RS_UART_STATUS_(?:TX_FULL|RX_EMPTY)\s", line))
extracted = ""
extracted += "static const rs_dma_session_t *rs_dma_owners[RS_DMA_CHANNEL_COUNT] = {0};\n"
selections = {
"uart": ["rs_uart_write", "rs_uart_read"],
"dma": ["rs_dma_channel_valid", "rs_dma_start", "rs_dma_abort", "rs_dma_get_status", "rs_dma_abort_wait", "rs_dma_wait"],
"dma": [
"rs_dma_lock", "rs_dma_unlock", "rs_dma_fence", "rs_dma_channel_valid",
"rs_dma_command", "rs_dma_start", "rs_dma_abort", "rs_dma_get_status",
"rs_dma_abort_wait", "rs_dma_wait",
],
"timer": ["rs_timer_id_valid", "rs_timer_ctrl_from_config", "rs_timer_config_valid", "rs_timer_configure", "rs_timer_start", "rs_timer_stop", "rs_timer_delay_ms"],
}
for family, names in selections.items():