summaryrefslogtreecommitdiff
path: root/cesar/test_general/station/common/src/station.c
blob: 56736c35a75c7dd4985d650599a439b8cb4a4ca9 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    src/station.c
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "common/std.h"
#include "common/defs/ethernet.h"
#include "lib/trace.h"
#include "lib/stats.h"

#include "station/station.h"
#include "cp/cp.h"
#include "hle/hle.h"
#include "cl/cl.h"
#include "mac/sar/sar.h"
#include "mac/pbproc/pbproc.h"
#include "cp/sta/mgr/sta_mgr.h"

#include "host/fcall/fcall.h"
#include "test_general/station/fcall/fcall.h"
#include "ce/rx/inc/rx.h"

/** Private include never use it in the station source code outside the own
 * module. **/
#if CONFIG_FCALL_MME
#include "interface/inc/context.h"
#endif
#include "cl/inc/context.h"
#include "mac/pbproc/inc/context.h"
#include "mac/sar/inc/sar_context.h"
#include "hal/phy/maximus/inc/maximus_phy_ctx.h"
#include <stdio.h>

#if !CONFIG_FCALL_MME
extern station_ctx_t my_station;
#endif

#include "cp/inc/context.h"
#include "cp/msg/inc/context.h"

static cesar_t *cesar;


#if CONFIG_STATS
char callback_local_value_name[255] = "\nbonus_stat_added_each_time_idemButCallback(u64)_is_requested_in_order_to_fill_the_1st_page_quickly._This_explain_why_stat's_name_is_that_long._This_stat_gives_the_number_of_bonus_stats_added(u16)";
u16 callback_local_value = 0;

static u16*
lib_stats_callback_test(void)
{
    callback_local_value++;

    lib_stats_set_stat_value_notype (callback_local_value_name,
                                     &callback_local_value,
                                     LIB_STATS_ACCESS_READ_ONLY,
                                     LIB_STATS_USER);

    return &callback_local_value;
}
#endif


/***************** Cesar *******************/

int
cyg_user_start (void)
{
    struct fcall_ctx *fcall = NULL;

    cesar = cesar_init ();

#if CONFIG_FCALL_MME
    fcall = cesar->interface->fcall->fcall_ctx;
#else
    fcall = my_station.fcall;
#endif

    fcall_register (fcall, "fc_sta_own_data_public",
                    &fc_sta_own_data_public, cesar);

    fcall_register (fcall, "fc_sta_own_data_private",
                    &fc_sta_own_data_private, cesar);

    fcall_register (fcall, "fc_cc_leave_req",
                    &fc_cc_leave_req, cesar);

    fcall_register (fcall, "fc_sta_mgr_get_unassoc_sta",
                    &fc_sta_mgr_get_unassoc_sta, cesar);

    fcall_register (fcall, "fc_sta_is_mac_bridged",
                    &fc_sta_is_mac_bridged, cesar);
    fcall_register (fcall, "fc_sta_get_mac_to_tei_entry",
                    &fc_sta_get_mac_to_tei_entry, cesar);

    fcall_register (fcall, "fc_mac_store_sta_peer_is_authenticated",
                    &fc_mac_store_sta_peer_is_authenticated, cesar->mac_store);

    fcall_register (fcall, "fc_cco_change_snid",
                    &fc_cco_change_snid, cesar);

    fcall_register (fcall, "fc_cco_change_hm",
                    &fc_cco_change_hm, cesar);

    fcall_register (fcall, "fc_cesar_uninit",
                    &fc_cesar_uninit, cesar);

    fcall_register (fcall, "fc_memory_state",
                    &fc_memory_state, NULL);

    fcall_register (fcall, "fc_ce_rx_initial_ce_started",
                    &fc_ce_rx_initial_ce_started, cesar);

    fcall_register (fcall, "fc_cco_change_nek",
                    &fc_cco_change_nek, cesar);
    fcall_register (fcall, "fc_nek_get", &fc_nek_get, cesar);

#if CONFIG_TRACE
        fcall_register (fcall, "fc_sta_trace_dump_cl",
                        &fc_sta_trace_dump, &cesar->cl->trace);
        fcall_register (fcall, "fc_sta_trace_dump_phy",
                        &fc_sta_trace_dump, &cesar->pbproc->phy->trace);
        fcall_register (fcall, "fc_sta_trace_dump_sar",
                        &fc_sta_trace_dump, &cesar->sar->trace);
        fcall_register (fcall, "fc_sta_trace_dump_ce_rx",
                        &fc_sta_trace_dump, &cesar->ce_rx->trace);
        fcall_register (fcall, "fc_sta_trace_dump_cp",
                        &fc_sta_trace_dump, &cesar->cp->trace);
        fcall_register (fcall, "fc_sta_trace_dump_cp_verbose",
                        &fc_sta_trace_dump, &cesar->cp->trace_verbose);
        fcall_register (fcall, "fc_sta_trace_dump_all",
                        &fc_sta_trace_dump_all, NULL);
#endif

#if !CONFIG_FCALL_MME
    my_station.pipe_log_fd = 1;
#endif

#if CONFIG_STATS
    lib_stats_set_stat_callback ("idemButCallback(u64)",
                                 (lib_stats_cb_r_t) lib_stats_callback_test,
                                 NULL,
                                 sizeof (*(lib_stats_callback_test ())),
                                 LIB_STATS_USER);
#endif

    return 0;
}