ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
cache_coherency_shared.h
Go to the documentation of this file.
1
50
51#pragma once
52
53#include <stdint.h>
54
55#include "ra8_attributes.h"
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
80
100
101/* The data-carry invariant the two cores rely on: CPU1 adds the fixed
102 * delta to the ping payload, and that must land exactly on the value
103 * CPU0 expects (pong_base + r == (ping_base + r) + delta). */
104static_assert((uint32_t)k_cache_coherency_ping_base + (uint32_t)k_cache_coherency_delta ==
106 "ping_base + delta must equal pong_base");
107
108/* The shared struct must start on a 32-byte (cache-line) boundary so an
109 * enabled D-cache never straddles it with adjacent cacheable data. The
110 * fixed SRAM2 base is 1 MiB aligned, so this holds by construction. */
111static_assert((uintptr_t)k_cache_coherency_shared_addr % (uintptr_t)k_cache_coherency_align_bytes ==
112 0U,
113 "shared block must be 32-byte (cache-line) aligned");
114
132typedef struct {
133 volatile uint32_t ping_seq;
134 volatile uint32_t pong_seq;
135 volatile uint32_t ping_payload;
136 volatile uint32_t pong_payload;
138
156{
157 return (volatile cache_coherency_shared_t*)(uintptr_t)k_cache_coherency_shared_addr;
158}
159
160#ifdef __cplusplus
161}
162#endif
cache_coherency_shared_const_t
Compile-time magics + budgets for the shared block.
@ k_cache_coherency_delta
pong_base - ping_base (CPU1 add).
@ k_cache_coherency_poll_budget
Max spin iters per direction.
@ k_cache_coherency_rounds
Verified rounds before PASS.
@ k_cache_coherency_pong_base
Expected round-0 pong payload.
@ k_cache_coherency_ping_base
CPU0 round-0 ping payload.
@ k_cache_coherency_align_bytes
Cache-line / region quantum.
cache_coherency_addr_t
Where this app puts its shared block inside the board's window.
@ k_cache_coherency_shared_addr
Shared block = window base.
static volatile cache_coherency_shared_t * internal_shared(void)
Typed pointer to the fixed-address shared message block.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Where the EK-RA8D2's Cortex-M85 and Cortex-M33 meet, stated once.
@ k_ra8_board_shared_ram_base
Start of SRAM2: the CPU0 <-> CPU1 meeting window.
Cross-CPU message struct backed by a fixed non-cacheable SRAM address.
volatile uint32_t ping_payload
CPU0 writes ping_base + r, CPU1 reads.
volatile uint32_t ping_seq
CPU0 increments after writing payload.
volatile uint32_t pong_seq
CPU1 sets to match ping_seq after reply.
volatile uint32_t pong_payload
CPU1 writes ping_payload + delta.