Commit graph

4 commits

Author SHA1 Message Date
Martí Bolívar 0ec24ca867 doc: update devicetree/spi.h
This file needs more examples. Add them and make some other fixes and
improvements.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-26 22:32:34 +02:00
Martí Bolívar 3e0d4be271 doc: devicetree: change doxygen groups
Create a top level devicetree group, and put everything underneath it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-13 22:38:13 -04:00
Kumar Gala 1c3ed6dab6 devicetree: Rename spi cs gpio macros
Rename the DT_*_CS_* macro's to DT_*_CS_GPIOS_* to be more clear.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 12:24:23 -05:00
Martí Bolívar c3ec5db6d2 devicetree.h: add accessor API for nodes and properties
This is joint work with Kumar Gala (see signed-off-by).

Add helper macros which abstract the "true names" of each of the four
types of node identifier we intend to support (e.g. DT_ALIAS(),
DT_INST()).

These can be passed to a new DT_PROP() macro which can be used to read
the value of a devicetree property given a node identifier from one of
these four other macros, and the as-a-c-token name of the property.
Add other accessor macros and tests as well.

Add some convenience APIs for writing device drivers based on instance
numbers as well. Drivers can "#define DT_DRV_COMPAT driver_compatible"
at the top of the file, then utilize these DT_INST_* macros to access
various property defines.

For example, the uart_sifive driver can do:

  #define DT_DRV_COMPAT sifive_uart0

Then use DT_INST macros like:

  .port         = DT_INST_REG_ADDR(0),
  .sys_clk_freq = DT_INST_PROP(0, clock_frequency),

For convenience working with specific hardware, also add:

  <devicetree/gpio.h>
  <devicetree/adc.h>
  <devicetree/spi.h>

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00