feat(mailbox): Mailbox driver implementation and host unit tests #100

Merged
hoogv merged 1 commit from feat/99-mailbox-driver into dev 2026-07-23 18:10:09 +00:00
Owner

Description

Adds hal/dss/hal_mailbox/hal_mailbox.c/.h — the inter-processor Mailbox driver (MSS's point of view, covering both the MSS<->BSS and MSS<->DSS links): hal_mailbox_send(), hal_mailbox_message_pending(), hal_mailbox_receive(), and the four raw device handlers (MBOX_MSS_DSS_BOX_FULL_IRQHandler/MBOX_MSS_DSS_BOX_EMPTY_IRQHandler/MBOX_MSS_BSS_BOX_FULL_IRQHandler/MBOX_MSS_BSS_BOX_EMPTY_IRQHandler) decoding/clearing the CPU interrupt condition to a weak, application-overridable hal_mailbox_irq_handler() hook. Self-contained — no cross-module dependency.

This is the first driver of a second, DSS-side driver batch — landed first since hal_vim.c's already-merged dispatch table references its four MBOX_* handler symbols directly.

Why

Continues the driver-implementation phase, moving into the DSS-side batch after completing the MSS-side batch (GPIO through MCAN, #75-#98).

Closes #99

Type of Change

  • New feature

Impact Assessment

  • Functional impact: None — self-contained addition; first DSS-side driver, no interaction with already-landed MSS drivers beyond shared test infrastructure.
  • Regulatory impact: None.
  • QMS impact: None.
  • Risk impact: No — existing risk coverage sufficient.

Testing

  • CI pipeline passes (compile, unit tests, integration tests, static analysis)
  • Manually tested: built and ran testing/dss/hal_mailbox/test_mailbox_functional locally (9 test cases, 65 assertions, all passing) alongside the full existing ctest suite (338/338 passing, no regressions); ran a full MISRA C:2025 pass (0 unsuppressed findings, -DENABLE_MAILBOX_MODULE added — hal/dss is picked up automatically by run_misra.sh's existing directory loop, first driver to exercise that path); reformatted and re-verified against the exact clang-format 18.1.3 the CI runner uses; sanity-checked by swapping hal_mailbox_send()'s doorbell strobe from MAILBOX_INT_TRIG_MAILBOX to MAILBOX_INT_TRIG_MAILBOX_ACK, confirming the test suite fails (2 test cases, 5 assertions), then reverting.
  • No regressions observed in related areas

PR Size

  • XL (> 300 lines) — must split unless exemption declared

Size justification / exemption (if L or XL):

682 raw lines across 6 files, all hand-reviewed (no mechanically-generated content). Not split further — the driver (hal_mailbox.c/.h, 403 lines) and its comprehensive Catch2 spec (test_mailbox.c, 271 lines, covering both links' send/receive/pending paths and all four IRQ handlers' correct register-block resolution) don't decompose into independently-reviewable sub-PRs, same rationale as every prior driver PR in this project. The remaining files are small CMake/MISRA wiring diffs, also not independently reviewable apart from the driver they enable.

Checklist

  • Commit messages follow type(scope): description convention with Relates to #<issue> footer
  • PR template filled in completely
  • No unverified external binaries introduced (see QMS-GITFLOW-001 Binary Security section)
  • All commits leave the codebase in a compilable, passing-tests state (Commit Integrity Rule)

Summary

  • hal/dss/hal_mailbox/hal_mailbox.c/.h: Mailbox driver (send/receive/pending, IRQ handlers)
  • testing/dss/hal_mailbox/test_mailbox.c (+ CMakeLists.txt): Catch2 functional test suite. Named test_mailbox_functional (not test_mailbox) to avoid a CMake target-name collision with ti_hal_comparison/test_mailbox.c's register-layout comparison test.
  • testing/CMakeLists.txt: add_subdirectory(dss/hal_mailbox) — first DSS-side host-functionality test subdirectory, alongside ENABLE_MAILBOX_MODULE in the shared hw_fakes compile definitions
  • tools/misra/run_misra.sh: -DENABLE_MAILBOX_MODULE added
## Description Adds `hal/dss/hal_mailbox/hal_mailbox.c`/`.h` — the inter-processor Mailbox driver (MSS's point of view, covering both the MSS<->BSS and MSS<->DSS links): `hal_mailbox_send()`, `hal_mailbox_message_pending()`, `hal_mailbox_receive()`, and the four raw device handlers (`MBOX_MSS_DSS_BOX_FULL_IRQHandler`/`MBOX_MSS_DSS_BOX_EMPTY_IRQHandler`/`MBOX_MSS_BSS_BOX_FULL_IRQHandler`/`MBOX_MSS_BSS_BOX_EMPTY_IRQHandler`) decoding/clearing the CPU interrupt condition to a weak, application-overridable `hal_mailbox_irq_handler()` hook. Self-contained — no cross-module dependency. This is the first driver of a second, DSS-side driver batch — landed first since `hal_vim.c`'s already-merged dispatch table references its four `MBOX_*` handler symbols directly. ## Why Continues the driver-implementation phase, moving into the DSS-side batch after completing the MSS-side batch (GPIO through MCAN, #75-#98). ## Related Issue Closes #99 ## Type of Change - [x] New feature ## Impact Assessment - **Functional impact:** None — self-contained addition; first DSS-side driver, no interaction with already-landed MSS drivers beyond shared test infrastructure. - **Regulatory impact:** None. - **QMS impact:** None. - **Risk impact:** No — existing risk coverage sufficient. ## Testing - [x] CI pipeline passes (compile, unit tests, integration tests, static analysis) - [x] Manually tested: built and ran `testing/dss/hal_mailbox/test_mailbox_functional` locally (9 test cases, 65 assertions, all passing) alongside the full existing `ctest` suite (338/338 passing, no regressions); ran a full MISRA C:2025 pass (0 unsuppressed findings, `-DENABLE_MAILBOX_MODULE` added — `hal/dss` is picked up automatically by `run_misra.sh`'s existing directory loop, first driver to exercise that path); reformatted and re-verified against the exact clang-format 18.1.3 the CI runner uses; sanity-checked by swapping `hal_mailbox_send()`'s doorbell strobe from `MAILBOX_INT_TRIG_MAILBOX` to `MAILBOX_INT_TRIG_MAILBOX_ACK`, confirming the test suite fails (2 test cases, 5 assertions), then reverting. - [x] No regressions observed in related areas ## PR Size - [x] XL (> 300 lines) — must split unless exemption declared **Size justification / exemption (if L or XL):** 682 raw lines across 6 files, all hand-reviewed (no mechanically-generated content). Not split further — the driver (`hal_mailbox.c`/`.h`, 403 lines) and its comprehensive Catch2 spec (`test_mailbox.c`, 271 lines, covering both links' send/receive/pending paths and all four IRQ handlers' correct register-block resolution) don't decompose into independently-reviewable sub-PRs, same rationale as every prior driver PR in this project. The remaining files are small CMake/MISRA wiring diffs, also not independently reviewable apart from the driver they enable. ## Checklist - [x] Commit messages follow `type(scope): description` convention with `Relates to #<issue>` footer - [x] PR template filled in completely - [x] No unverified external binaries introduced (see QMS-GITFLOW-001 Binary Security section) - [x] All commits leave the codebase in a compilable, passing-tests state (Commit Integrity Rule) ## Summary - `hal/dss/hal_mailbox/hal_mailbox.c`/`.h`: Mailbox driver (send/receive/pending, IRQ handlers) - `testing/dss/hal_mailbox/test_mailbox.c` (+ `CMakeLists.txt`): Catch2 functional test suite. Named `test_mailbox_functional` (not `test_mailbox`) to avoid a CMake target-name collision with `ti_hal_comparison/test_mailbox.c`'s register-layout comparison test. - `testing/CMakeLists.txt`: `add_subdirectory(dss/hal_mailbox)` — first DSS-side host-functionality test subdirectory, alongside `ENABLE_MAILBOX_MODULE` in the shared `hw_fakes` compile definitions - `tools/misra/run_misra.sh`: `-DENABLE_MAILBOX_MODULE` added
feat(mailbox): Mailbox driver implementation and host unit tests
All checks were successful
lint / clang-format (pull_request) Successful in 10s
lint / misra (pull_request) Successful in 49s
tests / host-tests (pull_request) Successful in 45s
lint / clang-format (push) Successful in 9s
lint / misra (push) Successful in 48s
tests / host-tests (push) Successful in 43s
4ba0f8a38d
Adds hal/dss/hal_mailbox/hal_mailbox.c/.h - inter-processor mailbox
driver (MSS's point of view, MSS<->BSS and MSS<->DSS links):
send/receive/message-pending, and the four raw device handlers
decoding/clearing the CPU interrupt condition to a weak
hal_mailbox_irq_handler() hook. First driver of the DSS-side batch -
landed first since hal_vim.c's dispatch table already references its
four MBOX_* handler symbols.

Relates to #4, relates to #99
hoogv added this to the Development project 2026-07-23 18:10:05 +00:00
hoogv self-assigned this 2026-07-23 18:10:06 +00:00
Sign in to join this conversation.
No reviewers
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
opendutchsolutions.public/hal_awr6843!100
No description provided.