device: Add DT_INST versions of DEVICE_DT_DECLARE and DEVICE_DT_DEFINE
Add convenience macros versions of DEVICE_DT_DECLARE and DEVICE_DT_DEFINE that take a DT_INST number instead. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
dbac76f45f
commit
3a83f0ec69
1 changed files with 31 additions and 0 deletions
|
@ -172,6 +172,19 @@ extern "C" {
|
||||||
pm_control_fn, \
|
pm_control_fn, \
|
||||||
data_ptr, cfg_ptr, level, prio, api_ptr)
|
data_ptr, cfg_ptr, level, prio, api_ptr)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def DEVICE_DT_INST_DEFINE
|
||||||
|
*
|
||||||
|
* @brief Like DEVICE_DT_DEFINE for an instance of a DT_DRV_COMPAT compatible
|
||||||
|
*
|
||||||
|
* @param inst instance number. This is replaced by
|
||||||
|
* <tt>DT_DRV_COMPAT(inst)</tt> in the call to DEVICE_DT_DEFINE.
|
||||||
|
*
|
||||||
|
* @param ... other parameters as expected by DEVICE_DT_DEFINE.
|
||||||
|
*/
|
||||||
|
#define DEVICE_DT_INST_DEFINE(inst, ...) \
|
||||||
|
DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def DEVICE_DT_NAME_GET
|
* @def DEVICE_DT_NAME_GET
|
||||||
*
|
*
|
||||||
|
@ -209,6 +222,15 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
|
#define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
|
||||||
|
|
||||||
|
/** @def DEVICE_DT_INST_GET
|
||||||
|
*
|
||||||
|
* @brief Obtain a pointer to a device object for an instance of a
|
||||||
|
* DT_DRV_COMPAT compatible
|
||||||
|
*
|
||||||
|
* @param inst instance number
|
||||||
|
*/
|
||||||
|
#define DEVICE_DT_INST_GET(inst) DEVICE_DT_GET(DT_DRV_INST(inst))
|
||||||
|
|
||||||
/** @def DEVICE_DT_DECLARE
|
/** @def DEVICE_DT_DECLARE
|
||||||
*
|
*
|
||||||
* @brief Declare a device object associated with @p node_id
|
* @brief Declare a device object associated with @p node_id
|
||||||
|
@ -236,6 +258,15 @@ extern "C" {
|
||||||
#define DEVICE_DT_DECLARE(node_id) \
|
#define DEVICE_DT_DECLARE(node_id) \
|
||||||
extern const struct device DEVICE_DT_NAME_GET(node_id)
|
extern const struct device DEVICE_DT_NAME_GET(node_id)
|
||||||
|
|
||||||
|
/** @def DEVICE_DT_INST_DECLARE
|
||||||
|
*
|
||||||
|
* @brief Declare a device object associated for an instance of a
|
||||||
|
* DT_DRV_COMPAT compatible
|
||||||
|
*
|
||||||
|
* @param inst instance number
|
||||||
|
*/
|
||||||
|
#define DEVICE_DT_INST_DECLARE(inst) DEVICE_DT_DECLARE(DT_DRV_INST(inst))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def DEVICE_GET
|
* @def DEVICE_GET
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue