blob: ac2db806a542cc5561947b4215a964608c96a871 [file] [log] [blame]
/**
* @file flags_api.h
* @brief flags·ÖÇø½Ó¿Ú
*
* Copyright (C) 2023 Sanechips Technology Co., Ltd.
* @author
* @ingroup
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©
*
*/
#ifndef FLAGS_API_H
#define FLAGS_API_H
/*******************************************************************************
* Include header files *
******************************************************************************/
#include "pub_flags.h"
/*******************************************************************************
* Macro definitions *
******************************************************************************/
/*******************************************************************************
* Type definitions *
******************************************************************************/
/*******************************************************************************
* Global variable declarations *
******************************************************************************/
/*******************************************************************************
* Global function declarations *
******************************************************************************/
/**
* @brief ³õʼ»¯flags·ÖÇø
* @param[out] p_flags_info flags³õʼ»¯Êý¾Ý
* @return 0 ³õʼ»¯³É¹¦, -1 ³õʼ»¯Ê§°Ü
* @note
*/
int flags_init();
/**
* @brief »ñÈ¡flags·ÖÇøÄÚÈÝ
* @param[out] p_flags_info flags·ÖÇøÄÚÈÝ
* @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
* @note
*/
int flags_get(T_FLAGS_INFO *p_flags_info);
/**
* @brief ÉèÖÃflags·ÖÇøÄÚÈÝ
* @param[in] p_flags_info flags·ÖÇøÄÚÈÝ
* @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
* @note
*/
int flags_set(T_FLAGS_INFO *p_flags_info);
/**
* @brief »ñÈ¡flags·ÖÇøÖÐubifs״̬
* @param[out] status ubifs״̬
* @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
* @note
*/
int flags_get_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
/**
* @brief ÉèÖÃflags·ÖÇøÖÐubifs״̬
* @param[in] status ubifs״̬
* @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
* @note
*/
int flags_set_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
/**
* @brief »ñÈ¡µ±Ç°ÏµÍ³
* @return µ±Ç°ÔËÐÐϵͳ
* @note
*/
int flags_get_current_system();
/**
* @brief »ñÈ¡flags·ÖÇøÖÐnvro_flag״̬
* @param[out]
* @return nvro_flag
* @note
*/
unsigned int flags_get_nvroflag(void);
/**
* @brief ÉèÖÃflags·ÖÇøÖÐnvro_flag
* @param[in] flag nvro״̬
* @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
* @note
*/
int flags_set_nvroflag(unsigned int flag);
/**
* @brief »ñÈ¡flags·ÖÇøÄÚÈÝ(ÎÞCRC)
* @param[out] p_flags_info flags·ÖÇøÄÚÈÝ
* @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
* @note ´ËAPI½öÓÃÓÚµ÷²â£¬Õýʽ´úÂë²»¿ÉʹÓÃ
*/
int flags_get_nocrc(T_FLAGS_INFO *p_flags_info);
/**
* @brief ÉèÖÃflags·ÖÇøÄÚÈÝ(ÎÞCRC)
* @param[in] p_flags_info flags·ÖÇøÄÚÈÝ
* @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
* @note ´ËAPI½öÓÃÓÚµ÷²â£¬Õýʽ´úÂë²»¿ÉʹÓÃ
*/
int flags_set_nocrc(T_FLAGS_INFO *p_flags_info);
/**
* @brief ³õʼ»¯CRC32Âë±í(С¶Ë)
* @param ÎÞ
* @return ÎÞ
* @note
*/
void crc32init_le(void);
/**
* @brief ¼ÆËãCRC32УÑéÂë(С¶Ë)
* @param[in] crc ³õʼֵ
* @param[in] p ÐèÒª¼ÆËãCRC32УÑéÂëµÄÊý¾ÝbufferÖ¸Õë
* @param[in] len buffer @pµÄ´óС
* @return ¼ÆËãËùµÃµÄCRC32УÑéÂë
* @note
*/
unsigned int crc32_le(unsigned int crc, unsigned char const *p, size_t len);
#endif // FLAGS_API_H