xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @file flags_api.h |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 3 | * @brief flags·ÖÇø½Ó¿Ú |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 4 | * |
| 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.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 11 | * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£© |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 12 | * |
| 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.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 45 | * @brief ³õʼ»¯flags·ÖÇø |
| 46 | * @param[out] p_flags_info flags³õʼ»¯Êý¾Ý |
| 47 | * @return 0 ³õʼ»¯³É¹¦, -1 ³õʼ»¯Ê§°Ü |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 48 | * @note |
| 49 | */ |
| 50 | int flags_init(); |
| 51 | |
| 52 | |
| 53 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 54 | * @brief »ñÈ¡flags·ÖÇøÄÚÈÝ |
| 55 | * @param[out] p_flags_info flags·ÖÇøÄÚÈÝ |
| 56 | * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 57 | * @note |
| 58 | */ |
| 59 | int flags_get(T_FLAGS_INFO *p_flags_info); |
| 60 | |
| 61 | |
| 62 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 63 | * @brief ÉèÖÃflags·ÖÇøÄÚÈÝ |
| 64 | * @param[in] p_flags_info flags·ÖÇøÄÚÈÝ |
| 65 | * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 66 | * @note |
| 67 | */ |
| 68 | int flags_set(T_FLAGS_INFO *p_flags_info); |
| 69 | |
| 70 | |
| 71 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 72 | * @brief »ñÈ¡flags·ÖÇøÖÐubifs״̬ |
| 73 | * @param[out] status ubifs״̬ |
| 74 | * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 75 | * @note |
| 76 | */ |
| 77 | int flags_get_ubifs_status(T_UBIFS_STATUS *p_ubifs_status); |
| 78 | |
| 79 | |
| 80 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 81 | * @brief ÉèÖÃflags·ÖÇøÖÐubifs״̬ |
| 82 | * @param[in] status ubifs״̬ |
| 83 | * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 84 | * @note |
| 85 | */ |
| 86 | int flags_set_ubifs_status(T_UBIFS_STATUS *p_ubifs_status); |
| 87 | |
| 88 | |
| 89 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 90 | * @brief »ñÈ¡µ±Ç°ÏµÍ³ |
| 91 | * @return µ±Ç°ÔËÐÐϵͳ |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 92 | * @note |
| 93 | */ |
| 94 | int flags_get_current_system(); |
| 95 | |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 96 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 97 | * @brief »ñÈ¡flags·ÖÇøÖÐnvro_flag״̬ |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 98 | * @param[out] |
| 99 | * @return nvro_flag |
| 100 | * @note |
| 101 | */ |
| 102 | unsigned int flags_get_nvroflag(void); |
| 103 | |
| 104 | /** |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 105 | * @brief ÉèÖÃflags·ÖÇøÖÐnvro_flag |
| 106 | * @param[in] flag nvro״̬ |
| 107 | * @return 0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 108 | * @note |
| 109 | */ |
| 110 | int flags_set_nvroflag(unsigned int flag); |
| 111 | |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 112 | |
xf.li | ce87319 | 2023-11-08 17:10:35 -0800 | [diff] [blame] | 113 | /** |
| 114 | * @brief »ñÈ¡flags·ÖÇøÄÚÈÝ(ÎÞCRC) |
| 115 | * @param[out] p_flags_info flags·ÖÇøÄÚÈÝ |
| 116 | * @return 0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü |
| 117 | * @note ´ËAPI½öÓÃÓÚµ÷²â£¬Õýʽ´úÂë²»¿ÉʹÓà |
| 118 | |
| 119 | */ |
| 120 | int 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 | */ |
| 129 | int flags_set_nocrc(T_FLAGS_INFO *p_flags_info); |
| 130 | |
| 131 | |
| 132 | /** |
| 133 | * @brief ³õʼ»¯CRC32Âë±í(С¶Ë) |
| 134 | * @param ÎÞ |
| 135 | * @return ÎÞ |
| 136 | * @note |
| 137 | */ |
| 138 | void 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 | */ |
| 149 | unsigned int crc32_le(unsigned int crc, unsigned char const *p, size_t len); |
| 150 | |
| 151 | |
xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 152 | #endif // FLAGS_API_H |
| 153 | |