summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/test/src/pbproc_stub.c
blob: 6bebd2e9fe3429ca028aa6421b8f124d982c5cd9 (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
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ce/rx/test/src/pbproc_stub.c
 * \brief   Stub of the PBProc for the CE RX.
 * \ingroup test
 */
#include "common/std.h"
#include "hal/phy/pbdma.h"
#include "mac/pbproc/inc/context.h"
#include "lib/test.h"

void
pbproc_set_chandata_conf (pbproc_t *ctx, phy_chandata_conf_t *conf, uint nb)
{
    test_t *t = (test_t *) ctx;
    dbg_assert (t);
    /* We need to check if we ask for the channel data (the NSR). */
    test_begin (*t, "correct configuration of the PBProc for channel data")
    {
        int carrier = PHY_CARRIER_NB;
        uint offset = 0;
        uint i;
        /* Go through each entry of the table. */
        for (i = 0; i < nb; i++)
        {
            if (i == (nb - 1))
            {
                /* Check last block is really the last one. */
                test_fail_if (conf[i].last != 1);
            }
            else
            {
                /* Check last block is really the last one. */
                test_fail_if (conf[i].last != 0);
            }
            /* Update carrier information for the NSR. */
            if (conf[i].type == PHY_CHANDATA_TYPE_NRJ)
                carrier -= conf[i].size;
            /* Check if offset is correct. */
            test_fail_if (conf[i].address != offset);
            /* Update offset. */
            offset += conf[i].size;
        }
        /* No more carrier should remain. */
        test_fail_if (carrier > 0);
    } test_end;
}