Zephyr device driver paradigm

From Wiki at Neela Nurseries
Revision as of 22:45, 1 September 2021 by Ted (talk | contribs)
Jump to: navigation, search

Notes and links to Zephyr device driver paradigm.


sensor_sample_fetch_channel instances

In Zephyr 2.6.0, Zephyr RTOS device driver API function sensor_sample_fetch_chan() entails several key elements of Zephyr's device driver architecture. This function also has no "direct" expression in this RTOS' source code tree. Rather this API function is generated at Zephyr app build time (need link to overview of Zephyr build tools and process). A search for this function in a Zephyr application gives:

ted@localhost:~/projects/zephyr-based/z3-aqw-demo/air-quality-wing-zephyr-demo$ ls
basic  ble  bootloader  golioth  img  Makefile  modules  README.md  tools  west.yml  zephyr
ted@localhost:~/projects/zephyr-based/z3-aqw-demo/air-quality-wing-zephyr-demo$ grep -nr sensor_sample_fetch_chan ./*
./zephyr/drivers/sensor/sensor_handlers.c:41:static inline int z_vrfy_sensor_sample_fetch_chan(const struct device *dev,
./zephyr/drivers/sensor/sensor_handlers.c:45:	return z_impl_sensor_sample_fetch_chan((const struct device *)dev,
./zephyr/drivers/sensor/sensor_handlers.c:48:#include <syscalls/sensor_sample_fetch_chan_mrsh.c>
./zephyr/include/drivers/sensor.h:535:__syscall int sensor_sample_fetch_chan(const struct device *dev,
./zephyr/include/drivers/sensor.h:538:static inline int z_impl_sensor_sample_fetch_chan(const struct device *dev,
./zephyr/include/drivers/sensor.h:553: * @ref sensor_sample_fetch_chan. It is guaranteed that two subsequent
./zephyr/include/drivers/sensor.h:555: * value, if @ref sensor_sample_fetch or @ref sensor_sample_fetch_chan
./zephyr/tests/drivers/sensor/generic/src/main.c:115:	zassert_equal(sensor_sample_fetch_chan(dev, chan_elements[0].chan),
./zephyr/tests/drivers/sensor/sbs_gauge/src/test_sbs_gauge.c:25:	zassert_true(sensor_sample_fetch_chan(dev, channel) < 0, "Sample fetch failed");
./zephyr/tests/drivers/sensor/sbs_gauge/src/test_sbs_gauge.c:33:	zassert_true(sensor_sample_fetch_chan(dev, channel) == -ENOTSUP, "Invalid function");
./zephyr/samples/shields/x_nucleo_iks01a2/sensorhub/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL);
./zephyr/samples/shields/x_nucleo_iks01a2/standard/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL);
./zephyr/samples/shields/x_nucleo_iks01a3/sensorhub/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/sensorhub/src/main.c:32:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/sensorhub/src/main.c:39:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/sensorhub/src/main.c:46:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_DIE_TEMP);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:30:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_PRESS);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:51:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:64:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:71:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/shields/x_nucleo_iks01a3/standard/src/main.c:78:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_DIE_TEMP);
./zephyr/samples/shields/x_nucleo_iks01a1/src/main.c:19:	sensor_sample_fetch_chan(dev, trig->chan);
./zephyr/samples/shields/x_nucleo_iks02a1/sensorhub/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks02a1/sensorhub/src/main.c:32:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks02a1/sensorhub/src/main.c:39:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/shields/x_nucleo_iks02a1/sensorhub/src/main.c:46:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_DIE_TEMP);
./zephyr/samples/shields/x_nucleo_iks02a1/standard/src/main.c:19:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks02a1/standard/src/main.c:30:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL);
./zephyr/samples/shields/x_nucleo_iks02a1/standard/src/main.c:42:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/shields/x_nucleo_iks02a1/standard/src/main.c:49:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:48:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:60:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:73:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_MAGN_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:87:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_PRESS);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:90:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_AMBIENT_TEMP);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:311:		sensor_sample_fetch_chan(accel_dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:321:		sensor_sample_fetch_chan(accel_dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:331:		sensor_sample_fetch_chan(accel_dev, SENSOR_CHAN_MAGN_XYZ);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:342:		sensor_sample_fetch_chan(accel_dev, SENSOR_CHAN_PRESS);
./zephyr/samples/boards/96b_argonkey/sensors/src/main.c:345:		sensor_sample_fetch_chan(accel_dev, SENSOR_CHAN_AMBIENT_TEMP);
./zephyr/samples/boards/sensortile_box/src/main.c:29:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_PRESS);
./zephyr/samples/boards/sensortile_box/src/main.c:40:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/boards/sensortile_box/src/main.c:53:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/boards/sensortile_box/src/main.c:60:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/boards/sensortile_box/src/main.c:67:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_DIE_TEMP);
./zephyr/samples/boards/sensortile_box/src/main.c:88:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/sensor/lsm6dso/src/main.c:34:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/sensor/lsm6dso/src/main.c:43:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/sensor/max6675/src/main.c:34:		ret = sensor_sample_fetch_chan(dev, SENSOR_CHAN_AMBIENT_TEMP);
./zephyr/samples/sensor/lsm6dsl/src/main.c:44:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
./zephyr/samples/sensor/lsm6dsl/src/main.c:50:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
./zephyr/samples/sensor/lsm6dsl/src/main.c:57:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_MAGN_XYZ);
./zephyr/samples/sensor/lsm6dsl/src/main.c:65:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_PRESS);
./zephyr/samples/sensor/lsm6dsl/src/main.c:68:	sensor_sample_fetch_chan(dev, SENSOR_CHAN_AMBIENT_TEMP);
./zephyr/samples/sensor/max44009/src/main.c:33:		if (sensor_sample_fetch_chan(dev, SENSOR_CHAN_LIGHT) != 0) {
./zephyr/samples/sensor/bq274xx/src/main.c:35:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:51:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:67:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:84:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:102:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:119:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:136:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:152:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:170:		status = sensor_sample_fetch_chan(dev,
./zephyr/samples/sensor/bq274xx/src/main.c:189:		status = sensor_sample_fetch_chan(dev, SENSOR_CHAN_GAUGE_TEMP);
ted@localhost:~/projects/zephyr-based/z3-aqw-demo/air-quality-wing-zephyr-demo$