stats: i2c: I2C stats

Adds the ability for I2C drivers to report synchronous transfer stats
using a I2C specific macro to define the device instance.

The macro creates a container for device_state which allows for per
instance device class common data structure to be used in the device
class api (ex: i2c.h). This is used to maintain per driver instance
stats for all i2c drivers. This is a reusable idea across other device
classes as desired.

Using Kconfig device class stats may be turned on/off individually
this way as well, in this case I2C_STATS.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This commit is contained in:
Tom Burdick 2021-10-27 15:07:10 -05:00 committed by Anas Nashif
commit 7b1349cfe6
37 changed files with 253 additions and 66 deletions

View file

@ -158,7 +158,7 @@ const struct i2c_driver_api tca9546a_api_funcs = {
static struct tca9546a_root_data tca9546a_data_##inst = { \
.lock = Z_MUTEX_INITIALIZER(tca9546a_data_##inst.lock), \
}; \
DEVICE_DT_INST_DEFINE(inst, \
I2C_DEVICE_DT_INST_DEFINE(inst, \
tca9546_root_init, NULL, \
&tca9546a_data_##inst, &tca9546a_cfg_##inst, \
POST_KERNEL, CONFIG_I2C_TCA9546_ROOT_INIT_PRIO, \