Zephyr drivers

From Wiki at Neela Nurseries
Revision as of 22:57, 1 November 2022 by Ted (talk | contribs) (^ Zephyr Kernel Level Device Support)
Jump to: navigation, search

drivers


^ Zephyr Kernel Level Device Support

Interesting code excerpt from `zephy/kernel/device.c`, this following routine is the implementation behind a wrapper like function `device_is_read()`. But this routine, and sensibly so, doesn't say anything about how a given device is initialized. It only looks at two data members of a device instance data structure:

150 
151 bool z_device_is_ready(const struct device *dev)
152 {
153         /*
154          * if an invalid device pointer is passed as argument, this call
155          * reports the `device` as not ready for usage.
156          */
157         if (dev == NULL) {
158                 return false;
159         }
160 
161         return dev->state->initialized && (dev->state->init_res == 0U);
162 }
163