RTEMS CPU Kit with SuperCore  4.11.3
rtl-obj-comp.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org>
3  *
4  * The license and distribution terms for this file may be
5  * found in the file LICENSE in this distribution or at
6  * http://www.rtems.org/license/LICENSE.
7  */
23 #if !defined (_RTEMS_RTL_OBJ_COMP_H_)
24 #define _RTEMS_RTL_OBJ_COMP_H_
25 
26 #include <rtems/rtl/rtl-obj-cache.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
35 #define RTEMS_RTL_DECOMP_INPUT_SIZE (256)
36 
40 #define RTEMS_RTL_COMP_NONE (0)
41 #define RTEMS_RTL_COMP_LZ77 (1)
42 
46 typedef struct rtems_rtl_obj_cpmp_s
47 {
50  int fd;
52  off_t offset;
53  size_t size;
54  size_t level;
55  uint8_t* buffer;
56  uint32_t read;
58 
62 static inline uint32_t rtems_rtl_obj_comp_input (rtems_rtl_obj_comp_t* comp)
63 {
64  return comp->read;
65 }
66 
76  size_t size);
77 
84 
96  int fd,
97  int compression,
98  off_t offset);
99 
115  void* buffer,
116  size_t length);
117 
118 #ifdef __cplusplus
119 }
120 #endif /* __cplusplus */
121 
122 #endif
struct rtems_rtl_obj_cpmp_s rtems_rtl_obj_comp_t
The compressed file.
rtems_rtl_obj_cache_t * cache
The cache provides the input buffer.
Definition: rtl-obj-comp.h:48
int compression
The type of compression.
Definition: rtl-obj-comp.h:51
off_t offset
The base offset of the buffer.
Definition: rtl-obj-comp.h:52
uint32_t read
The amount of data read.
Definition: rtl-obj-comp.h:56
bool rtems_rtl_obj_comp_open(rtems_rtl_obj_comp_t *comp, size_t size)
Open a compressor allocating the output buffer.
Definition: rtl-obj-comp.c:34
The buffer cache.
Definition: rtl-obj-cache.h:53
The compressed file.
Definition: rtl-obj-comp.h:46
size_t size
The size of the output buffer.
Definition: rtl-obj-comp.h:53
void rtems_rtl_obj_comp_close(rtems_rtl_obj_comp_t *comp)
Close a compressor.
Definition: rtl-obj-comp.c:54
bool rtems_rtl_obj_comp_read(rtems_rtl_obj_comp_t *comp, void *buffer, size_t length)
Read decompressed data.
Definition: rtl-obj-comp.c:82
int fd
The file descriptor.
Definition: rtl-obj-comp.h:50
size_t level
The amount of data in the buffer.
Definition: rtl-obj-comp.h:54
void rtems_rtl_obj_comp_set(rtems_rtl_obj_comp_t *comp, rtems_rtl_obj_cache_t *cache, int fd, int compression, off_t offset)
Set the cache and offset in the file the compressed stream starts.
Definition: rtl-obj-comp.c:67
uint8_t * buffer
The buffer.
Definition: rtl-obj-comp.h:55