|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RIIC bus registry, PI4IOE5V6408 expander, and OV5640 sensor models. More...
Go to the source code of this file.
Data Structures | |
| struct | pi4ioe_state_t |
| One PI4IOE5V6408 I/O expander on the modelled I2C bus. More... | |
| struct | ov5640_state_t |
| One OV5640 camera sensor on the SCCB bus. More... | |
Enumerations | |
| enum | riic_device_const_t : uint32_t { k_riic_dev_max = 4U , k_pi4ioe_addr_7b = 0x43U , k_pi4ioe_reg_max = 0x10U , k_pi4ioe_reg_devid = 0x01U , k_pi4ioe_devid_val = 0xA0U } |
| Registry and PI4IOE5V6408 geometry. More... | |
| enum | ov5640_const_t : uint16_t { k_ov5640_addr_7b = 0x3CU , k_ov5640_reg_id_hi = 0x300AU , k_ov5640_reg_id_lo = 0x300BU , k_ov5640_reg_format = 0x4300U , k_ov5640_reg_isp_mux = 0x501FU , k_ov5640_reg_test = 0x503DU , k_ov5640_id_hi = 0x56U , k_ov5640_id_lo = 0x40U , k_ov5640_ptr_bytes = 2U } |
| OV5640 SCCB sensor constants used by camera_capture. More... | |
Functions | |
| static RA8_INTERNAL void | internal_riic_device_register (riic_device_t device) |
| Register one device in the first free bus slot. | |
| static RA8_INTERNAL void | internal_pi4ioe_write (void *ctx, uint8_t byte) |
| Accept one controller byte for the PI4IOE5V6408. | |
| static RA8_INTERNAL uint32_t | internal_pi4ioe_read (void *ctx, uint8_t *buf, uint32_t max) |
| Serve PI4IOE5V6408 register bytes to the controller. | |
| static RA8_INTERNAL void | internal_pi4ioe_stop (void *ctx) |
| End a PI4IOE5V6408 transfer. | |
| static RA8_INTERNAL void | internal_ov5640_write (void *ctx, uint8_t byte) |
| Accept pointer and configuration bytes for the OV5640. | |
| static RA8_INTERNAL uint32_t | internal_ov5640_read (void *ctx, uint8_t *buf, uint32_t max) |
| Serve one verifier-visible OV5640 register byte. | |
| static RA8_INTERNAL void | internal_ov5640_stop (void *ctx) |
| End an OV5640 SCCB transfer. | |
| RA8_PRIV riic_device_t * | priv_riic_device_find (uint8_t addr_7b) |
| Find the registered RIIC device answering one 7-bit address. | |
| RA8_PRIV void | priv_riic_devices_reset (void) |
| Reset and repopulate the board's RIIC device registry. | |
| RA8_PRIV void | priv_riic_devices_report (void) |
| Report activity observed by the registered board devices. | |
Variables | |
| static riic_device_t | s_riic_dev [k_riic_dev_max] |
| Fixed registry and board-device states. | |
| static pi4ioe_state_t | s_pi4ioe |
| static ov5640_state_t | s_ov5640 |
RIIC bus registry, PI4IOE5V6408 expander, and OV5640 sensor models.
Implements the fixed-capacity device side of the RIIC model. The controller resolves each address through this registry, while the device callbacks retain their own bounded register state and transfer cursors.
Definition in file board_periph_riic_devices.c.
| enum ov5640_const_t : uint16_t |
OV5640 SCCB sensor constants used by camera_capture.
Definition at line 38 of file board_periph_riic_devices.c.
| enum riic_device_const_t : uint32_t |
Registry and PI4IOE5V6408 geometry.
Definition at line 17 of file board_periph_riic_devices.c.
|
static |
Serve one verifier-visible OV5640 register byte.
Returns the fixed 0x5640 identity, a latched configuration byte, or zero for registers outside the deliberately modelled subset.
| [in,out] | ctx | Sensor state registered with the SCCB callback. |
| [out] | buf | Destination receiving the selected register byte. |
| [in] | max | Capacity of buf in bytes. |
buf. | 0 | max is zero; otherwise one byte is returned. |
ctx identifies the module-owned ov5640_state_t instance. buf provides at least one writable byte when max is nonzero. Definition at line 217 of file board_periph_riic_devices.c.
References ov5640_state_t::id_reads, k_ov5640_id_hi, k_ov5640_id_lo, k_ov5640_reg_format, k_ov5640_reg_id_hi, k_ov5640_reg_id_lo, k_ov5640_reg_isp_mux, k_ov5640_reg_test, RA8_INTERNAL, ov5640_state_t::reg_format, ov5640_state_t::reg_isp_mux, ov5640_state_t::reg_ptr, and ov5640_state_t::reg_test.
Referenced by priv_riic_devices_reset().
|
static |
End an OV5640 SCCB transfer.
Clears the two-byte pointer-capture count so the next transfer begins with a fresh big-endian register address.
| [in,out] | ctx | Sensor state registered with the SCCB callback. |
ctx identifies the module-owned ov5640_state_t instance. Definition at line 253 of file board_periph_riic_devices.c.
References RA8_INTERNAL.
Referenced by priv_riic_devices_reset().
|
static |
Accept pointer and configuration bytes for the OV5640.
Captures the first two bytes as a big-endian register pointer and latches payload writes only for the verifier-visible configuration subset.
| [in,out] | ctx | Sensor state registered with the SCCB callback. |
| [in] | byte | Register-pointer or configuration byte from the controller. |
ctx identifies the module-owned ov5640_state_t instance. Definition at line 180 of file board_periph_riic_devices.c.
References k_ov5640_ptr_bytes, k_ov5640_reg_format, k_ov5640_reg_isp_mux, k_ov5640_reg_test, ov5640_state_t::ptr_bytes, RA8_INTERNAL, ov5640_state_t::reg_format, ov5640_state_t::reg_isp_mux, ov5640_state_t::reg_ptr, ov5640_state_t::reg_test, and ov5640_state_t::writes.
Referenced by priv_riic_devices_reset().
|
static |
Serve PI4IOE5V6408 register bytes to the controller.
Copies at most the register-file capacity beginning at the active auto-incrementing pointer, wrapping each addressed register independently.
| [in,out] | ctx | Expander state registered with the bus callback. |
| [out] | buf | Destination receiving consecutive register bytes. |
| [in] | max | Capacity of buf in bytes. |
buf. | 0 | max is zero; otherwise the smaller of max and the register file capacity. |
ctx identifies the module-owned pi4ioe_state_t instance. buf provides at least max writable bytes when max is nonzero. Definition at line 136 of file board_periph_riic_devices.c.
References pi4ioe_state_t::file, k_pi4ioe_reg_max, RA8_INTERNAL, and pi4ioe_state_t::reg_ptr.
Referenced by priv_riic_devices_reset().
|
static |
End a PI4IOE5V6408 transfer.
Clears the pointer-capture latch so the first byte of the next transfer selects a new register.
| [in,out] | ctx | Expander state registered with the bus callback. |
ctx identifies the module-owned pi4ioe_state_t instance. Definition at line 162 of file board_periph_riic_devices.c.
References RA8_INTERNAL.
Referenced by priv_riic_devices_reset().
|
static |
Accept one controller byte for the PI4IOE5V6408.
Treats the first byte as the register pointer and each following byte as register data, advancing the pointer after every payload byte.
| [in,out] | ctx | Expander state registered with the bus callback. |
| [in] | byte | Register-pointer or payload byte from the controller. |
ctx identifies the module-owned pi4ioe_state_t instance. Definition at line 106 of file board_periph_riic_devices.c.
References pi4ioe_state_t::file, k_pi4ioe_reg_max, pi4ioe_state_t::ptr_set, RA8_INTERNAL, pi4ioe_state_t::reg_ptr, and pi4ioe_state_t::writes.
Referenced by priv_riic_devices_reset().
|
static |
Register one device in the first free bus slot.
Copies the supplied callback entry into fixed registry storage and leaves the registry unchanged when every slot is occupied.
| [in] | device | Fully initialized device callback entry. |
device is marked present and carries callbacks valid for the run. Definition at line 83 of file board_periph_riic_devices.c.
References k_riic_dev_max, RA8_INTERNAL, and s_riic_dev.
Referenced by priv_riic_devices_reset().
| RA8_PRIV riic_device_t * priv_riic_device_find | ( | uint8_t | addr_7b | ) |
Find the registered RIIC device answering one 7-bit address.
Searches the fixed-capacity board-device registry without changing transfer state or acquiring storage.
| [in] | addr_7b | Seven-bit bus address to resolve. |
| nullptr | No registered device claims addr_7b; otherwise the returned pointer identifies the matching entry. |
addr_7b is limited to the seven-bit I2C address domain. Definition at line 258 of file board_periph_riic_devices.c.
References k_riic_dev_max, RA8_PRIV, and s_riic_dev.
Referenced by internal_riic_address_phase(), internal_riic_close_transfer(), and internal_riic_icdrt_write().
| RA8_PRIV void priv_riic_devices_report | ( | void | ) |
Report activity observed by the registered board devices.
Emits one diagnostic line for an active expander or camera model, including accepted writes and OV5640 identity-register reads.
Definition at line 291 of file board_periph_riic_devices.c.
References k_ov5640_addr_7b, k_pi4ioe_addr_7b, priv_emu_io_errf(), RA8_PRIV, s_ov5640, and s_pi4ioe.
Referenced by internal_riic_report().
| RA8_PRIV void priv_riic_devices_reset | ( | void | ) |
Reset and repopulate the board's RIIC device registry.
Clears all registry and device state, seeds the expander identity register, and installs the PI4IOE5V6408 and OV5640 callback entries.
Definition at line 268 of file board_periph_riic_devices.c.
References internal_ov5640_read(), internal_ov5640_stop(), internal_ov5640_write(), internal_pi4ioe_read(), internal_pi4ioe_stop(), internal_pi4ioe_write(), internal_riic_device_register(), k_ov5640_addr_7b, k_pi4ioe_addr_7b, k_pi4ioe_devid_val, k_pi4ioe_reg_devid, k_riic_dev_max, RA8_PRIV, s_ov5640, s_pi4ioe, and s_riic_dev.
Referenced by internal_riic_reset().
|
static |
Definition at line 69 of file board_periph_riic_devices.c.
Referenced by priv_riic_devices_report(), and priv_riic_devices_reset().
|
static |
Definition at line 68 of file board_periph_riic_devices.c.
Referenced by priv_riic_devices_report(), and priv_riic_devices_reset().
|
static |
Fixed registry and board-device states.
Definition at line 67 of file board_periph_riic_devices.c.
Referenced by internal_riic_device_register(), priv_riic_device_find(), and priv_riic_devices_reset().