summaryrefslogtreecommitdiff
path: root/cesar/bsu/inc/context.h
blob: 5cdce36f7a5622c08d9ba7ae9dd540197e36ca5f (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
#ifndef bsu_inc_context_h
#define bsu_inc_context_h
/* Cesar project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    bsu/inc/context.h
 * \brief   BSU context.
 * \ingroup bsu
 */
#include "common/defs/homeplugAV.h"
#include "bsu/bsu.h"
#include "bsu/ntb/ntb_sync.h"
#include "bsu/beacon/beacon.h"
#include "bsu/inc/trace.h"

/** Number of foreign AVLNs handled. */
#define BSU_FOREIGN_AVLNS_NB (HPAV_AVLNS_NB_MAX - 1)

/** Index of processed data used by the merge schedule process. */
struct bsu_avln_schedules_process_t
{
    /** Persistent schedules to use. */
    bsu_beacon_bmi_persistent_schedule_desc_t *ps;
    /** Persistent schedules allocation index. */
    uint ps_alloc_index;
    /** Non persistent schedules allocation index. */
    uint nps_alloc_index;
};
typedef struct bsu_avln_schedules_process_t bsu_avln_schedules_process_t;

/** BSU AVLN data. */
struct bsu_avln_t
{
    /** The beacon schedules data. */
    bsu_beacon_avln_t bs;
    /** NTB synchronisation data.  */
    bsu_ntb_sync_t sync;
};

struct bsu_t
{
    /** Mac config. */
    mac_config_t *mac_config;
    /** Mac Store. */
    mac_store_t *mac_store;
    /** Channel access context. */
    ca_t *ca;
    /** SAR context. */
    sar_t *sar;
    /** Phy context. */
    phy_t *phy;
    /** Upper layer user data.*/
    void *ul_data;
    /** Call back to provide the beacon to the upper layer. */
    bsu_beacon_processed_t ul_cb;
    /** ACLF context. */
    bsu_aclf_t *aclf;
    /** Station's AVLN. */
    bsu_avln_t *sta_avln;
    /** Others AVLN's data. */
    bsu_avln_t avlns[HPAV_AVLNS_NB_MAX];
    /** Number of others AVLN NTB. */
    uint avlns_nb;
    /** Special power on AVLN data. */
    bsu_avln_t poweron;
    /** NID to track. */
    u64 nid_track;
    /** SNID to track. */
    u16 snid_track;
    /** TEI to track. */
    u8 tei_track;
    /** CA schedule index. */
    u8 ca_index;
    /** Is station */
    bsu_update_sta_type_t is_sta;
    /** Beacon data to use. */
    bsu_beacon_t beacon;
    /** HAL timer context. */
    hal_timer_t *hal_timer;
    /** HAL timer instance. */
    hal_timer_instance_t timer;
    /** Activated status. */
    bool activate;
    /** Beacons MFS. */
    mfs_tx_t *mfs_beacons[3];
#if CONFIG_TRACE
    /** Trace system. */
    trace_buffer_t trace;
#endif /* !CONFIG_TRACE */
};

#endif /* bsu_inc_context_h */