summaryrefslogtreecommitdiff
path: root/mac/pbproc/inc/sacki_enc.h
blob: 6597a72c29d59dfda2967cc1f5e7b9d8188e54bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef mac_pbproc_inc_sacki_enc_h
#define mac_pbproc_inc_sacki_enc_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    mac/pbproc/inc/sacki_enc.h
 * \brief   SACKI compression.
 * \ingroup mac_pbproc
 */

/** SACKI compression context. */
struct pbproc_sacki_enc_t
{
    /** SACKI buffer. */
    u32 si[3];
    /** SACKI buffer start offset. */
    uint sis;
    /** SACKI buffer available length. */
    uint sil;
    /** CRC bitmap start offset. */
    u32 bmps;
};
typedef struct pbproc_sacki_enc_t pbproc_sacki_enc_t;

BEGIN_DECLS

/**
 * Initialise context.
 * \param  ctx  SACKI compression context
 * \param  sil  SACKI buffer size
 */
void
pbproc_sacki_enc_init (pbproc_sacki_enc_t *ctx, uint sil);

/**
 * Process bitmap CRC bits.
 * \param  ctx  SACKI compression context
 * \param  bmp  CRC bitmap address
 * \param  bmpl  CRC bitmap total number of available bits (including those
 * precessed yet)
 * \param  final  true if no more bits is following
 *
 * The compression can be done in several steps.  In this case, this function
 * should be called again.
 */
void
pbproc_sacki_enc_process (pbproc_sacki_enc_t *ctx, const volatile u32 *bmp,
                          uint bmpl, bool final);

END_DECLS

#endif /* mac_pbproc_inc_sacki_enc_h */