pm: state: make helper macros internal

Some macros were helpers for the state initializers (e.g. to assist
UTIL_LISTIFY). In order to make the API more clear, they have been
prefixed with Z_ to emphasize they are internal and they have also been
removed from documentation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-10-29 16:23:20 +02:00 committed by Carles Cufí
commit f01007c0cb

View file

@ -154,6 +154,32 @@ struct pm_state_info {
uint32_t exit_latency_us;
};
/** @cond INTERNAL_HIDDEN */
/**
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
* extension.
*
* @param child child index in UTIL_LISTIFY extension.
* @param node_id A node identifier with compatible zephyr,power-state
* @return macro function to construct a pm_state_info
*/
#define Z_PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, child)
/**
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
* extension.
*
* @param child child index in UTIL_LISTIFY extension.
* @param node_id A node identifier with compatible zephyr,power-state
* @return macro function to construct a pm_state enum
*/
#define Z_PM_STATE_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
PM_STATE_DT_ITEM_BY_IDX(node_id, child)
/** @endcond */
/**
* @brief Construct a pm_state_info from 'cpu-power-states' property at index 'i'
*
@ -173,6 +199,18 @@ struct pm_state_info {
cpu_power_states, i, exit_latency_us, 0),\
},
/**
* @brief Construct a pm_state enum from 'cpu-power-states' property
* at index 'i'
*
* @param node_id A node identifier with compatible zephyr,power-state
* @param i index into cpu-power-states property
* @return pm_state item from 'cpu-power-states' property at index 'i'
*/
#define PM_STATE_DT_ITEM_BY_IDX(node_id, i) \
DT_ENUM_IDX(DT_PHANDLE_BY_IDX(node_id, \
cpu_power_states, i), power_state_name),
/**
* @brief Length of 'cpu-power-states' property
*
@ -182,17 +220,6 @@ struct pm_state_info {
#define PM_STATE_DT_ITEMS_LEN(node_id) \
DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
/**
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
* extension.
*
* @param child child index in UTIL_LISTIFY extension.
* @param node_id A node identifier with compatible zephyr,power-state
* @return macro function to construct a pm_state_info
*/
#define PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, child)
/**
* @brief Macro function to construct a list of 'pm_state_info' items by
* UTIL_LISTIFY func
@ -239,34 +266,10 @@ struct pm_state_info {
*/
#define PM_STATE_INFO_DT_ITEMS_LIST(node_id) { \
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC,\
Z_PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC,\
node_id) \
}
/**
* @brief Construct a pm_state enum from 'cpu-power-states' property
* at index 'i'
*
* @param node_id A node identifier with compatible zephyr,power-state
* @param i index into cpu-power-states property
* @return pm_state item from 'cpu-power-states' property at index 'i'
*/
#define PM_STATE_DT_ITEM_BY_IDX(node_id, i) \
DT_ENUM_IDX(DT_PHANDLE_BY_IDX(node_id, \
cpu_power_states, i), power_state_name),
/**
* @brief Macro function to construct enum pm_state item in UTIL_LISTIFY
* extension.
*
* @param child child index in UTIL_LISTIFY extension.
* @param node_id A node identifier with compatible zephyr,power-state
* @return macro function to construct a pm_state enum
*/
#define PM_STATE_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
PM_STATE_DT_ITEM_BY_IDX(node_id, child)
/**
* @brief Macro function to construct a list of enum pm_state items by
* UTIL_LISTIFY func
@ -310,7 +313,7 @@ struct pm_state_info {
*/
#define PM_STATE_DT_ITEMS_LIST(node_id) { \
UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id),\
PM_STATE_DT_ITEMS_LISTIFY_FUNC,\
Z_PM_STATE_DT_ITEMS_LISTIFY_FUNC,\
node_id) \
}