sensing: using the single sensing_connections for the same device
The sensing_connections can be shared between sensing_sensors under the same device. Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
This commit is contained in:
parent
e69ce68d40
commit
da5118001e
|
@ -124,8 +124,8 @@ struct sensing_sensor {
|
||||||
.minimal_interval = DT_PROP(node, minimal_interval),\
|
.minimal_interval = DT_PROP(node, minimal_interval),\
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SENSING_CONNECTIONS_NAME(node, idx) \
|
#define SENSING_CONNECTIONS_NAME(node) \
|
||||||
_CONCAT(_CONCAT(__sensing_connections_, idx), DEVICE_DT_NAME_GET(node))
|
_CONCAT(__sensing_connections_, DEVICE_DT_NAME_GET(node))
|
||||||
|
|
||||||
#define SENSING_SENSOR_SOURCE_NAME(idx, node) \
|
#define SENSING_SENSOR_SOURCE_NAME(idx, node) \
|
||||||
SENSING_SENSOR_NAME(DT_PHANDLE_BY_IDX(node, reporters, idx), \
|
SENSING_SENSOR_NAME(DT_PHANDLE_BY_IDX(node, reporters, idx), \
|
||||||
|
@ -144,11 +144,11 @@ extern struct sensing_sensor SENSING_SENSOR_SOURCE_NAME(idx, node); \
|
||||||
SENSING_CONNECTION_INITIALIZER(SENSING_SENSOR_SOURCE_NAME(idx, node), \
|
SENSING_CONNECTION_INITIALIZER(SENSING_SENSOR_SOURCE_NAME(idx, node), \
|
||||||
cb_list_ptr)
|
cb_list_ptr)
|
||||||
|
|
||||||
#define SENSING_CONNECTIONS_DEFINE(node, idx, num, cb_list_ptr) \
|
#define SENSING_CONNECTIONS_DEFINE(node, num, cb_list_ptr) \
|
||||||
LISTIFY(num, SENSING_SENSOR_SOURCE_EXTERN, \
|
LISTIFY(num, SENSING_SENSOR_SOURCE_EXTERN, \
|
||||||
(), node) \
|
(), node) \
|
||||||
static struct sensing_connection \
|
static struct sensing_connection \
|
||||||
SENSING_CONNECTIONS_NAME(node, idx)[(num)] = { \
|
SENSING_CONNECTIONS_NAME(node)[(num)] = { \
|
||||||
LISTIFY(num, SENSING_CONNECTION_DEFINE, \
|
LISTIFY(num, SENSING_CONNECTION_DEFINE, \
|
||||||
(,), node, cb_list_ptr) \
|
(,), node, cb_list_ptr) \
|
||||||
};
|
};
|
||||||
|
@ -166,8 +166,6 @@ extern struct sensing_sensor SENSING_SENSOR_SOURCE_NAME(idx, node); \
|
||||||
|
|
||||||
#define SENSING_SENSOR_DEFINE(node, prop, idx, reg_ptr, cb_list_ptr) \
|
#define SENSING_SENSOR_DEFINE(node, prop, idx, reg_ptr, cb_list_ptr) \
|
||||||
SENSING_SENSOR_INFO_DEFINE(node, idx) \
|
SENSING_SENSOR_INFO_DEFINE(node, idx) \
|
||||||
SENSING_CONNECTIONS_DEFINE(node, idx, \
|
|
||||||
DT_PROP_LEN_OR(node, reporters, 0), cb_list_ptr)\
|
|
||||||
SENSING_SENSOR_IODEV_DEFINE(node, idx) \
|
SENSING_SENSOR_IODEV_DEFINE(node, idx) \
|
||||||
STRUCT_SECTION_ITERABLE(sensing_sensor, \
|
STRUCT_SECTION_ITERABLE(sensing_sensor, \
|
||||||
SENSING_SENSOR_NAME(node, idx)) = { \
|
SENSING_SENSOR_NAME(node, idx)) = { \
|
||||||
|
@ -175,7 +173,7 @@ extern struct sensing_sensor SENSING_SENSOR_SOURCE_NAME(idx, node); \
|
||||||
.info = &SENSING_SENSOR_INFO_NAME(node, idx), \
|
.info = &SENSING_SENSOR_INFO_NAME(node, idx), \
|
||||||
.register_info = reg_ptr, \
|
.register_info = reg_ptr, \
|
||||||
.reporter_num = DT_PROP_LEN_OR(node, reporters, 0), \
|
.reporter_num = DT_PROP_LEN_OR(node, reporters, 0), \
|
||||||
.conns = SENSING_CONNECTIONS_NAME(node, idx), \
|
.conns = SENSING_CONNECTIONS_NAME(node), \
|
||||||
.iodev = &SENSING_SENSOR_IODEV_NAME(node, idx), \
|
.iodev = &SENSING_SENSOR_IODEV_NAME(node, idx), \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +187,7 @@ extern struct sensing_sensor SENSING_SENSOR_SOURCE_NAME(idx, node); \
|
||||||
* element in the sensing sensor iterable section used to enumerate all sensing
|
* element in the sensing sensor iterable section used to enumerate all sensing
|
||||||
* sensors.
|
* sensors.
|
||||||
*
|
*
|
||||||
* @param node_id The devicetree node identifier.
|
* @param node The devicetree node identifier.
|
||||||
*
|
*
|
||||||
* @param reg_ptr Pointer to the device's sensing_sensor_register_info.
|
* @param reg_ptr Pointer to the device's sensing_sensor_register_info.
|
||||||
*
|
*
|
||||||
|
@ -211,15 +209,17 @@ extern struct sensing_sensor SENSING_SENSOR_SOURCE_NAME(idx, node); \
|
||||||
* @param api_ptr Provides an initial pointer to the API function struct used
|
* @param api_ptr Provides an initial pointer to the API function struct used
|
||||||
* by the driver. Can be NULL.
|
* by the driver. Can be NULL.
|
||||||
*/
|
*/
|
||||||
#define SENSING_SENSORS_DT_DEFINE(node_id, reg_ptr, cb_list_ptr, \
|
#define SENSING_SENSORS_DT_DEFINE(node, reg_ptr, cb_list_ptr, \
|
||||||
init_fn, pm_device, \
|
init_fn, pm_device, \
|
||||||
data_ptr, cfg_ptr, level, prio, \
|
data_ptr, cfg_ptr, level, prio, \
|
||||||
api_ptr, ...) \
|
api_ptr, ...) \
|
||||||
SENSOR_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
|
SENSOR_DEVICE_DT_DEFINE(node, init_fn, pm_device, \
|
||||||
data_ptr, cfg_ptr, level, prio, \
|
data_ptr, cfg_ptr, level, prio, \
|
||||||
api_ptr, __VA_ARGS__); \
|
api_ptr, __VA_ARGS__); \
|
||||||
\
|
SENSING_CONNECTIONS_DEFINE(node, \
|
||||||
SENSING_SENSORS_DEFINE(node_id, reg_ptr, cb_list_ptr);
|
DT_PROP_LEN_OR(node, reporters, 0), \
|
||||||
|
cb_list_ptr); \
|
||||||
|
SENSING_SENSORS_DEFINE(node, reg_ptr, cb_list_ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Like SENSING_SENSORS_DT_DEFINE() for an instance of a DT_DRV_COMPAT
|
* @brief Like SENSING_SENSORS_DT_DEFINE() for an instance of a DT_DRV_COMPAT
|
||||||
|
|
Loading…
Reference in a new issue