![]() |
Synergy Software Package User's Manual
|
Driver for the I2C Bus Slave Interface (IIC Slave). More...
Data Structures | |
| struct | riic_slave_instance_ctrl_t |
Macros | |
| #define | RIIC_SLAVE_ERROR_RETURN(a, err) SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_riic_slave_version) |
| #define | RIIC_SLAVE_OPEN (0x49324353ULL) |
Functions | |
| ssp_err_t | R_RIIC_SlaveVersionGet (ssp_version_t *const p_version) |
| Gets version information and stores it in the provided version struct. More... | |
| ssp_err_t | R_RIIC_SlaveOpen (i2c_ctrl_t *const p_api_ctrl, i2c_cfg_t const *const p_cfg) |
| Opens the I2C device. May power on IIC peripheral and perform initialization described in hardware manual. More... | |
| ssp_err_t | R_RIIC_SlaveClose (i2c_ctrl_t *const p_api_ctrl) |
| Closes the I2C device. Power down IIC peripheral. More... | |
| ssp_err_t | R_RIIC_MasterWriteSlaveRead (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes) |
| Performs a read from the I2C Master device. More... | |
| ssp_err_t | R_RIIC_MasterReadSlaveWrite (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_src, uint32_t const bytes) |
| Performs a write to the I2C Master device. More... | |
Variables | |
| i2c_api_slave_t const | g_i2c_slave_on_riic |
Driver for the I2C Bus Slave Interface (IIC Slave).
This module supports the Renesas Inter-Integrated Circuit (IIC) peripheral. It implements the following interfaces:
| #define RIIC_SLAVE_ERROR_RETURN | ( | a, | |
| err | |||
| ) | SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_riic_slave_version) |
Macro for error logger.
| #define RIIC_SLAVE_OPEN (0x49324353ULL) |
"I2CS" in ASCII, used to determine if channel is open.
| ssp_err_t R_RIIC_MasterReadSlaveWrite | ( | i2c_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_src, | ||
| uint32_t const | bytes | ||
| ) |
Performs a write to the I2C Master device.
This function will fail if there is already an in-progress I2C transfer on the associated channel. Otherwise, the I2C write operation will begin. When no callback is provided by the user, this function performs a blocking write. Otherwise, the write operation is non-blocking and the caller will be notified when the operation has finished by an I2C_EVENT_TX_COMPLETE in the callback.
| SSP_SUCCESS | Function executed without issue; if no callback was provided, the process was kicked off |
| SSP_ERR_ASSERTION | p_api_ctrl or p_src is NULL. |
| SSP_ERR_IN_USE | Another transfer was in progress. |
| SSP_ERR_NOT_OPEN | device is not open. |
| SSP_ERR_ABORTED | If transaction encounter an error. |
Check if the device is open, return an error if not
Return an error if transfer is in progress
Record the new information about this transfer
Start the write operation as a slave
| ssp_err_t R_RIIC_MasterWriteSlaveRead | ( | i2c_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_dest, | ||
| uint32_t const | bytes | ||
| ) |
Performs a read from the I2C Master device.
This function will fail if there is already an in-progress I2C transfer on the associated channel. Otherwise, the I2C read operation will begin. When no callback is provided by the user, this function performs a blocking read. Otherwise, the read operation is non-blocking and the caller will be notified when the operation has finished by an I2C_EVENT_RX_COMPLETE in the callback.
| SSP_SUCCESS | Function executed without issue; if no callback was provided, the process was kicked off |
| SSP_ERR_ASSERTION | p_api_ctrl, bytes or p_dest is NULL. |
| SSP_ERR_IN_USE | Another transfer was in progress. |
| SSP_ERR_NOT_OPEN | device is not open. |
| SSP_ERR_ABORTED | If transaction encounter an error. |
Check if the device is open, return an error if not
Return an error if transfer is in progress.
Record the new information about this transfer
Start the read operation as a slave
| ssp_err_t R_RIIC_SlaveClose | ( | i2c_ctrl_t *const | p_api_ctrl | ) |
Closes the I2C device. Power down IIC peripheral.
| SSP_SUCCESS | Device closed without issue. |
| SSP_ERR_NOT_OPEN | Device not opened. |
| SSP_ERR_ASSERTION | p_api_ctrl is NULL. |
| SSP_ERR_ABORTED | Device was closed while a transfer was in progress. |
Check if the device is even open, return an error if not
De-configure everything.
| ssp_err_t R_RIIC_SlaveOpen | ( | i2c_ctrl_t *const | p_api_ctrl, |
| i2c_cfg_t const *const | p_cfg | ||
| ) |
Opens the I2C device. May power on IIC peripheral and perform initialization described in hardware manual.
| SSP_SUCCESS | Opened identical configuration of already open instance. |
| SSP_ERR_ASSERTION | p_api_ctrl or p_cfg is NULL. |
| SSP_ERR_IN_USE | Attempted to open an already open device instance. |
| SSP_ERR_IRQ_BSP_DISABLED | Interrupt does not exist in the vector table. |
| SSP_ERR_INVALID_ARGUMENT | If fast mode plus is configured and the channel does not support it |
If rate is configured as Fast mode plus, check whether the channel supports it
Attempt to acquire hardware lock
Open the hardware in slave mode
Clear all interrupt bits
Enable both TXI and RXI interrupt sources
Set ACK as slave is now ready to serve requests from master
Enable all RIIC interrupts in NVIC, that need to be serviced
Release hardware lock on failure
| ssp_err_t R_RIIC_SlaveVersionGet | ( | ssp_version_t *const | p_version | ) |
Gets version information and stores it in the provided version struct.
| SSP_SUCCESS | Successful version get. |
| SSP_ERR_ASSERTION | p_version is NULL. |
| i2c_api_slave_t const g_i2c_slave_on_riic |
RIIC Implementation of I2C device slave interface