ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_mipi_phy_api.h
Go to the documentation of this file.
1
29
30#pragma once
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <stdint.h>
37
38#include "ra8_err.h"
39#include "ra8_mipi_phy_regs.h"
40#include "ra8_mipi_phy_types.h"
41
42/* =============================================================================
43 * Lifecycle
44 * =============================================================================
45 */
46
118[[nodiscard]] ra8_err_t ra8_mipi_phy_init(const ra8_mipi_phy_config_t* cfg);
119
134[[nodiscard]] ra8_err_t ra8_mipi_phy_deinit(void);
135
155[[nodiscard]] ra8_err_t ra8_mipi_phy_reset(void);
156
173
174/* =============================================================================
175 * Status
176 * =============================================================================
177 */
178
194[[nodiscard]] ra8_err_t ra8_mipi_phy_get_status(uint32_t* out_mask);
195
217
239
251[[nodiscard]] ra8_err_t ra8_mipi_phy_wait_ready(void);
252
253/* =============================================================================
254 * Interrupt path
255 * =============================================================================
256 */
257
273
300void ra8_mipi_phy_dispatch(void);
301
302/* =============================================================================
303 * Power transition
304 * =============================================================================
305 */
306
324[[nodiscard]] ra8_err_t ra8_mipi_phy_enter_stop(void);
325
342
355[[nodiscard]] ra8_err_t ra8_mipi_phy_ldo_enable(void);
356
368[[nodiscard]] ra8_err_t ra8_mipi_phy_ldo_disable(void);
369
382[[nodiscard]] ra8_err_t ra8_mipi_phy_pll_start(void);
383
395[[nodiscard]] ra8_err_t ra8_mipi_phy_pll_stop(void);
396
397#ifdef __cplusplus
398}
399#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_mipi_phy_ldo_enable(void)
Enable the D-PHY LDO (DPHYPWRCR.PWRSEN = 1) only.
ra8_err_t ra8_mipi_phy_deinit(void)
Stop the D-PHY per HUM Ch 64.3.2 p 3837 (DPHYEN -> PLLSTP -> PWRSEN).
ra8_err_t ra8_mipi_phy_exit_stop(const ra8_mipi_phy_config_t *cfg)
Post-standby resume: re-run the start-up procedure.
void ra8_mipi_phy_dispatch(void)
Read DPHYSFR, snapshot it, decode events, and fire the callback.
ra8_err_t ra8_mipi_phy_pll_start(void)
Release the PLL (DPHYPLOCR.PLLSTP = 0) and wait for lock.
bool ra8_mipi_phy_is_pll_locked(void)
Test whether the PLL is locked (DPHYSFR.PLLSF = 1).
ra8_err_t ra8_mipi_phy_init(const ra8_mipi_phy_config_t *cfg)
Bring up the D-PHY end-to-end per HUM Ch 64.3.1 p 3837.
ra8_err_t ra8_mipi_phy_recover_from_error(const ra8_mipi_phy_config_t *cfg)
Reset and re-arm the PHY after an LDO drop / PLL unlock.
ra8_err_t ra8_mipi_phy_attach_handler(ra8_mipi_phy_event_fn_t fn, void *ctx)
Attach a status callback fired by ra8_mipi_phy_dispatch.
bool ra8_mipi_phy_is_ldo_stable(void)
Test whether the LDO has stabilised (DPHYSFR.PWRSF = 1).
ra8_err_t ra8_mipi_phy_ldo_disable(void)
Disable the D-PHY LDO (DPHYPWRCR.PWRSEN = 0) only.
ra8_err_t ra8_mipi_phy_wait_ready(void)
Bounded poll until the PHY is fully ready (PWRSF & PLLSF).
ra8_err_t ra8_mipi_phy_get_status(uint32_t *out_mask)
Read the D-PHY status flags (DPHYSFR).
ra8_err_t ra8_mipi_phy_reset(void)
Reset the PHY to its post-MSTPCRC-clear state without re-init.
ra8_err_t ra8_mipi_phy_enter_stop(void)
Pre-standby tear-down: disable D-PHY then drop the LDO.
ra8_err_t ra8_mipi_phy_pll_stop(void)
Stop the PLL (DPHYPLOCR.PLLSTP = 1).
MIPI D-PHY register layout for the RA8D2.
MIPI D-PHY driver – shared enums, structs, and callback typedef.
void(* ra8_mipi_phy_event_fn_t)(void *ctx, ra8_mipi_phy_event_t event, uint32_t sfr)
MIPI PHY status callback (LDO ready / PLL lock / PLL drop).
Top-level configuration for ra8_mipi_phy_init.