RA Flexible Software Package Documentation
Release v5.7.0
|
|
Functions | |
fsp_err_t | RM_COMMS_SMBUS_Open (rm_comms_ctrl_t *const p_api_ctrl, rm_comms_cfg_t const *const p_cfg) |
Opens and configures the SMBUS Comms module. Implements rm_comms_api_t::open. More... | |
fsp_err_t | RM_COMMS_SMBUS_Close (rm_comms_ctrl_t *const p_api_ctrl) |
Disables specified SMBUS Comms module. Implements rm_comms_api_t::close. More... | |
fsp_err_t | RM_COMMS_SMBUS_CallbackSet (rm_comms_ctrl_t *const p_api_ctrl, void(*p_callback)(rm_comms_callback_args_t *), void const *const p_context) |
Updates the SMBUS Comms callback. Implements rm_comms_api_t::callbackSet. More... | |
fsp_err_t | RM_COMMS_SMBUS_Read (rm_comms_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes) |
Performs a read from the SMBUS device. Implements rm_comms_api_t::read. More... | |
fsp_err_t | RM_COMMS_SMBUS_Write (rm_comms_ctrl_t *const p_api_ctrl, uint8_t *const p_src, uint32_t const bytes) |
Performs a write from the SMBUS device. Implements rm_comms_api_t::write. More... | |
fsp_err_t | RM_COMMS_SMBUS_WriteRead (rm_comms_ctrl_t *const p_api_ctrl, rm_comms_write_read_params_t const write_read_params) |
Performs a write to, then a read from the SMBUS device. Implements rm_comms_api_t::writeRead. More... | |
void | rm_comms_smbus_transmission_callback (i2c_master_callback_args_t *p_args) |
Common callback function called in the I2C driver callback function when SMBus is used. | |
void | rm_comms_smbus_timeout_callback (timer_callback_args_t *p_args) |
Callback function called in the GPT driver callback function when SMBus is used. | |
Middleware to implement the SMBUS communications interface. This module implements the Communicatons Middleware Interface.
The RM_COMMS_SMBUS module implements COMMS API for SMBUS interface.
RM_COMMS_SMBUS supports SMBus protocol on following modules:
Supported SMBUS command:
Packet error check is supported by software CRC-8 (x^8 + x^2 + x + 1).
Supported RTOS (FreeRTOS and AzureOS).
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Manual Entry | g_comms_smbus0 | Module name. |
Callback | Name must be a valid C symbol | comms_smbus_callback | A user callback function can be provided. |
Semaphore Timeout (RTOS only) | Value must be a non-negative integer | 0xFFFFFFFF | Timeout for semaphore operation in using RTOS. |
Slave Address | Value must be non-negative | 0x00 | Specify the slave address. |
CRC support |
| Enable | Use CRC-8 algorithm to generate PEC byte for SMBus communication. |
This module uses SDA and SCL pins of I2C Master
If an RTOS is used, blocking and bus lock is available.
If an RTOS is used and blocking and bus lock is enabled, RM_COMMS_SMBUS_Write(), RM_COMMS_SMBUS_Read() and RM_COMMS_SMBUS_WriteRead() cannot be called in callback.
Dependency module General PWM Timer (GPT) and Event Link Controller (ELC) need to be openned before opening SMBus comms device.
Protocol support by SMBUS API:
The SMBUS communications interface expects a bus instance to be opened before opening any specific SMBUS comms device. The communications interface will handle switching between devices on the bus but will not open or close the bus instance. The user should open the bus with the appropriate SMBUS Communication Device (rm_comms_smbus) open call.
This is a basic example of minimal use of SMBus communications implementation in an application.
Data Structures | |
struct | rm_comms_smbus_error_t |
struct | rm_comms_smbus_extended_cfg_t |
struct | rm_comms_smbus_instance_ctrl_t |
Enumerations | |
enum | rm_comms_smbus_event_t |
struct rm_comms_smbus_error_t |
SMBus error structure
struct rm_comms_smbus_extended_cfg_t |
Extend configuration of SMBus
Data Fields | ||
---|---|---|
bool | pec_enable | Calculate PEC byte for SMBus transmission. |
rm_comms_i2c_bus_extended_cfg_t * | p_comms_i2c_extend_cfg | Pointer to extend configuration block of rm_comms_i2c. |
rm_comms_i2c_instance_ctrl_t * | p_comms_i2c_ctrl | Control block of rm_comms_i2c. |
struct rm_comms_smbus_instance_ctrl_t |
SMBus middleware control block
Data Fields | ||
---|---|---|
bool | timer_is_enabled | Validate that external event triggers stop the timer is enabled. |
uint8_t | write_buff[RM_COMMS_SMBUS_TRANSMISSION_MAX_BYTES] | Intermediate buffer. |
uint8_t | receive_crc_seed | CRC seed value. |
uint32_t | open | Open flag. |
rm_comms_i2c_instance_ctrl_t * | p_comms_i2c_ctrl | Control block of rm_comms_i2c. |
rm_comms_smbus_error_t * | p_smbus_error | SMBus specific error code. |
const void * | p_context |
SMBus specific event
fsp_err_t RM_COMMS_SMBUS_Open | ( | rm_comms_ctrl_t *const | p_api_ctrl, |
rm_comms_cfg_t const *const | p_cfg | ||
) |
Opens and configures the SMBUS Comms module. Implements rm_comms_api_t::open.
FSP_SUCCESS | Communications Middle module successfully configured. |
FSP_ERR_ASSERTION | Null pointer, or one or more configuration options is invalid. |
FSP_ERR_ALREADY_OPEN | Module is already open. This module can only be opened once. |
fsp_err_t RM_COMMS_SMBUS_Close | ( | rm_comms_ctrl_t *const | p_api_ctrl | ) |
Disables specified SMBUS Comms module. Implements rm_comms_api_t::close.
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_COMMS_SMBUS_CallbackSet | ( | rm_comms_ctrl_t *const | p_api_ctrl, |
void(*)(rm_comms_callback_args_t *) | p_callback, | ||
void const *const | p_context | ||
) |
Updates the SMBUS Comms callback. Implements rm_comms_api_t::callbackSet.
FSP_SUCCESS | Successfully set. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_COMMS_SMBUS_Read | ( | rm_comms_ctrl_t *const | p_api_ctrl, |
uint8_t *const | p_dest, | ||
uint32_t const | bytes | ||
) |
Performs a read from the SMBUS device. Implements rm_comms_api_t::read.
FSP_SUCCESS | Successfully data decoded. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_SIZE | Read data size is invalid. |
fsp_err_t RM_COMMS_SMBUS_Write | ( | rm_comms_ctrl_t *const | p_api_ctrl, |
uint8_t *const | p_src, | ||
uint32_t const | bytes | ||
) |
Performs a write from the SMBUS device. Implements rm_comms_api_t::write.
FSP_SUCCESS | Successfully writing data . |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_SIZE | Transfer data size is invalid. |
fsp_err_t RM_COMMS_SMBUS_WriteRead | ( | rm_comms_ctrl_t *const | p_api_ctrl, |
rm_comms_write_read_params_t const | write_read_params | ||
) |
Performs a write to, then a read from the SMBUS device. Implements rm_comms_api_t::writeRead.
FSP_SUCCESS | Successfully data decoded. |
FSP_ERR_ASSERTION | Null pointer passed as a parameter. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_SIZE | Transfer data size is invalid. |