lib: os: onoff: add API for on-off service request and release management

There are various situations where it's necessary to support turning
devices on or off at runtime, includin power rails, clocks, other
peripherals, and binary device power management.  The complexity of
properly managing multiple consumers of a device in a multithreaded
system suggests that a shared implementation is desirable.  This
commit provides an API that supports managing on-off resources.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-11-30 08:12:09 -06:00 committed by Carles Cufí
commit 1964bf08bb
11 changed files with 2384 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(onoff)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

0
tests/lib/onoff/README Normal file
View file

2
tests/lib/onoff/prj.conf Normal file
View file

@ -0,0 +1,2 @@
CONFIG_POLL=y
CONFIG_ZTEST=y

1164
tests/lib/onoff/src/main.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
tests:
libraries.onoff:
tags: onoff timer