|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
JTAG / IEEE-1149.1 Boundary Scan TAP HAL surface. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_bscan_status_t |
| Snapshot of the firmware-side TAP bookkeeping object. More... | |
Functions | |
| ra8_err_t | ra8_bscan_init (void) |
| Initialise the firmware-side TAP bookkeeping object. | |
| ra8_err_t | ra8_bscan_deinit (void) |
| Tear down the bookkeeping object. | |
| ra8_err_t | ra8_bscan_get_idcode (uint32_t *out) |
| Get the chip's hardwired JTIDR device ID code. | |
| ra8_err_t | ra8_bscan_get_status (ra8_bscan_status_t *out) |
| Get a snapshot of the driver's TAP bookkeeping state. | |
| ra8_err_t | ra8_bscan_clear_status (uint32_t mask) |
| Clear the recorded last-instruction state (no hardware effect). | |
| ra8_err_t | ra8_bscan_set_instruction (ra8_bscan_instr_t instr) |
| Record the JTIR opcode the external fixture is currently driving. | |
JTAG / IEEE-1149.1 Boundary Scan TAP HAL surface.
Thin software wrapper over the RA8D2 boundary-scan TAP described in HUM Ch 50 "Boundary Scan", p 3257-3262. The actual scan vectors (EXTEST / SAMPLE-PRELOAD / CLAMP / HIGHZ / BYPASS / IDCODE) are driven over the four JTAG pins (TCK / TMS / TDI / TDO) by an external manufacturing-test fixture while the device is held in reset. None of the four TAP registers (JTIR, JTIDR, JTBPR, JTBSR) is reachable through the AHB / system bus, so the firmware-side "driver" is a small bookkeeping object rather than a normal register-poking peripheral.
What this module does:
The CPU-side contract (IDCODE constant cross-check, opcode validation, lifecycle, NULL guards) is exercised by the host unit tests in tests/misc/src/test_ra8_bscan.c and by the on-silicon self-test example examples/.../hil/bscan_selftest (prints bscan: idcode=085DA447 checks=17 PASS). The actual boundary-scan vectors are validated externally by an IEEE-1149.1 JTAG fixture using the device's BSDL file – there is no firmware example for the scan chain itself because it is not CPU-reachable (HUM Ch 50.2.3 p 3259).
Definition in file ra8_bscan.h.
|
nodiscard |
Clear the recorded last-instruction state (no hardware effect).
Resets the bookkeeping last_instruction field back to BYPASS (which is the TAP's reset-state instruction per HUM Ch 50.2.1, p 3258 – the JTIR reset value 0xE selects the BYPASS path). Used by the host-side fixture when it has finished a scan run and wants the firmware-side log to stop reporting the previous opcode.
| [in] | mask | Reserved – must be 0. Present to match the ra8_<short>_clear_status(uint32_t) shape used by sibling HAL drivers. |
| k_ra8_ok | Success. |
| k_ra8_err_invalid_arg | mask is non-zero. |
| k_ra8_err_not_initialized | ra8_bscan_init not called. |
Definition at line 159 of file ra8_bscan.c.
References k_ra8_bscan_clear_mask_none, k_ra8_bscan_instr_bypass, k_ra8_err_invalid_arg, k_ra8_err_not_initialized, k_ra8_ok, and s_bscan_state.
Referenced by bs_run_checks().
|
nodiscard |
Tear down the bookkeeping object.
Clears the recorded instruction and idcode and marks the driver as uninitialized. Touches no hardware.
| k_ra8_ok | Always succeeds. |
Definition at line 122 of file ra8_bscan.c.
References k_ra8_bscan_instr_bypass, k_ra8_ok, and s_bscan_state.
|
nodiscard |
Get the chip's hardwired JTIDR device ID code.
Returns the constant value the external fixture should observe when it shifts JTIDR out over TDO after issuing the IDCODE instruction (per HUM Ch 50.3.2 (4) IDCODE description, p 3261). The value is sourced from the regs header and does NOT require hardware access.
| [out] | out | Receives the 32-bit JTIDR value. |
| k_ra8_ok | Success, *out is valid. |
| k_ra8_err_null_ptr | out is NULL. |
| k_ra8_err_not_initialized | ra8_bscan_init has not been called. |
Definition at line 134 of file ra8_bscan.c.
References k_ra8_err_not_initialized, k_ra8_ok, RA8_CHECK_NULL_PTR, s_bscan_state, and s_tag.
Referenced by bs_run_checks().
|
nodiscard |
Get a snapshot of the driver's TAP bookkeeping state.
Returns the firmware-side view (initialized flag, last reported JTIR opcode, expected JTIDR). Does not query hardware – the four TAP registers (JTIR / JTIDR / JTBPR / JTBSR) are not CPU-readable (HUM Ch 50.2.3 explicit note, p 3259).
| [out] | out | Receives the status snapshot. |
| k_ra8_ok | Success. |
| k_ra8_err_null_ptr | out is NULL. |
Definition at line 147 of file ra8_bscan.c.
References ra8_bscan_status_t::expected_idcode, ra8_bscan_status_t::initialized, k_ra8_ok, ra8_bscan_status_t::last_instruction, RA8_CHECK_NULL_PTR, s_bscan_state, and s_tag.
Referenced by bs_run_checks().
|
nodiscard |
Initialise the firmware-side TAP bookkeeping object.
Marks the driver as initialized and seeds the expected JTIDR with the chip's hardwired device ID code (0x085D_A447, HUM Ch 50.2.2 Table 50.3 entry, p 3258). Touches no hardware: the boundary-scan TAP is reachable only over the external JTAG pins.
| k_ra8_ok | Always succeeds. |
Definition at line 110 of file ra8_bscan.c.
References k_ra8_bscan_instr_bypass, k_ra8_bscan_jtidr_reset, k_ra8_ok, ra8_log_info, s_bscan_state, and s_tag.
Referenced by bs_run_checks().
|
nodiscard |
Record the JTIR opcode the external fixture is currently driving.
Pure firmware-side bookkeeping. The opcode is validated against the named instruction set in HUM Ch 50.2.1 Table (p 3258); reserved 4-bit codes are rejected. The TAP itself does not see this call – the actual JTIR load happens via Shift-IR on the JTAG pins from the external fixture.
| [in] | instr | One of the named opcodes in ra8_bscan_instr_t. |
| k_ra8_ok | Recorded. |
| k_ra8_err_invalid_arg | instr is a reserved opcode. |
| k_ra8_err_not_initialized | ra8_bscan_init not called. |
Definition at line 174 of file ra8_bscan.c.
References internal_is_known_instruction(), k_ra8_err_invalid_arg, k_ra8_err_not_initialized, k_ra8_ok, ra8_log_info_val, s_bscan_state, and s_tag.
Referenced by bs_run_checks().