|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Test-access surface for ra8_drw internal helpers (MC/DC). More...
Go to the source code of this file.
Enumerations | |
| enum | ra8_drw_internal_const_t : uint16_t { k_ra8_drw_internal_byte_mask = 0x00FFU , k_ra8_drw_internal_one_subpx = 16U , k_ra8_drw_internal_clut_max = 256U , k_ra8_drw_internal_dlist_align = 4U , k_ra8_drw_internal_perfev_max = 0x001FU } |
| Driver-internal numeric constants – avoid bare literals. More... | |
| enum | ra8_drw_internal_mask32_t : uint32_t { k_ra8_drw_internal_color_alpha_mask = 0x00FFFFFFUL , k_ra8_drw_internal_align_mask = 0x00000003UL } |
| 32-bit driver-internal masks. More... | |
Functions | |
| static uint32_t | internal_to_subpixel (int32_t px) |
| Convert a signed pixel coordinate to the DRW Q12.4 sub-pixel grid. | |
| static int32_t | internal_iabs (int32_t v) |
| Compute integer absolute value with no library calls. | |
| void | priv_program_rect_bbox (const ra8_drw_rect_t *rect) |
| Programme the bounding box that describes an axis-aligned rect. | |
| uint32_t | priv_ra8_drw_internal_rect_origin (const ra8_drw_rect_t *rect) |
| Framebuffer byte address of a rectangle's top-left pixel. | |
| bool | priv_ra8_drw_internal_rect_off_surface (const ra8_drw_rect_t *rect) |
| Reject a rectangle that would rasterize outside the framebuffer. | |
| bool | priv_ra8_drw_internal_rect_below_min (uint16_t min_dim, uint16_t width, uint16_t height) |
| Pure predicate for the "rect is below min dim" rejection. | |
| bool | priv_ra8_drw_internal_rect_above_max (uint16_t max_w, uint16_t max_h, uint16_t width, uint16_t height) |
| Pure predicate for the "rect exceeds max dim" rejection. | |
| uint32_t | priv_ra8_drw_internal_origin (void) |
| Read the cached ORIGIN (framebuffer base) render-trigger value. | |
| void | priv_ra8_drw_internal_color1_write (uint32_t argb8888) |
| Write COLOR1 through the software shadow (write-only register). | |
Test-access surface for ra8_drw internal helpers (MC/DC).
Declares module-private geometry helpers shared by the DRW command and drawing translation units.
Definition in file ra8_drw_internal.h.
| enum ra8_drw_internal_const_t : uint16_t |
Driver-internal numeric constants – avoid bare literals.
Shared between ra8_drw.c and ra8_drw_draw.c so the surface-setup TU and the geometry-primitive TU draw on the same named constants.
uint16_t.Definition at line 35 of file ra8_drw_internal.h.
| enum ra8_drw_internal_mask32_t : uint32_t |
32-bit driver-internal masks.
Shared between ra8_drw.c and ra8_drw_draw.c.
uint32_t.| Enumerator | |
|---|---|
| k_ra8_drw_internal_color_alpha_mask | 0x00RRGGBB low bits. |
| k_ra8_drw_internal_align_mask | 4-byte alignment. |
Definition at line 54 of file ra8_drw_internal.h.
|
inlinestatic |
Compute integer absolute value with no library calls.
Branch-on-sign absolute value, used by the line and triangle primitives. Shared between DRW TUs.
| [in] | v | Signed value (range [-32768, 32767]). |
| -v | When v is negative (v < 0): the arithmetic negation. |
| v | When v is non-negative (v >= 0): v unchanged. |
v may be any int32_t except INT32_MIN. Definition at line 110 of file ra8_drw_internal.h.
References RA8_INTERNAL.
Referenced by internal_program_line_limiters().
|
inlinestatic |
Convert a signed pixel coordinate to the DRW Q12.4 sub-pixel grid.
Shifts px left by the sub-pixel shift so 1 px maps to 16 sub-pixels. Shared by both DRW TUs (surface setup and geometry primitives).
| [in] | px | Pixel coordinate (signed, in [-32768, 32767] range – the framebuffer never grows beyond 1024x1024). |
| (uint32_t)px<<4 | The coordinate scaled by 16 sub-pixels per pixel; two's-complement wrap makes a negative px yield the bit-identical unsigned Q12.4 value. |
px upstream. Definition at line 82 of file ra8_drw_internal.h.
References k_ra8_drw_subpixel_shift, and RA8_INTERNAL.
Referenced by internal_program_line_limiters(), and ra8_drw_draw_triangle().
| void priv_program_rect_bbox | ( | const ra8_drw_rect_t * | rect | ) |
Programme the bounding box that describes an axis-aligned rect.
Writes SIZE (HUM Ch 62.2.29 p 3704) and clears the six spatial limiters (HUM Ch 62.2.10-62.2.12 pp 3698-3699). An axis-aligned solid rectangle needs NO limiter: HUM Ch 62.6.2 p 3716 has the engine scan "the whole bounding box" anchored at ORIGIN, so the box scan already produces exactly the requested extent. Position comes from ORIGIN, which the caller writes last because that write is the render trigger (HUM Ch 62.2.31 p 3705).
Shared between ra8_drw.c and ra8_drw_draw.c so the solid-fill and the textured-blit primitive describe their extent identically.
| [in] | rect | Rectangle in pixel space (validated by caller). |
rect dimensions in [1..1024]. Definition at line 416 of file ra8_drw.c.
References ra8_drw_rect_t::height_px, 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_l4start, k_ra8_drw_off_l4xadd, k_ra8_drw_off_l4yadd, k_ra8_drw_off_size, k_ra8_drw_size_height_pos, ra8_drw_reg32(), and ra8_drw_rect_t::width_px.
Referenced by ra8_drw_blit_textured_rect(), and ra8_drw_fill_rect().
| void priv_ra8_drw_internal_color1_write | ( | uint32_t | argb8888 | ) |
Write COLOR1 through the software shadow (write-only register).
COLOR1 – like the whole DRW register file – is write-only on silicon (HUM Ch 62.2.7, R/W column "W"), so the alpha-preserving update in ra8_drw_set_blend cannot read the current value back from hardware. Every COLOR1 write in both DRW TUs goes through this helper, which writes the register and keeps the driver-side shadow coherent.
| [in] | argb8888 | Full 0xAARRGGBB value to program. |
argb8888 is the complete register value (no partial masks). argb8888. Write COLOR1 through the software shadow (write-only register).
Definition at line 238 of file ra8_drw.c.
References k_ra8_drw_off_color1, ra8_drw_reg32(), and s_drw_color1.
Referenced by ra8_drw_draw_line(), ra8_drw_draw_triangle(), ra8_drw_fill_rect(), ra8_drw_set_blend(), and ra8_drw_set_gradient().
| uint32_t priv_ra8_drw_internal_origin | ( | void | ) |
Read the cached ORIGIN (framebuffer base) render-trigger value.
HUM Ch 62.2.31: writing ORIGIN triggers the start of rendering, so every geometry primitive in ra8_drw_draw.c re-writes it as its final step. The value is cached by ra8_drw_init (the DRW register file is write-only, so it cannot be read back from hardware).
| 0 | Driver not initialized (or de-initialized). |
| addr | The 32-bit framebuffer base from ra8_drw_init. |
Read the cached ORIGIN (framebuffer base) render-trigger value.
Definition at line 212 of file ra8_drw.c.
References s_drw_origin.
Referenced by ra8_drw_draw_line(), and ra8_drw_draw_triangle().
| bool priv_ra8_drw_internal_rect_above_max | ( | uint16_t | max_w, |
| uint16_t | max_h, | ||
| uint16_t | width, | ||
| uint16_t | height ) |
Pure predicate for the "rect exceeds max dim" rejection.
Returns true iff width exceeds max_w or height exceeds max_h. Promoted from the inline compound OR at libs/ra8_hal/src/ra8_drw.c inside ra8_drw_blit_textured_rect.
| [in] | max_w | Maximum permitted width (1024 px). |
| [in] | max_h | Maximum permitted height (1024 px). |
| [in] | width | Width in pixels. |
| [in] | height | Height in pixels. |
| true | Caller must return k_ra8_err_invalid_arg. |
| false | Dimensions are within both upper bounds. |
Pure predicate for the "rect exceeds max dim" rejection.
Promoted helper so the line-780 OR can be driven under MC/DC.
| [in] | max_w | Maximum permitted width. |
| [in] | max_h | Maximum permitted height. |
| [in] | width | Width in pixels. |
| [in] | height | Height in pixels. |
| true | Dimension above max. |
| false | Both within bounds. |
Definition at line 97 of file ra8_drw.c.
Referenced by ra8_drw_blit_textured_rect(), and ra8_drw_dlist_add_fill().
| bool priv_ra8_drw_internal_rect_below_min | ( | uint16_t | min_dim, |
| uint16_t | width, | ||
| uint16_t | height ) |
Pure predicate for the "rect is below min dim" rejection.
Returns true iff width or height is below min_dim. Promoted from the inline compound OR at libs/ra8_hal/src/ra8_drw.c inside ra8_drw_blit_textured_rect.
| [in] | min_dim | Minimum permitted dimension (1 px). |
| [in] | width | Width in pixels. |
| [in] | height | Height in pixels. |
| true | Caller must return k_ra8_err_invalid_arg. |
| false | Dimensions meet the lower bound. |
Pure predicate for the "rect is below min dim" rejection.
Promoted helper so the line-776 OR can be driven under MC/DC.
| [in] | min_dim | Minimum permitted dimension (1 px). |
| [in] | width | Width in pixels. |
| [in] | height | Height in pixels. |
| true | Dimension below min. |
| false | Both dimensions in range. |
Definition at line 75 of file ra8_drw.c.
Referenced by ra8_drw_blit_textured_rect(), and ra8_drw_dlist_add_fill().
| bool priv_ra8_drw_internal_rect_off_surface | ( | const ra8_drw_rect_t * | rect | ) |
Reject a rectangle that would rasterize outside the framebuffer.
With the bounding box positioned by ORIGIN there is no limiter clipping left to contain an out-of-range rectangle, so a negative origin or a right edge past the pitch would have the engine scribble over unrelated memory. Callers must reject before triggering a render.
| [in] | rect | Rectangle in pixel space. |
| true | Caller must return k_ra8_err_invalid_arg. |
| false | The rect starts on the surface and fits the pitch. |
rect is non-null. rect and the cached pitch.Definition at line 225 of file ra8_drw.c.
References s_drw_pitch_px, ra8_drw_rect_t::width_px, ra8_drw_rect_t::x, and ra8_drw_rect_t::y.
Referenced by ra8_drw_blit_textured_rect(), ra8_drw_dlist_add_fill(), and ra8_drw_fill_rect().
| uint32_t priv_ra8_drw_internal_rect_origin | ( | const ra8_drw_rect_t * | rect | ) |
Framebuffer byte address of a rectangle's top-left pixel.
The engine scans its bounding box anchored at ORIGIN (HUM Ch 62.6.2 p 3716), so a primitive is positioned by pointing ORIGIN at its own top-left pixel rather than at the framebuffer base. Computes base + ((y * pitch) + x) * bytes_per_px from the geometry cached at ra8_drw_init.
| [in] | rect | Rectangle in pixel space (validated by caller). |
| base | The rect is at (0, 0). |
rect lies on the surface – see priv_ra8_drw_internal_rect_off_surface. Definition at line 217 of file ra8_drw.c.
References s_drw_bytes_px, s_drw_origin, s_drw_pitch_px, ra8_drw_rect_t::x, and ra8_drw_rect_t::y.
Referenced by ra8_drw_blit_textured_rect(), ra8_drw_dlist_add_fill(), and ra8_drw_fill_rect().