1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HI_PARSE_H 17 #define HI_PARSE_H 18 19 #include "hi_type.h" 20 #include "hi_gv.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #define LOADALLVIEW (-1) 27 28 /* 29 \brief Parser init. 30 \attention \n 31 N/A. 32 \param N/A 33 \retval ::HI_SUCCESS 34 \retval ::HI_ERR_PARSER_INITED Parser is not inited. 35 \see \n 36 ::HI_GV_PARSER_Deinit 37 */ 38 HI_S32 HI_GV_PARSER_Init(HI_VOID); 39 40 /* 41 \brief Uninit parser. 42 \attention \n 43 N/A. 44 \param N/A 45 \retval N/A 46 \see \n 47 ::HI_GV_PARSER_Init 48 */ 49 HI_VOID HI_GV_PARSER_Deinit(HI_VOID); 50 51 /* 52 \brief Load HIGVBin file and parse the basic information of higvbin. 53 54 \attention \n 55 N/A. 56 \param[in] fileName File name. 57 \retval ::HI_SUCCESS 58 \retval ::HI_ERR_PARSER_NOINIT it is not inited. 59 \retval ::HI_ERR_PARSER_FILELOADED File error. 60 \retval ::HI_ERR_COMM_FILEOP File opreration is error. 61 \retval ::HI_ERR_COMM_NORES No memory. 62 \retval ::HI_ERR_PARSER_VERIFY CRC ERROR. 63 \see \n 64 N/A. 65 */ 66 HI_S32 HI_GV_PARSER_LoadFile(const HI_CHAR *fileName); 67 68 /* 69 \brief Unload higvbin file, release resource. 70 \attention \n 71 N/A. 72 \param N/A. 73 \retval ::HI_SUCCESS 74 \retval ::HI_ERR_PARSER_NOINIT 75 \retval ::HI_ERR_PARSER_FILENOTLOAD 76 \see \n 77 N/A. 78 */ 79 HI_S32 HI_GV_PARSER_UnLoadFile(HI_VOID); 80 81 /* 82 \brief Release the resource when load higvbin file, This api will be called at the end of load. 83 84 \attention \n 85 N/A. 86 \param N/A. 87 \retval ::HI_SUCCESS 88 \retval ::HI_ERR_PARSER_NOINIT 89 \retval ::HI_ERR_PARSER_FILENOTLOAD 90 \see \n 91 N/A. 92 */ 93 HI_S32 HI_GV_PARSER_ReleaseLoadRes(HI_VOID); 94 95 /* 96 \brief Get view number. 97 \attention \n 98 N/A. 99 \param[out] viewNum View number. 100 \retval ::HI_SUCCESS 101 \retval ::HI_ERR_PARSER_NOINIT 102 \retval ::HI_ERR_COMM_EMPTY The pointer is NULL. 103 \see \n 104 N/A. 105 */ 106 HI_S32 HI_GV_PARSER_GetViewNum(HI_U32 *viewNum); 107 108 /* 109 \brief Load the view by name of view. 110 \attention \n 111 N/A. 112 \param[in] viewName View name. 113 \retval ::HI_SUCCESS 114 \retval ::HI_ERR_PARSER_NOINIT 115 \retval ::HI_ERR_PARSER_UNSUPPORT 116 \see \n 117 N/A. 118 */ 119 HI_S32 HI_GV_PARSER_LoadViewByName(const HI_CHAR *viewName); 120 121 /* 122 \brief Load the view by ID of view. 123 \attention \n 124 if(ViewId = LOADALLVIEW),load all view. 125 \param[in] viewID View ID. 126 \retval ::HI_SUCCESS 127 \retval ::HI_ERR_PARSER_NOINIT 128 \retval ::HI_ERR_COMM_LOST The view is not exit. 129 \retval ::HI_ERR_PARSER_DATALEN 130 \retval ::HI_ERR_PARSER_DATAERR 131 \see \n 132 HI_GV_PARSER_LoadViewById 133 */ 134 HI_S32 HI_GV_PARSER_LoadViewById(HI_U32 viewID); 135 136 /* 137 \brief Unload the view by ID of view. 138 \attention \n 139 \param[in] viewID View ID. 140 \retval ::HI_SUCCESS 141 \retval ::HI_ERR_PARSER_NOINIT 142 \retval ::HI_ERR_COMM_LOST 143 \see \n 144 HI_GV_PARSER_LoadViewById 145 */ 146 HI_S32 HI_GV_PARSER_UnloadViewByID(HI_HANDLE viewID); 147 148 /* 149 \brief Load the view by index. 150 \attention \n 151 N/A. 152 \param[in] viewIndex View index. 153 \retval ::HI_SUCCESS 154 \retval ::HI_ERR_PARSER_NOINIT 155 \retval ::HI_ERR_COMM_LOST 156 \retval ::HI_ERR_PARSER_DATALEN 157 \retval ::HI_ERR_PARSER_DATAERR 158 \see \n 159 N/A. 160 */ 161 HI_S32 HI_GV_PARSER_LoadViewByIndex(HI_U32 viewIndex); 162 163 /* 164 \brief Delete the view exclude view. 165 \attention \n 166 N/A. 167 \param[in] excludeViewID Exclude view that is not deleted. 168 \param[in] excludeViewNum The number of view that not need deleted. 169 \retval ::HI_SUCCESS 170 \retval ::HI_ERR_PARSER_NOINIT 171 \retval ::HI_ERR_COMM_INVAL 172 \retval ::HI_FAILURE 173 \see \n 174 N/A. 175 */ 176 HI_S32 HI_GV_PARSER_UnLoadViewExclude(const HI_HANDLE *excludeViewID, HI_U32 excludeViewNum); 177 178 /* 179 \brief Get windows handle by view ID. 180 \attention \n 181 N/A. 182 \param[in] viewID View ID. 183 \param[out] winsArray The window handle array . 184 \param[out] winsNum The number of view that not need deleted. 185 \retval ::HI_SUCCESS 186 \retval ::HI_ERR_COMM_NOTINIT 187 \see \n 188 N/A. 189 */ 190 HI_S32 HI_GV_PARSER_ViewGetWinsHandle(HI_U32 viewID, HI_HANDLE **winsArray, HI_U32 *winsNum); 191 192 /* 193 \brief Get the version number. 194 \attention \n 195 N/A. 196 \param[out] mainVersion Main version. 197 \param[out] subVersion Sub version. 198 \retval ::HI_SUCCESS 199 \retval ::HI_ERR_PARSER_NOINIT 200 \see \n 201 N/A. 202 */ 203 HI_S32 HI_GV_PARSER_GetVersion(HI_U32 *mainVersion, HI_U32 *subVersion); 204 205 /* 206 \brief Set the evnent function at the STC mode. 207 \attention \n 208 N/A. 209 \param[in] eventProc Event function. 210 \param[in] number The number of event function. 211 \retval HI_SUCCESS 212 \retval HI_ERR_PARSER_NOINIT 213 \retval HI_ERR_COMM_INVAL 214 \see \n 215 N/A. 216 */ 217 HI_S32 HI_GV_PARSER_SetWidgetEventFunc(const HIGV_MSG_PROC *eventProc, HI_U32 number); 218 219 #ifdef __cplusplus 220 } 221 #endif 222 #endif /* HI_PARSE_H */ 223