device: introduce device_usable_check
As we add support for devices that are powered down, or are present
but have not yet been started, we need more precise information about
why a device isn't ready, so callers can take appropriate steps to
make it ready.
Add a new function that determines readiness and indicates the reason
for not being ready in a defined unique error code per condition.
Expose this in both a syscall form to be invoked from applications,
and a unchecked form that can be used from supervisor contexts
including syscall implementation functions.
Anticipated future conditions include:
* device is powered down and needs to be brought back up;
* device was installed disabled and has not been started.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
1 file changed