blob: ac2db806a542cc5561947b4215a964608c96a871 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001/**
2 * @file flags_api.h
xf.lice873192023-11-08 17:10:35 -08003 * @brief flags·ÖÇø½Ó¿Ú
xf.li6c8fc1e2023-08-12 00:11:09 -07004 *
5 * Copyright (C) 2023 Sanechips Technology Co., Ltd.
6 * @author
7 * @ingroup
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
xf.lice873192023-11-08 17:10:35 -080011 * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©
xf.li6c8fc1e2023-08-12 00:11:09 -070012 *
13 */
14
15
16#ifndef FLAGS_API_H
17#define FLAGS_API_H
18
19
20/*******************************************************************************
21 * Include header files *
22 ******************************************************************************/
23#include "pub_flags.h"
24
25
26/*******************************************************************************
27 * Macro definitions *
28 ******************************************************************************/
29
30
31/*******************************************************************************
32 * Type definitions *
33 ******************************************************************************/
34
35
36/*******************************************************************************
37 * Global variable declarations *
38 ******************************************************************************/
39
40
41/*******************************************************************************
42 * Global function declarations *
43 ******************************************************************************/
44/**
xf.lice873192023-11-08 17:10:35 -080045 * @brief ³õʼ»¯flags·ÖÇø
46 * @param[out] p_flags_info flags³õʼ»¯Êý¾Ý
47 * @return 0 ³õʼ»¯³É¹¦, -1 ³õʼ»¯Ê§°Ü
xf.li6c8fc1e2023-08-12 00:11:09 -070048 * @note
49 */
50int flags_init();
51
52
53/**
xf.lice873192023-11-08 17:10:35 -080054 * @brief »ñÈ¡flags·ÖÇøÄÚÈÝ
55 * @param[out] p_flags_info flags·ÖÇøÄÚÈÝ
56 * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
xf.li6c8fc1e2023-08-12 00:11:09 -070057 * @note
58 */
59int flags_get(T_FLAGS_INFO *p_flags_info);
60
61
62/**
xf.lice873192023-11-08 17:10:35 -080063 * @brief ÉèÖÃflags·ÖÇøÄÚÈÝ
64 * @param[in] p_flags_info flags·ÖÇøÄÚÈÝ
65 * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
xf.li6c8fc1e2023-08-12 00:11:09 -070066 * @note
67 */
68int flags_set(T_FLAGS_INFO *p_flags_info);
69
70
71/**
xf.lice873192023-11-08 17:10:35 -080072 * @brief »ñÈ¡flags·ÖÇøÖÐubifs״̬
73 * @param[out] status ubifs״̬
74 * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
xf.li6c8fc1e2023-08-12 00:11:09 -070075 * @note
76 */
77int flags_get_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
78
79
80/**
xf.lice873192023-11-08 17:10:35 -080081 * @brief ÉèÖÃflags·ÖÇøÖÐubifs״̬
82 * @param[in] status ubifs״̬
83 * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
xf.li6c8fc1e2023-08-12 00:11:09 -070084 * @note
85 */
86int flags_set_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
87
88
89/**
xf.lice873192023-11-08 17:10:35 -080090 * @brief »ñÈ¡µ±Ç°ÏµÍ³
91 * @return µ±Ç°ÔËÐÐϵͳ
xf.li6c8fc1e2023-08-12 00:11:09 -070092 * @note
93 */
94int flags_get_current_system();
95
xf.liaa4d92f2023-09-13 00:18:58 -070096/**
xf.lice873192023-11-08 17:10:35 -080097 * @brief »ñÈ¡flags·ÖÇøÖÐnvro_flag״̬
xf.liaa4d92f2023-09-13 00:18:58 -070098 * @param[out]
99 * @return nvro_flag
100 * @note
101 */
102unsigned int flags_get_nvroflag(void);
103
104/**
xf.lice873192023-11-08 17:10:35 -0800105 * @brief ÉèÖÃflags·ÖÇøÖÐnvro_flag
106 * @param[in] flag nvro״̬
107 * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
xf.liaa4d92f2023-09-13 00:18:58 -0700108 * @note
109 */
110int flags_set_nvroflag(unsigned int flag);
111
xf.li6c8fc1e2023-08-12 00:11:09 -0700112
xf.lice873192023-11-08 17:10:35 -0800113/**
114 * @brief »ñÈ¡flags·ÖÇøÄÚÈÝ(ÎÞCRC)
115 * @param[out] p_flags_info flags·ÖÇøÄÚÈÝ
116 * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
117 * @note ´ËAPI½öÓÃÓÚµ÷²â£¬Õýʽ´úÂë²»¿ÉʹÓÃ
118
119 */
120int flags_get_nocrc(T_FLAGS_INFO *p_flags_info);
121
122
123/**
124 * @brief ÉèÖÃflags·ÖÇøÄÚÈÝ(ÎÞCRC)
125 * @param[in] p_flags_info flags·ÖÇøÄÚÈÝ
126 * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
127 * @note ´ËAPI½öÓÃÓÚµ÷²â£¬Õýʽ´úÂë²»¿ÉʹÓÃ
128 */
129int flags_set_nocrc(T_FLAGS_INFO *p_flags_info);
130
131
132/**
133 * @brief ³õʼ»¯CRC32Âë±í(С¶Ë)
134 * @param ÎÞ
135 * @return ÎÞ
136 * @note
137 */
138void crc32init_le(void);
139
140
141/**
142 * @brief ¼ÆËãCRC32УÑéÂë(С¶Ë)
143 * @param[in] crc ³õʼֵ
144 * @param[in] p ÐèÒª¼ÆËãCRC32УÑéÂëµÄÊý¾ÝbufferÖ¸Õë
145 * @param[in] len buffer @pµÄ´óС
146 * @return ¼ÆËãËùµÃµÄCRC32УÑéÂë
147 * @note
148 */
149unsigned int crc32_le(unsigned int crc, unsigned char const *p, size_t len);
150
151
xf.li6c8fc1e2023-08-12 00:11:09 -0700152#endif // FLAGS_API_H
153