ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_drw_draw.c File Reference

2D Drawing Engine (DRW / D/AVE 2D) geometry primitives More...

#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_check.h"
#include "ra8_drw.h"
#include "ra8_drw_dlist.h"
#include "ra8_drw_internal.h"
#include "ra8_drw_regs.h"
#include "ra8_err.h"
Include dependency graph for ra8_drw_draw.c:

Go to the source code of this file.

Enumerations

enum  ra8_drw_dlist_span_t : uint8_t {
  k_ra8_drw_dlist_entry_words = 2U ,
  k_ra8_drw_dlist_special_words = 1U ,
  k_ra8_drw_dlist_fill_regs = 4U ,
  k_ra8_drw_dlist_fill_words = 9U
}
 Word spans of the display-list entries the builder emits. More...

Functions

ra8_err_t ra8_drw_fill_rect (const ra8_drw_rect_t *rect)
 Issue a solid-fill rectangle blit into the framebuffer.
ra8_err_t ra8_drw_blit_textured_rect (const ra8_drw_rect_t *rect)
 Blit a textured rectangle (texture must be programmed first).
static void internal_program_line_limiters (const ra8_drw_line_t *line)
 Program L1..L4 START/XADD/YADD for a stroked line.
ra8_err_t ra8_drw_draw_line (const ra8_drw_line_t *line)
 Issue an anti-aliased line stroke between two points.
ra8_err_t ra8_drw_draw_triangle (const ra8_drw_triangle_t *tri)
 Issue an anti-aliased filled triangle.
ra8_err_t ra8_drw_run_dlist (const uint32_t *dlist_addr)
 Trigger execution of a display list.
static void internal_dlist_put_reg (ra8_drw_dlist_t *dl, ra8_drw_dlr_index_t idx, uint32_t val)
 Append a single-register display-list entry to the builder buffer.
static void internal_dlist_put_special (ra8_drw_dlist_t *dl, uint32_t arg)
 Append a display-list special word (wait or terminate).
ra8_err_t ra8_drw_dlist_begin (ra8_drw_dlist_t *dl, uint32_t *buf, uint32_t cap_words)
 Bind a display-list builder to a caller-owned word buffer.
ra8_err_t ra8_drw_dlist_add_fill (ra8_drw_dlist_t *dl, const ra8_drw_rect_t *rect)
 Append one solid-rectangle fill primitive to a display list.
ra8_err_t ra8_drw_dlist_end (ra8_drw_dlist_t *dl)
 Close a display list with its terminator word.
ra8_err_t ra8_drw_dlist_run (const ra8_drw_dlist_t *dl)
 Trigger a built display list (writes DLISTSTART).
ra8_err_t ra8_drw_perf_arm (ra8_drw_perftrigger_t event_ctr1, ra8_drw_perftrigger_t event_ctr2)
 Programme PERFTRIGGER for the two performance counters and reset both PERFCOUNTk registers.
ra8_err_t ra8_drw_perf_read (ra8_drw_perfcounter_id_t id, uint32_t *out)
 Read one PERFCOUNTk register.
ra8_err_t ra8_drw_perf_reset (ra8_drw_perfcounter_id_t id)
 Reset one PERFCOUNTk register to zero.

Variables

static const char * s_tag = "DRW"
 Logging tag for the DRW driver.

Detailed Description

2D Drawing Engine (DRW / D/AVE 2D) geometry primitives

Tag
[Ring 3 / HAL] {World: NS}

Geometry-primitive half of the RA8D2 D/AVE 2D driver, split out of ra8_drw.c to keep each translation unit under the file-size cap. This TU owns the drawing primitives (fill / textured-blit / line / triangle), display-list submission and the performance counters. The surface-setup, lifecycle, IRQ and cache helpers remain in ra8_drw.c. This TU keeps its own read-only copy of the s_tag logging tag and reuses the shared limiter helper internal_program_rect_limiters declared in ra8_drw_internal.h.

Every register access carries a HUM Ch 62 citation immediately above it so cite_check.py can validate provenance.

Definition in file ra8_drw_draw.c.

Enumeration Type Documentation

◆ ra8_drw_dlist_span_t

enum ra8_drw_dlist_span_t : uint8_t

Word spans of the display-list entries the builder emits.

A single-register entry is a tag word plus one value word; a special word (wait / terminate) is one word. A solid-fill primitive programs COLOR1, SIZE, CONTROL and ORIGIN and appends one wait word.

Invariant
k_ra8_drw_dlist_fill_words == fill regs * entry words + 1.
See also
ra8_drw_dlist_add_fill
Enumerator
k_ra8_drw_dlist_entry_words 

1-register entry: tag + value.

k_ra8_drw_dlist_special_words 

Wait or terminate word.

k_ra8_drw_dlist_fill_regs 

COLOR1, SIZE, CONTROL, ORIGIN.

k_ra8_drw_dlist_fill_words 

4 * 2 + 1 wait word.

Definition at line 345 of file ra8_drw_draw.c.

Function Documentation

◆ internal_dlist_put_reg()

void internal_dlist_put_reg ( ra8_drw_dlist_t * dl,
ra8_drw_dlr_index_t idx,
uint32_t val )
static

Append a single-register display-list entry to the builder buffer.

Writes a one-index tag (register index OR k_ra8_drw_dlr_tag_one_index) followed by the value word. The caller (ra8_drw_dlist_add_fill) reserves the whole primitive's span up front, so this writer never bounds-checks – it is a plain memory append to the caller buffer, never MMIO.

Parameters
[in,out]dlBound builder with at least two free words.
[in]idxRegister index (ra8_drw_dlr_index_t).
[in]valValue word to program.
Precondition
dl and dl->buf are non-null.
dl->count + 2 <= dl->cap_words (caller-reserved).
Postcondition
dl->buf holds the one-index tag then val at the reserved slot.
dl->count grew by two (k_ra8_drw_dlist_entry_words).
Note
Not thread-safe; caller-buffer writes only.
Since
0.1.0

Definition at line 374 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::buf, ra8_drw_dlist_t::count, k_ra8_drw_dlist_entry_words, and k_ra8_drw_dlr_tag_one_index.

Referenced by ra8_drw_dlist_add_fill().

◆ internal_dlist_put_special()

void internal_dlist_put_special ( ra8_drw_dlist_t * dl,
uint32_t arg )
static

Append a display-list special word (wait or terminate).

Encodes k_ra8_drw_dlr_eol_byte with arg in byte 1. The caller reserves the word up front, so this writer never bounds-checks.

Parameters
[in,out]dlBound builder with at least one free word.
[in]argEnd-of-list argument (wait / terminate).
Precondition
dl and dl->buf are non-null.
dl->count + 1 <= dl->cap_words (caller-reserved).
Postcondition
dl->buf holds the encoded end-of-list word at the reserved slot.
dl->count grew by one (k_ra8_drw_dlist_special_words).
Note
Not thread-safe; caller-buffer writes only.
Since
0.1.0

Definition at line 400 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::buf, ra8_drw_dlist_t::count, k_ra8_drw_dlist_special_words, k_ra8_drw_dlr_eol_arg_pos, and k_ra8_drw_dlr_eol_byte.

Referenced by ra8_drw_dlist_add_fill(), and ra8_drw_dlist_end().

◆ internal_program_line_limiters()

void internal_program_line_limiters ( const ra8_drw_line_t * line)
static

Program L1..L4 START/XADD/YADD for a stroked line.

HUM Ch 62.2.10-62.2.12 (LnSTART/LnXADD/LnYADD pp 3698-3699). The line is encoded as four perpendicular limiters per HUM Ch 62.4.4 "Lines" p 3725.

Parameters
[in]lineValidated line descriptor.
Precondition
line is non-null.
Postcondition
Limiter registers reflect the line stroke envelope.
Note
Internal helper, not thread-safe.
Precondition
Module state is consistent.
Postcondition
Caller-visible state matches the documented contract.
Since
0.1.0

Definition at line 174 of file ra8_drw_draw.c.

References internal_iabs(), internal_to_subpixel(), k_ra8_drw_off_l1band, k_ra8_drw_off_l1start, k_ra8_drw_off_l1xadd, k_ra8_drw_off_l1yadd, k_ra8_drw_off_l2band, k_ra8_drw_off_l2start, k_ra8_drw_off_l2xadd, k_ra8_drw_off_l2yadd, k_ra8_drw_off_l3start, k_ra8_drw_off_l3xadd, k_ra8_drw_off_l3yadd, k_ra8_drw_off_l4start, k_ra8_drw_off_l4xadd, k_ra8_drw_off_l4yadd, k_ra8_drw_subpixel_unit, ra8_drw_reg32(), ra8_drw_line_t::width_px, ra8_drw_line_t::x0, ra8_drw_line_t::x1, ra8_drw_line_t::y0, and ra8_drw_line_t::y1.

Referenced by ra8_drw_draw_line().

◆ ra8_drw_blit_textured_rect()

ra8_err_t ra8_drw_blit_textured_rect ( const ra8_drw_rect_t * rect)
nodiscard

Blit a textured rectangle (texture must be programmed first).

The caller programmes the texture state via ra8_drw_set_texture (which also enables CONTROL2.TEXTUREENABLE). This function then writes the rectangle limiter set + SIZE and starts the engine via a write to CONTROL.

Parameters
[in]rectDestination rectangle. Must not be nullptr.
Returns
ra8_err_t error code.
Return values
k_ra8_okBlit issued.
k_ra8_err_null_ptrrect was nullptr.
k_ra8_err_invalid_argwidth/height out of range.
Precondition
rect non-null and validated.
Texture state is programmed (CONTROL2.TEXTUREENABLE = 1).
Postcondition
DRW engine has accepted the textured rectangle.
CACHECTL pulsed to flush stale FB lines before consumption.
Since
0.1.0

Definition at line 98 of file ra8_drw_draw.c.

References ra8_drw_rect_t::height_px, k_ra8_drw_cachectl_cflushtx, k_ra8_drw_max_height_px, k_ra8_drw_max_width_px, k_ra8_drw_min_dim_px, k_ra8_drw_off_cachectl, k_ra8_drw_off_control, k_ra8_drw_off_lustart, k_ra8_drw_off_luxadd, k_ra8_drw_off_luyadd, k_ra8_drw_off_lvstartf, k_ra8_drw_off_lvstarti, k_ra8_drw_off_lvxaddi, k_ra8_drw_off_lvyaddi, k_ra8_drw_off_lvyxaddf, k_ra8_drw_off_origin, k_ra8_drw_subpixel_unit, k_ra8_err_invalid_arg, k_ra8_ok, priv_program_rect_bbox(), priv_ra8_drw_internal_rect_above_max(), priv_ra8_drw_internal_rect_below_min(), priv_ra8_drw_internal_rect_off_surface(), priv_ra8_drw_internal_rect_origin(), RA8_CHECK_NULL_PTR, ra8_drw_reg32(), s_tag, and ra8_drw_rect_t::width_px.

◆ ra8_drw_dlist_add_fill()

ra8_err_t ra8_drw_dlist_add_fill ( ra8_drw_dlist_t * dl,
const ra8_drw_rect_t * rect )
nodiscard

Append one solid-rectangle fill primitive to a display list.

Emits the display-list entries the DRW needs to paint an axis-aligned solid rectangle – COLOR1, SIZE, CONTROL (limiters off, the bounding-box scan is the rectangle, HUM Ch 62.6.2 p 3716) and ORIGIN, the write that triggers the render – followed by a "wait for pipeline and cache" word so the primitive fully drains before the next one begins. This is the same geometry the register-mode ra8_drw_fill_rect uses; the surface format (CONTROL2, PITCH, cache) stays as ra8_drw_init programmed it. A full-surface rectangle with colour 0 is how a display list clears the framebuffer.

Parameters
[in,out]dlBound builder (ra8_drw_dlist_begin succeeded).
[in]rectRectangle in pixels; color_argb8888 is 0xAARRGGBB.
Returns
ra8_err_t error code.
Return values
k_ra8_okPrimitive appended.
k_ra8_err_null_ptrdl or rect was nullptr.
k_ra8_err_invalid_argDimensions out of range or off the surface.
k_ra8_err_no_memThe buffer cannot hold this primitive.
Precondition
dl was bound by ra8_drw_dlist_begin and not yet ended.
rect->width_px / height_px in [1..1024]; the rect lies on-surface.
Postcondition
On success dl->count grew by the primitive's word span.
On overflow dl->overflow is true and no partial entry was written.
Note
Not thread-safe; writes only the caller buffer, never MMIO.
See also
ra8_drw_dlist_end
Since
0.1.0

Definition at line 425 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::cap_words, ra8_drw_rect_t::color_argb8888, ra8_drw_dlist_t::count, ra8_drw_rect_t::height_px, internal_dlist_put_reg(), internal_dlist_put_special(), k_ra8_drw_dlist_fill_words, k_ra8_drw_dlr_arg_wait, k_ra8_drw_dlr_idx_color1, k_ra8_drw_dlr_idx_control, k_ra8_drw_dlr_idx_origin, k_ra8_drw_dlr_idx_size, k_ra8_drw_max_height_px, k_ra8_drw_max_width_px, k_ra8_drw_min_dim_px, k_ra8_drw_size_height_pos, k_ra8_err_invalid_arg, k_ra8_err_no_mem, k_ra8_ok, ra8_drw_dlist_t::overflow, priv_ra8_drw_internal_rect_above_max(), priv_ra8_drw_internal_rect_below_min(), priv_ra8_drw_internal_rect_off_surface(), priv_ra8_drw_internal_rect_origin(), RA8_CHECK_NULL_PTR, s_tag, and ra8_drw_rect_t::width_px.

Referenced by demo_build_dlist().

◆ ra8_drw_dlist_begin()

ra8_err_t ra8_drw_dlist_begin ( ra8_drw_dlist_t * dl,
uint32_t * buf,
uint32_t cap_words )
nodiscard

Bind a display-list builder to a caller-owned word buffer.

Resets the builder to empty and records the target buffer. The buffer must be 4-byte aligned and live in a region the DRW bus initiator can read (SRAM). No words are written yet.

Parameters
[out]dlBuilder to initialize.
[in]buf4-byte-aligned word buffer in DRW-readable memory.
[in]cap_wordsCapacity of buf in 32-bit words (>= 1).
Returns
ra8_err_t error code.
Return values
k_ra8_okBuilder bound and cleared.
k_ra8_err_null_ptrdl or buf was nullptr.
k_ra8_err_invalid_argbuf not 4-byte aligned or cap_words 0.
Precondition
dl and buf are non-null.
buf is 4-byte aligned and cap_words >= 1.
Postcondition
dl->count == 0 and dl->overflow == false.
dl->buf == buf and dl->terminated == false.
Note
Not thread-safe; one builder per thread.
See also
ra8_drw_dlist_add_fill
ra8_drw_dlist_end
Since
0.1.0

Definition at line 407 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::buf, ra8_drw_dlist_t::cap_words, ra8_drw_dlist_t::count, k_ra8_drw_internal_align_mask, k_ra8_err_invalid_arg, k_ra8_ok, ra8_drw_dlist_t::overflow, RA8_CHECK_NULL_PTR, s_tag, and ra8_drw_dlist_t::terminated.

Referenced by demo_build_dlist().

◆ ra8_drw_dlist_end()

ra8_err_t ra8_drw_dlist_end ( ra8_drw_dlist_t * dl)
nodiscard

Close a display list with its terminator word.

Appends the end-of-list marker so the DLR stops fetching after the last primitive. Must be called before ra8_drw_dlist_run.

Parameters
[in,out]dlBound builder holding at least one primitive.
Returns
ra8_err_t error code.
Return values
k_ra8_okTerminator appended; the list is runnable.
k_ra8_err_null_ptrdl was nullptr.
k_ra8_err_no_memThe buffer cannot hold the terminator.
k_ra8_err_invalid_argThe builder already overflowed.
Precondition
dl is non-null and was bound by ra8_drw_dlist_begin.
dl has not overflowed.
Postcondition
dl->terminated == true on success.
dl->count grew by one word.
Note
Not thread-safe.
See also
ra8_drw_dlist_run
Since
0.1.0

Definition at line 467 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::cap_words, ra8_drw_dlist_t::count, internal_dlist_put_special(), k_ra8_drw_dlist_special_words, k_ra8_drw_dlr_arg_terminate, k_ra8_err_invalid_arg, k_ra8_err_no_mem, k_ra8_ok, ra8_drw_dlist_t::overflow, RA8_CHECK_NULL_PTR, s_tag, and ra8_drw_dlist_t::terminated.

Referenced by demo_build_dlist().

◆ ra8_drw_dlist_run()

ra8_err_t ra8_drw_dlist_run ( const ra8_drw_dlist_t * dl)
nodiscard

Trigger a built display list (writes DLISTSTART).

Convenience wrapper over ra8_drw_run_dlist that first checks the builder closed cleanly. It flushes the DRW caches and writes DLISTSTART with the buffer address; the DLR then clears and repaints the framebuffer with no CPU framebuffer writes. Poll ra8_drw_wait_idle (or STATUS.DLISTACTIVE) for completion before reading the framebuffer.

Parameters
[in]dlTerminated builder (ra8_drw_dlist_end succeeded).
Returns
ra8_err_t error code.
Return values
k_ra8_okDisplay list triggered.
k_ra8_err_null_ptrdl was nullptr.
k_ra8_err_invalid_argBuilder overflowed, empty or not terminated.
Precondition
dl is non-null, terminated and did not overflow.
The DRW is initialized and idle.
Postcondition
DLISTSTART = dl->buf; the engine begins fetching.
On completion STATUS.DLISTIRQ is raised.
Note
Not thread-safe; writes MMIO.
See also
ra8_drw_dlist_add_fill
Since
0.1.0

Definition at line 482 of file ra8_drw_draw.c.

References ra8_drw_dlist_t::buf, ra8_drw_dlist_t::count, k_ra8_err_invalid_arg, ra8_drw_dlist_t::overflow, RA8_CHECK_NULL_PTR, ra8_drw_run_dlist(), s_tag, and ra8_drw_dlist_t::terminated.

Referenced by main().

◆ ra8_drw_draw_line()

ra8_err_t ra8_drw_draw_line ( const ra8_drw_line_t * line)
nodiscard

Issue an anti-aliased line stroke between two points.

Pre-computes the four perpendicular limiters bounding the stroke, programmes COLOR1, then enables LIM1..LIM4 with the standard intersect topology. HUM Ch 62.4.4 "Lines" p 3725.

Parameters
[in]lineLine parameters. Must not be nullptr.
Returns
ra8_err_t error code.
Return values
k_ra8_okLine issued.
k_ra8_err_null_ptrline was nullptr.
k_ra8_err_invalid_argwidth_px == 0 or > 1024.
Precondition
line non-null.
Driver is initialized.
Postcondition
DRW engine has accepted the line; STATUS may be busy.
COLOR1 holds line->color_argb8888.
Since
0.1.0

Definition at line 206 of file ra8_drw_draw.c.

References ra8_drw_line_t::color_argb8888, internal_program_line_limiters(), k_ra8_drw_cachectl_all_en, k_ra8_drw_cachectl_cflushfx, k_ra8_drw_control_line_quad, k_ra8_drw_max_width_px, k_ra8_drw_off_cachectl, k_ra8_drw_off_control, k_ra8_drw_off_origin, k_ra8_drw_off_size, k_ra8_drw_size_height_pos, k_ra8_err_invalid_arg, k_ra8_ok, priv_ra8_drw_internal_color1_write(), priv_ra8_drw_internal_origin(), RA8_CHECK_NULL_PTR, ra8_drw_reg32(), s_tag, ra8_drw_line_t::width_px, ra8_drw_line_t::x0, ra8_drw_line_t::x1, ra8_drw_line_t::y0, and ra8_drw_line_t::y1.

◆ ra8_drw_draw_triangle()

ra8_err_t ra8_drw_draw_triangle ( const ra8_drw_triangle_t * tri)
nodiscard

Issue an anti-aliased filled triangle.

Computes the three edge limiters and writes CONTROL with LIM1..LIM3 enabled. HUM Ch 62.4.5 "Triangles" p 3726.

Parameters
[in]triTriangle parameters. Must not be nullptr.
Returns
ra8_err_t error code.
Return values
k_ra8_okTriangle issued.
k_ra8_err_null_ptrtri was nullptr.
Precondition
tri non-null.
Driver is initialized.
Postcondition
DRW engine has accepted the triangle.
COLOR1 holds tri->color_argb8888.
Since
0.1.0

Definition at line 245 of file ra8_drw_draw.c.

References ra8_drw_triangle_t::color_argb8888, internal_to_subpixel(), k_ra8_drw_cachectl_all_en, k_ra8_drw_cachectl_cflushfx, k_ra8_drw_control_triangle, k_ra8_drw_off_cachectl, k_ra8_drw_off_control, k_ra8_drw_off_l1start, k_ra8_drw_off_l1xadd, k_ra8_drw_off_l1yadd, k_ra8_drw_off_l2start, k_ra8_drw_off_l2xadd, k_ra8_drw_off_l2yadd, k_ra8_drw_off_l3start, k_ra8_drw_off_l3xadd, k_ra8_drw_off_l3yadd, k_ra8_drw_off_origin, k_ra8_drw_off_size, k_ra8_drw_size_height_pos, k_ra8_ok, priv_ra8_drw_internal_color1_write(), priv_ra8_drw_internal_origin(), RA8_CHECK_NULL_PTR, ra8_drw_reg32(), s_tag, ra8_drw_triangle_t::x0, ra8_drw_triangle_t::x1, ra8_drw_triangle_t::x2, ra8_drw_triangle_t::y0, ra8_drw_triangle_t::y1, and ra8_drw_triangle_t::y2.

◆ ra8_drw_fill_rect()

ra8_err_t ra8_drw_fill_rect ( const ra8_drw_rect_t * rect)
nodiscard

Issue a solid-fill rectangle blit into the framebuffer.

Programmes the DRW limiters to bound a rectangle, sets COLOR1 to the requested ARGB colour, then writes CONTROL with the four limiter-enable bits set to kick the engine.

Parameters
[in]rectRectangle parameters. Must not be nullptr.
Returns
ra8_err_t error code.
Return values
k_ra8_okBlit issued (engine may still be busy).
k_ra8_err_null_ptrrect was nullptr.
k_ra8_err_invalid_argwidth/height was 0 or > 1024.
Precondition
rect is non-null.
Driver is initialized; framebuffer ORIGIN is valid memory.
Postcondition
DRW engine has accepted the rectangle; STATUS may be busy.
Caller may follow with ra8_drw_get_status to wait on k_ra8_drw_status_busyenum to fall to 0.
Note
Not thread-safe with respect to other DRW operations.
See also
ra8_drw_get_status
Since
0.1.0

Definition at line 59 of file ra8_drw_draw.c.

References ra8_drw_rect_t::color_argb8888, ra8_drw_rect_t::height_px, k_ra8_drw_max_height_px, k_ra8_drw_max_width_px, k_ra8_drw_min_dim_px, k_ra8_drw_off_control, k_ra8_drw_off_origin, k_ra8_err_invalid_arg, k_ra8_ok, priv_program_rect_bbox(), priv_ra8_drw_internal_color1_write(), priv_ra8_drw_internal_rect_off_surface(), priv_ra8_drw_internal_rect_origin(), RA8_CHECK_NULL_PTR, ra8_drw_reg32(), s_tag, and ra8_drw_rect_t::width_px.

Referenced by drw_blend_fill(), and drw_demo_fill_and_check().

◆ ra8_drw_perf_arm()

ra8_err_t ra8_drw_perf_arm ( ra8_drw_perftrigger_t event_ctr1,
ra8_drw_perftrigger_t event_ctr2 )
nodiscard

Programme PERFTRIGGER for the two performance counters and reset both PERFCOUNTk registers.

Parameters
[in]event_ctr1Trigger event for PERFCOUNT1.
[in]event_ctr2Trigger event for PERFCOUNT2.
Returns
ra8_err_t error code.
Return values
k_ra8_okCounters armed.
k_ra8_err_invalid_argEither event > 0x1F.
Precondition
Driver has been initialized.
Each event in [0..0x1F]; "Setting prohibited" values rejected where they fall outside the documented set.
Postcondition
PERFTRIGGER carries both selectors; PERFCOUNT1 = PERFCOUNT2 = 0.
Counters begin incrementing on the next clock matching the selected event.
Since
0.1.0

Definition at line 496 of file ra8_drw_draw.c.

References k_ra8_drw_internal_perfev_max, k_ra8_drw_off_perfcount1, k_ra8_drw_off_perfcount2, k_ra8_drw_off_perftrigger, k_ra8_drw_perftrigger2_pos, k_ra8_err_invalid_arg, k_ra8_ok, and ra8_drw_reg32().

◆ ra8_drw_perf_read()

ra8_err_t ra8_drw_perf_read ( ra8_drw_perfcounter_id_t id,
uint32_t * out )
nodiscard

Read one PERFCOUNTk register.

Parameters
[in]idCounter identifier.
[out]outReceives the 32-bit count.
Returns
ra8_err_t error code.
Return values
k_ra8_okCount read.
k_ra8_err_null_ptrout was nullptr.
k_ra8_err_invalid_argid outside enum.
Precondition
out non-null.
Driver has been initialized.
Postcondition
*out holds the snapshot.
No DRW side effects.
Since
0.1.0

Definition at line 515 of file ra8_drw_draw.c.

References k_ra8_drw_off_perfcount1, k_ra8_drw_off_perfcount2, k_ra8_drw_perfctr_1, k_ra8_drw_perfctr_2, k_ra8_err_invalid_arg, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_drw_reg32(), and s_tag.

◆ ra8_drw_perf_reset()

ra8_err_t ra8_drw_perf_reset ( ra8_drw_perfcounter_id_t id)
nodiscard

Reset one PERFCOUNTk register to zero.

Parameters
[in]idCounter identifier.
Returns
ra8_err_t error code.
Return values
k_ra8_okCounter cleared.
k_ra8_err_invalid_argid outside enum.
Precondition
Driver has been initialized.
id is one of k_ra8_drw_perfctr_*.
Postcondition
PERFCOUNTid = 0.
No effect on the other counter.
Since
0.1.0

Definition at line 532 of file ra8_drw_draw.c.

References k_ra8_drw_off_perfcount1, k_ra8_drw_off_perfcount2, k_ra8_drw_perfctr_1, k_ra8_drw_perfctr_2, k_ra8_err_invalid_arg, k_ra8_ok, and ra8_drw_reg32().

◆ ra8_drw_run_dlist()

ra8_err_t ra8_drw_run_dlist ( const uint32_t * dlist_addr)
nodiscard

Trigger execution of a display list.

Writes DLISTSTART with the supplied address. The DRW pulls one 32-bit word at a time from RAM and decodes it as (register index, value) pairs until it hits a terminator. HUM Ch 62.6 "Display List Mode" p 3724-3725.

Parameters
[in]dlist_addrPointer to the first display-list word in memory; must be 4-byte aligned and reside in a region the DRW bus initiator can read.
Returns
ra8_err_t error code.
Return values
k_ra8_okDisplay list trigger written.
k_ra8_err_invalid_argAddress null or unaligned.
Precondition
dlist_addr non-null and 4-byte aligned.
Driver is initialized; CACHECTL flushed if RAM was just written.
Postcondition
DLISTSTART = dlist_addr; engine begins fetching.
On completion the DLISTIRQ flag will be raised in STATUS.
Since
0.1.0

Definition at line 312 of file ra8_drw_draw.c.

References k_ra8_drw_cachectl_all_flush, k_ra8_drw_internal_align_mask, k_ra8_drw_off_cachectl, k_ra8_drw_off_dliststart, k_ra8_err_invalid_arg, k_ra8_ok, and ra8_drw_reg32().

Referenced by ra8_drw_dlist_run().

Variable Documentation

◆ s_tag

const char* s_tag = "DRW"
static

Logging tag for the DRW driver.

TU-local read-only copy. ra8_drw.c keeps its own identical copy so both TUs log under the same "DRW" tag without sharing linkage.

Note
Read-only after definition; do not reassign.
Warning
Direct modification breaks log correlation.
Since
0.1.0

Definition at line 52 of file ra8_drw_draw.c.