summaryrefslogtreecommitdiff
path: root/cesar/station/src/station.c
blob: db846c942a664ecf6b71d909558cdbd66c2c5971 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cesar.c
 * \brief   main level of cesar software.
 * \ingroup cesar
 */
#include "common/std.h"

#include "lib/trace.h"

#include "mac/common/ntb.h"
#include "station/station.h"

/** Static declaration. */
static cesar_t cesar;

/**
 * \brief CESAR application software entry-point function.
 */
cesar_t *
cesar_init (void)
{
    trace_init ();

    /* Initialise the mac store. */
    cesar.mac_store  = mac_store_init ();

    /* Initialise the MAC config. */
    mac_config_init (&cesar.mac_config);

    /* Initialise the PBproc. */
    cesar.pbproc = pbproc_init (&cesar.mac_config,
                                cesar.mac_store);

    /* Initialise the mac ntb. */
    mac_ntb_init (pbproc_get_phy(cesar.pbproc),
                  &cesar.mac_config);

    /* Initialise the SAR. */
    cesar.sar = sar_init (cesar.mac_store, cesar.pbproc,
                          pbproc_get_ca(cesar.pbproc));

    /* Initialise the CL. */
    cesar.cl = cl_init (cesar.mac_store, cesar.sar,
                        &cesar.mac_config);

    /* Initialise the HLE. */
    cesar.hle = hle_init (cesar.cl);

    /* Initialise the interface. */
    cesar.interface = interface_init(cesar.hle,
                                     cesar.cl,
                                     cesar.sar,
                                     &cesar.mac_config);

    /* Initialise the hal timer. */
    cesar.hal_timer = hal_timer_init (pbproc_get_phy(cesar.pbproc));

    /* Initialise the CP. */
    cesar.cp = cp_init (&cesar.mac_config, cesar.interface, cesar.hal_timer,
                        cesar.pbproc);

    cesar.rxce = ce_init(cesar.sar);

    // start HLE...
    hle_activate(cesar.hle, true);

    return &cesar;
}