|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Caller-filled I2C controller-transfer seam (write / read / write-then-read). More...
#include <ra8_i2c_bus_ops.h>
Data Fields | |
| ra8_err_t(* | write )(void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop) |
| Controller write of len bytes to 7-bit address addr. | |
| ra8_err_t(* | read )(void *ctx, uint8_t addr, uint8_t *data, uint32_t len) |
| Controller read of len bytes from 7-bit address addr. | |
| ra8_err_t(* | transfer )(void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len) |
| Combined write-then-RESTART-then-read in one transaction. | |
| void * | ctx |
| Opaque cookie handed to every callback (binder-owned). | |
Caller-filled I2C controller-transfer seam (write / read / write-then-read).
A device driver stores this struct by value from its config and routes every bus transaction through the three callbacks. The ctx cookie is opaque to the driver; the binder that filled the seam decides what it points at (the Ring-4 ra8_io_i2c_bus_as_ops() points it at the bound ra8_io_i2c_bus_t handle, which must therefore out-live the driver). Tests may fill the seam directly with local trampolines.
Definition at line 78 of file ra8_i2c_bus_ops.h.
| void* ra8_i2c_bus_ops_t::ctx |
Opaque cookie handed to every callback (binder-owned).
Definition at line 138 of file ra8_i2c_bus_ops.h.
Referenced by ra8_io_i2c_bus_as_ops().
Controller read of len bytes from 7-bit address addr.
Issues START, the address byte with R/W# = 1, drains len bytes, then issues STOP and releases the bus.
| [in] | ctx | Binder-owned cookie (the ctx member below). |
| [in] | addr | 7-bit peripheral address. |
| [out] | data | Destination buffer (non-NULL). |
| [in] | len | Byte count (non-zero). |
Definition at line 112 of file ra8_i2c_bus_ops.h.
Referenced by ra8_io_i2c_bus_as_ops(), and ra8_smbus_init().
| ra8_err_t(* ra8_i2c_bus_ops_t::transfer) (void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len) |
Combined write-then-RESTART-then-read in one transaction.
The classic "address a register, read its contents" shape: writes wr_len bytes, injects a repeated START, reads rd_len bytes, then issues STOP. Matches ra8_i2c_transfer / ra8_i3c_transfer.
| [in] | ctx | Binder-owned cookie (the ctx member below). |
| [in] | addr | 7-bit peripheral address. |
| [in] | wr | Bytes to send first (NULL only when wr_len 0). |
| [in] | wr_len | Number of bytes to send. |
| [out] | rd | Destination buffer (NULL only when rd_len 0). |
| [in] | rd_len | Number of bytes to read. |
Definition at line 131 of file ra8_i2c_bus_ops.h.
Referenced by internal_validate_cfg(), ra8_io_i2c_bus_as_ops(), and ra8_smbus_init().
| ra8_err_t(* ra8_i2c_bus_ops_t::write) (void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop) |
Controller write of len bytes to 7-bit address addr.
When send_stop is true the transaction ends with STOP and the bus is released; when false the bus is held so the next call on the same bus injects a repeated-START. Matches the ra8_i2c_write contract (ra8_i3c_write uses the inverted restart flag; binders adapt).
| [in] | ctx | Binder-owned cookie (the ctx member below). |
| [in] | addr | 7-bit peripheral address. |
| [in] | data | Bytes to send (non-NULL when len > 0). |
| [in] | len | Byte count. |
| [in] | send_stop | true = STOP after the payload; false = hold. |
Definition at line 96 of file ra8_i2c_bus_ops.h.
Referenced by internal_validate_cfg(), ra8_io_i2c_bus_as_ops(), and ra8_smbus_init().