i2c: optimize space allocated for read or write buffers

Only a single command will be allocated now when a read or write is
prepared in the command list. The size of a command's buffer is not
limited to 255 bytes anymore.
This commit is contained in:
Omar Chebib
2021-05-11 11:14:43 +08:00
parent e1f388f114
commit cfcbca1271
7 changed files with 68 additions and 71 deletions

View File

@@ -46,9 +46,6 @@ extern "C" {
* - write device register
* - read register content
*
* Moreover, any command that includes strictly more than 255 bytes shall be divided into multiple commands.
* For example, a write of 256 bytes shall be considered as 2 commands, a write of 1024 bytes shall be considered
* as 5 commands. (1024/255 rounded up)
* Signals such as "(repeated) start", "stop", "nack", "ack" shall not be counted.
*/
#define I2C_LINK_RECOMMENDED_SIZE(COMMANDS) (sizeof(i2c_cmd_desc_t) * \