/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2021-2022. All rights reserved. * Description: osal list * Author: Hisilicon * Create: 2021-12-16 */ #ifndef __SOC_OSEXT_H__ #define __SOC_OSEXT_H__ #include "td_type.h" #include "soc_osal.h" #include "osal_list.h" #include "osal_errno.h" #ifdef __KERNEL__ #include #endif #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /** * @ingroup drval_dts * @brief Find the node that matches compatible. * * @par Description: * Find the node that matches compatible. * * @param compatible [in] The compatible to be matched. * * @return Return the node that matches compatible. * * @par Support System: * linux liteos. */ void *drval_dts_get_start_node(const char *compatible); /** * @ingroup drval_dts * @brief Find and read an array of 32 bit integers. * * @par Description: * Find and read an array of 32 bit integers. * * @param compatible [in] Device node from which the property value is to be read. * @param name [in] Name of the property to be searched. * @param out_values [out] Pointer to return value, modified only if return value is not OSAL_FAILURE. * @param num [in] Number of array elements to read. * @param start_node [in] Device node to start searching, NULL is start means starting from the beginning. * * @attention * The out_values is modified only if a valid u32 value can be decoded. * * @return Return the real len of array in success, otherwise return OSAL_FAILURE. * * @par Support System: * linux liteos. */ int drval_dts_get_array_byname(const char *compatible, const char *name, unsigned int *out_values, unsigned int num, void *start_node); /** * @ingroup drval_dts * @brief Find from a property. * * @par Description: * Search for a property in a device node. * * @param compatible [in] Device node from which the property value is to be read. * @param name [in] Name of the property to be searched * @param start_node [in] Device node to start searching, NULL is start means starting from the beginning. * * @return Returns true if the property exists, otherwise return false. * * @par Support System: * linux. */ int drval_dts_get_bool_byname(const char *compatible, const char *name, void *start_node); /** * @ingroup drval_dts * @brief Find and read a string from a property. * * @par Description: * Find and read a string from a property. * * @param compatible [in] Device node from which the property value is to be read. * @param name [in] Name of the property to be searched. * @param out_string [out] Pointer to return value, modified only if return value is OSAL_SUCCESS. * @param start_node [in] Device node to start searching, NULL is start means starting from the beginning. * * @attention * The out_string pointer is modified only if a valid string can be decoded. * * @return OSAL_SUCCESS/OSAL_FAILURE. * * @par Support System: * linux liteos. */ int drval_dts_get_string_byname(const char *compatible, const char *name, const char **out_string, void *start_node); /** * @ingroup drval_dts * @brief Find and read an u32 from a property. * * @par Description: * Find and read an u32 from a property. * * @param compatible [in] Device node from which the property value is to be read. * @param name [in] Name of the property to be searched. * @param out_values [out] Pointer to return value, modified only if return value is OSAL_SUCCESS. * @param start_node [in] Device node to start searching, NULL is start means starting from the beginning. * * @attention * The out_values is modified only if a valid u32 value can be decoded. * * @return OSAL_SUCCESS/OSAL_FAILURE. * * @par Support System: * linux liteos. */ int drval_dts_get_u32_byname(const char *compatible, const char *name, unsigned int *out_value, void *start_node); /** * @ingroup drval_dts * @brief Find and read a string from a multiple strings property. * * @par Description: * Find and read a string from a multiple strings property. * * @param compatible [in] Device node from which the property value is to be read. * @param name [in] Name of the property to be searched. * @param index [in] Index of the string in the list of strings. * @param out_string [out] pointer to null terminated return string, modified only if return value is OSAL_SUCCESS. * @param start_node [in] Device node to start searching, NULL is start means starting from the beginning. * * @attention * The out_string pointer is modified only if a valid string can be decoded. * * @return OSAL_SUCCESS/OSAL_FAILURE. * * @par Support System: * linux. */ int drval_dts_get_string_index_byname(const char *compatible, const char *name, int index, const char **out_string, void *start_node); #ifdef __cplusplus #if __cplusplus } #endif #endif #endif /* __SOC_OSEXT_H__ */