summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/pber.h
blob: 3b986acd9a809ff95304822dce83e8efb2a12527 (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 ce_rx_bitloading_pber_h
#define ce_rx_bitloading_pber_h
/* Cesar project {{{
 *
 * Copyright (C) 2011 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ce/rx/bitloading/pber.h
 * \brief   PB Error Rate functions
 * \ingroup ce_rx
 *
 * This module is used to manage PBER.
 * Basically, it can:
 *   - maintain (update, initialize, reset) a PBER sliding mean (by PB and not
 *   by frame).
 * This module is used by the BER margin update.
 */

/**
 * The PBER context.
 */
typedef struct ce_rx_bl_pber_t
{
    /**
     * Current PBER sliding mean.
     * This is a Q16U32.
     */
    u32 mean_q16;
} ce_rx_bl_pber_t;

BEGIN_DECLS

/**
 * Reset PBER sliding mean.
 * \param  ctx  the PBER context
 */
void
ce_rx_bl_pber_reset (ce_rx_bl_pber_t *ctx);

/**
 * Update PBER sliding mean with a received frame.
 * \param  ctx  the PBER context
 * \param  pb_total  total number of PB (whatever CRC)
 * \param  pb_crc_false  number of PB with a CRC wrong
 *
 * This function simulates we have received PB one by one and compute the PBER
 * sliding mean by PB and not by frame.
 */
void
ce_rx_bl_pber_update (ce_rx_bl_pber_t *ctx, uint pb_total, uint pb_crc_false);

END_DECLS

#endif /* ce_rx_bitloading_pber_h */