]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
2c7e5c2f HT |
3 | Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | EdkIIGlueUefiDecompressLib.h\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | Public header file for UEFI Decompress Lib\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
23 | #ifndef __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__\r | |
24 | #define __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__\r | |
25 | \r | |
26 | #define FillBuf(_SD, _NUMOFBITS) GlueFillBuf(_SD, _NUMOFBITS)\r | |
27 | #define GetBits(_SD, _NUMOFBITS) GlueGetBits(_SD, _NUMOFBITS)\r | |
28 | #define MakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE) GlueMakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE)\r | |
29 | #define DecodeP(_SD) GlueDecodeP(_SD)\r | |
30 | #define ReadPTLen( _SD, _NN, _NBIT, _SPECIAL) GlueReadPTLen( _SD, _NN, _NBIT, _SPECIAL)\r | |
31 | #define ReadCLen(_SD) GlueReadCLen(_SD)\r | |
32 | #define DecodeC(_SD) GlueDecodeC(_SD)\r | |
33 | #define Decode(_SD) GlueDecode(_SD)\r | |
34 | \r | |
35 | \r | |
36 | \r | |
37 | /**\r | |
38 | Retrieves the size of the uncompressed buffer and the size of the scratch buffer.\r | |
39 | \r | |
40 | Retrieves the size of the uncompressed buffer and the temporary scratch buffer \r | |
41 | required to decompress the buffer specified by Source and SourceSize.\r | |
42 | If the size of the uncompressed buffer or the size of the scratch buffer cannot\r | |
43 | be determined from the compressed data specified by Source and SourceData, \r | |
44 | then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed\r | |
45 | buffer is returned in DestinationSize, the size of the scratch buffer is returned\r | |
46 | in ScratchSize, and RETURN_SUCCESS is returned.\r | |
47 | This function does not have scratch buffer available to perform a thorough \r | |
48 | checking of the validity of the source data. It just retrieves the "Original Size"\r | |
49 | field from the beginning bytes of the source data and output it as DestinationSize.\r | |
50 | And ScratchSize is specific to the decompression implementation.\r | |
51 | \r | |
52 | If Source is NULL, then ASSERT().\r | |
53 | If DestinationSize is NULL, then ASSERT().\r | |
54 | If ScratchSize is NULL, then ASSERT().\r | |
55 | \r | |
56 | @param Source The source buffer containing the compressed data.\r | |
57 | @param SourceSize The size, in bytes, of the source buffer.\r | |
58 | @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r | |
59 | that will be generated when the compressed buffer specified\r | |
60 | by Source and SourceSize is decompressed..\r | |
61 | @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that\r | |
62 | is required to decompress the compressed buffer specified \r | |
63 | by Source and SourceSize.\r | |
64 | \r | |
65 | @retval RETURN_SUCCESS The size of destination buffer and the size of scratch \r | |
66 | buffer are successull retrieved.\r | |
67 | @retval RETURN_INVALID_PARAMETER The source data is corrupted\r | |
68 | \r | |
69 | **/\r | |
70 | RETURN_STATUS\r | |
71 | EFIAPI\r | |
72 | UefiDecompressGetInfo (\r | |
73 | IN CONST VOID *Source,\r | |
74 | IN UINT32 SourceSize,\r | |
75 | OUT UINT32 *DestinationSize,\r | |
76 | OUT UINT32 *ScratchSize\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | Decompresses a compressed source buffer.\r | |
81 | \r | |
82 | This function is designed so that the decompression algorithm can be implemented\r | |
83 | without using any memory services. As a result, this function is not allowed to\r | |
84 | call any memory allocation services in its implementation. It is the caller's r\r | |
85 | esponsibility to allocate and free the Destination and Scratch buffers.\r | |
86 | If the compressed source data specified by Source is sucessfully decompressed \r | |
87 | into Destination, then RETURN_SUCCESS is returned. If the compressed source data \r | |
88 | specified by Source is not in a valid compressed data format,\r | |
89 | then RETURN_INVALID_PARAMETER is returned.\r | |
90 | \r | |
91 | If Source is NULL, then ASSERT().\r | |
92 | If Destination is NULL, then ASSERT().\r | |
93 | If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().\r | |
94 | \r | |
95 | @param Source The source buffer containing the compressed data.\r | |
96 | @param Destination The destination buffer to store the decompressed data\r | |
97 | @param Scratch A temporary scratch buffer that is used to perform the decompression.\r | |
98 | This is an optional parameter that may be NULL if the \r | |
99 | required scratch buffer size is 0.\r | |
100 | \r | |
101 | @retval RETURN_SUCCESS Decompression is successfull\r | |
102 | @retval RETURN_INVALID_PARAMETER The source data is corrupted\r | |
103 | \r | |
104 | **/\r | |
105 | RETURN_STATUS\r | |
106 | EFIAPI\r | |
107 | UefiDecompress (\r | |
108 | IN CONST VOID *Source,\r | |
109 | IN OUT VOID *Destination,\r | |
110 | IN OUT VOID *Scratch\r | |
111 | );\r | |
112 | \r | |
113 | #endif\r |