Commit graph

16 commits

Author SHA1 Message Date
Andrew Boie e33fc71d71 doc: add device MMIO details
Add some overview documentation on how to use this header.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Peter Bigot 72ebf70543 device: refactor to simplify maintenance
DEVICE_AND_API_INIT and DEVICE_DEFINE are identical except that
DEVICE_DEFINE adds a parameter providing the device pm control
function, while DEVICE_AND_API_INIT does not.  This requires duplicate
implementations where if CONFIG_DEVICE_POWER_MANAGEMENT is enabled
then DEVICE_AND_API_INIT delegates to DEVICE_DEFINE with a dummy pm
control function, and if it is not enabled then DEVICE_DEFINE discards
the parameter and delegates to DEVICE_AND_API_INIT.

DEVICE_INIT is like DEVICE_AND_API_INIT but doesn't provide an API.

Clean this up by refactoring so that DEVICE_DEFINE is the core
implementation, providing with and without device power management
right next to each other where they can be compared and maintained.
Redefine DEVICE_INIT and DEVICE_AND_API_INIT delegate to
DEVICE_DEFINE.

Also remove duplicate code by extracting the variations due to
enabling device power management into macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-22 13:37:07 +02:00
Peter Bigot ccc53f9872 docs: drivers: remove suggestion to assign driver_api in init function
The driver API should be assigned at the time the device is defined.
Assigning in the init function is redundant and prevents moving the
pointer to a immutable driver structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-16 10:46:39 -05:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Peter Bigot 81d84bc87c doc: drivers: update to match code
The device structure definition in the code has drifted from the
displayed version in the documentation.  Update the documentation to
match.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-20 10:34:48 +02:00
Peter Bigot 45e2dd6366 doc: reference: drivers: provide more help on implementing extensions
Extend the provided template with annotated examples of API based on
whether the functions must be invokable from user mode threads, since
there are currently no in-tree examples of the specific techniques
required.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-20 10:34:17 +02:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Andrew Boie 6627249dc1 doc: simplify docs on driver-specific APIs.
This documentation is well-intentioned but not good advice.

The reason why we have a vtable-like API abstraction at the
driver subsystem level is to introduce object orientation.
The subsystem defintions implement an abstract class that
specific driver implementations all implement, providing
a common interface for end users. Multiple drivers may be
written for a subsystem that are interchangeable to the end
user.

However, there is no point in introducing a vtable-like
abstraction for APIs which are specific to a single driver.
We are not trying to present an interface abstraction which
could support multiple implementations. There is just one.

Simply declare a function in a header, and implement it in
the driver's C file.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-04-26 20:29:01 -04:00
Carles Cufi bf41dd943b doc: reference: Clean up and restructure a bit
Name all subsystem reference consistently with an '_api' postfix and
clean up naming and folder structure in some cases.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-18 11:47:24 +01:00
Peter Bigot 74ef395332 kernel: move test of kernel startup state to more visible location
The original implementation left this function hidden in init.h which
prevented it from showing up in documentation.  Move it to kernel.h,
and document it consistent with the other functions that allow caller
customization based on context.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-06 13:55:31 -05:00
David Leach afdc63f320 subsys/random: Add cryptographically secure and bulk fill functions
1) Add cryptographically secure random functions to provide
FIPS 140-2 compliant random functions.

2) Add name to random function choice selectors to ease
selection in SOC .defconfig files

3) Add bulk fill random functions.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-05 19:36:42 +01:00
Marti Bolivar 2275aae291 doc: add a couple of ref targets
These will be needed later.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-10-08 11:53:40 +02:00
Daniel Leung a358248ae0 doc: drivers: add diagram and clarify a note
Add a simple diagram on the device driver model.

Instead of saying "this device driver", spell out that the note
is for the random number generator driver, as the visual
presentation does not have clear distinction.

Also update some formatting.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-08-29 17:33:56 -04:00
Peter A. Bigot 24b67ef119 doc/reference/drivers: document device-specific API extensions
This PR updates the documentation to cover a technical solution to
providing a driver instance that extends the functionality of a
subsystem API.  The solution described was mooted in Zephyr PR #17072
and approved by the Technical Steering Committee during its 2019-08-07
meeting.

Relates-to: #11993
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-18 19:34:57 +02:00
Peter Bigot d0c2c4d329 doc/drivers: correct number of initialization levels
When init level hierarchy was reworked the documentation was switched to
describe the new levels, but the count of relevant levels was not
changed.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-18 13:26:23 +02:00
Anas Nashif d6f72a67fc doc: introduce final structure
Move guides and APIs into separate directories and cleanup naming
introducing index files rather than named section files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 07:04:40 -05:00