11bd4fe43Sopenharmony_ci/* 21bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License. 51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at 61bd4fe43Sopenharmony_ci * 71bd4fe43Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 81bd4fe43Sopenharmony_ci * 91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and 131bd4fe43Sopenharmony_ci * limitations under the License. 141bd4fe43Sopenharmony_ci */ 151bd4fe43Sopenharmony_ci 161bd4fe43Sopenharmony_ci#ifndef __LZMARAM_H__ 171bd4fe43Sopenharmony_ci#define __LZMARAM_H__ 181bd4fe43Sopenharmony_ci 191bd4fe43Sopenharmony_ci#include <hi_types.h> 201bd4fe43Sopenharmony_ci 211bd4fe43Sopenharmony_citypedef hi_u32 (*lzma_stream_fct)(hi_u32 offset, hi_u8 *buffer, hi_u32 size); 221bd4fe43Sopenharmony_ci 231bd4fe43Sopenharmony_citypedef struct { 241bd4fe43Sopenharmony_ci hi_u32 offset; 251bd4fe43Sopenharmony_ci lzma_stream_fct func; 261bd4fe43Sopenharmony_ci} lzma_stream; 271bd4fe43Sopenharmony_ci 281bd4fe43Sopenharmony_citypedef struct { 291bd4fe43Sopenharmony_ci hi_pbyte (*alloc)(hi_pbyte p, unsigned int size); 301bd4fe43Sopenharmony_ci void (*free)(hi_pbyte p, hi_pbyte address); /* address can be 0 */ 311bd4fe43Sopenharmony_ci} i_sz_alloc; 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_ciextern unsigned int LzmaDecode2(const unsigned char *prop_data, unsigned int prop_size, hi_u32 *status, 341bd4fe43Sopenharmony_ci i_sz_alloc *alloc, lzma_stream *in_stream, lzma_stream *out_stream, 351bd4fe43Sopenharmony_ci unsigned int uncompress_len, unsigned int compress_len); 361bd4fe43Sopenharmony_ci 371bd4fe43Sopenharmony_ciunsigned int hi_lzma_decompress(const hi_u8 lzma_head[13], hi_u32 head_size, /* head 13B */ 381bd4fe43Sopenharmony_ci unsigned int compress_len, 391bd4fe43Sopenharmony_ci lzma_stream_fct in_func, lzma_stream_fct out_func); 401bd4fe43Sopenharmony_ciunsigned int hi_lzma_get_uncompress_len(const hi_u8 lzma_head[13], hi_u32 head_size, /* head 13B */ 411bd4fe43Sopenharmony_ci unsigned int *pul_decompressed_data_len, unsigned int *dic_size); 421bd4fe43Sopenharmony_ciunsigned int hi_lzma_mem_detect(const hi_u8 lzma_head[13], hi_u32 head_size); /* head 13B */ 431bd4fe43Sopenharmony_ci 441bd4fe43Sopenharmony_ci#endif 451bd4fe43Sopenharmony_ci 46