![]() |
TT-System-Firmware APIs 19.13.99
Tenstorrent Firmware
|


Go to the source code of this file.
Data Structures | |
| struct | smbus_cmd_def |
| struct | smbus_cmd_registration |
| Command registration entry for table-driven SMBus setup. More... | |
Macros | |
| #define | SMBUS_CMD_ENTRY(_cmd, _pec, _trans_type, _rcv, _send) |
| Build a generic SMBus command registration entry. | |
| #define | SMBUS_CMD_HANDLER_FIELDS_WRITE(_func) |
| Build handler-field initializers for WRITE direction. | |
| #define | SMBUS_CMD_HANDLER_FIELDS_READ(_func) |
| Build handler-field initializers for READ direction. | |
| #define | SMBUS_CMD_GEN_ENTRY(_cmd, _pec, _dir, _kind, _func) |
| Build an entry by direction and transaction-kind suffix. | |
| #define | SMBUS_CMD_BLOCK_RD_ENTRY(_cmd, _pec, _send) |
| Build an entry for SMBus block-read command handling. | |
| #define | SMBUS_CMD_BLOCK_WR_ENTRY(_cmd, _pec, _rcv) |
| Build an entry for SMBus block-write command handling. | |
| #define | SMBUS_CMD_READ_BYTE_ENTRY(_cmd, _pec, _send) |
| Build an entry for SMBus read-byte command handling. | |
| #define | SMBUS_CMD_WRITE_BYTE_ENTRY(_cmd, _pec, _rcv) |
| Build an entry for SMBus write-byte command handling. | |
| #define | SMBUS_CMD_READ_WORD_ENTRY(_cmd, _pec, _send) |
| Build an entry for SMBus read-word command handling. | |
| #define | SMBUS_CMD_WRITE_WORD_ENTRY(_cmd, _pec, _rcv) |
| Build an entry for SMBus write-word command handling. | |
| #define | SMBUS_CMD_BLOCK_WR_BLOCK_RD_ENTRY(_cmd, _pec, _rcv, _send) |
| Build an entry for SMBus block-write-block-read command handling. | |
Typedefs | |
| typedef int32_t(* | smbus_rcv_handler) (const uint8_t *data, uint8_t size) |
| Definition of a SMBUS receive handler. | |
| typedef int32_t(* | smbus_send_handler) (uint8_t *data, uint8_t *size) |
| Definition of a SMBUS send handler. | |
Enumerations | |
| enum | smbus_trans_type { SMBUS_TRANS_WRITE_BYTE , SMBUS_TRANS_READ_BYTE , SMBUS_TRANS_WRITE_WORD , SMBUS_TRANS_READ_WORD , SMBUS_TRANS_WRITE_BLOCK , SMBUS_TRANS_READ_BLOCK , SMBUS_TRANS_READ_WRITE_BLOCK } |
| A list of supported SMBUS transaction types. More... | |
Functions | |
| int32_t | smbus_target_register_cmd (const struct device *dev, uint8_t cmd_id, const struct smbus_cmd_def *smbus_cmd) |
| Register the given command to the SMBUS target implementation. | |
| int32_t | smbus_target_register_cmds (const struct device *dev, const struct smbus_cmd_registration *cmds, size_t num_cmds) |
| Register a table of commands to the SMBUS target implementation. | |
| uint32_t | smbus_target_get_error_count (const struct device *dev) |
| Get total number of SMBUS target errors. | |
| #define SMBUS_CMD_BLOCK_RD_ENTRY | ( | _cmd, | |
| _pec, | |||
| _send ) |
Build an entry for SMBus block-read command handling.
| #define SMBUS_CMD_BLOCK_WR_BLOCK_RD_ENTRY | ( | _cmd, | |
| _pec, | |||
| _rcv, | |||
| _send ) |
Build an entry for SMBus block-write-block-read command handling.
| #define SMBUS_CMD_BLOCK_WR_ENTRY | ( | _cmd, | |
| _pec, | |||
| _rcv ) |
Build an entry for SMBus block-write command handling.
| #define SMBUS_CMD_ENTRY | ( | _cmd, | |
| _pec, | |||
| _trans_type, | |||
| _rcv, | |||
| _send ) |
Build a generic SMBus command registration entry.
| #define SMBUS_CMD_GEN_ENTRY | ( | _cmd, | |
| _pec, | |||
| _dir, | |||
| _kind, | |||
| _func ) |
Build an entry by direction and transaction-kind suffix.
_dir must be READ or WRITE.
_kind must match a suffix from enum smbus_trans_type, e.g. BYTE, WORD, BLOCK.
| #define SMBUS_CMD_HANDLER_FIELDS_READ | ( | _func | ) |
| #define SMBUS_CMD_HANDLER_FIELDS_WRITE | ( | _func | ) |
Build handler-field initializers for WRITE direction.
| #define SMBUS_CMD_READ_BYTE_ENTRY | ( | _cmd, | |
| _pec, | |||
| _send ) |
Build an entry for SMBus read-byte command handling.
| #define SMBUS_CMD_READ_WORD_ENTRY | ( | _cmd, | |
| _pec, | |||
| _send ) |
Build an entry for SMBus read-word command handling.
| #define SMBUS_CMD_WRITE_BYTE_ENTRY | ( | _cmd, | |
| _pec, | |||
| _rcv ) |
Build an entry for SMBus write-byte command handling.
| #define SMBUS_CMD_WRITE_WORD_ENTRY | ( | _cmd, | |
| _pec, | |||
| _rcv ) |
Build an entry for SMBus write-word command handling.
Definition of a SMBUS receive handler.
This function is invoked when the SMBUS target has data from the I2C controller to relay to the application. SMBUS receive handlers shall return 0 on success, and any other value on failure.
Definition of a SMBUS send handler.
This function is invoked when the SMBUS target requests data from the application to send to the I2C controller. SMBUS send handlers shall return 0 on success, and any other value on failure.
| enum smbus_trans_type |
Get total number of SMBUS target errors.
| dev | The SMBUS target device instance. |
| int32_t smbus_target_register_cmd | ( | const struct device * | dev, |
| uint8_t | cmd_id, | ||
| const struct smbus_cmd_def * | smbus_cmd ) |
Register the given command to the SMBUS target implementation.
| dev | The device to register the command for. |
| cmd_id | The command ID to register the handler for. |
| smbus_cmd | Pointer to the smbus command to register. The memory must have persistent storage for the duration of the time the target remains registered to the I2C. |
| int32_t smbus_target_register_cmds | ( | const struct device * | dev, |
| const struct smbus_cmd_registration * | cmds, | ||
| size_t | num_cmds ) |
Register a table of commands to the SMBUS target implementation.
| dev | The device to register commands for. |
| cmds | Pointer to command registration table. |
| num_cmds | Number of entries in cmds. |