summaryrefslogtreecommitdiff
path: root/cesar/interface/inc/context.h
blob: 4ac4809d5bff7d83de9c370e70c83d55b923c219 (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
#ifndef interface_inc_context_h
#define interface_inc_context_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    interface/inc/context.h
 * \brief   Interface context. 
 * \ingroup interface
 *
 */
#include <cyg/kernel/kapi.h>
#include <cyg/hal/hal_arch.h>
#include "hle/hle.h"
#include "lib/circular_buffer.h"
#include "mac/common/config.h"

#include "interface/interface.h"

/** module includes. */
#include "interface/sniffer/sniffer.h"
#include "interface/fcall/interface_fcall.h"


#define INTERFACE_THREAD_STACK CYGNUM_HAL_STACK_SIZE_TYPICAL
#define INTERFACE_THREAD_PRIORITY 9 

struct interface_t
{
    /** cl context. */
    cl_t *cl;
    /** sar context. */
    sar_t *sar;
    /** hle context. */
    hle_t *hle;

    /** sniffer context. */
    interface_sniffer_t *sniffer;

    /** fcall context. */
    interface_fcall_t *fcall;

    /** Mac config. */
    mac_config_t *mac_config;

    /* callbacks functions. */
    /** Callback to call on MME reception. */
    interface_mme_recv_cb_t mme_recv_cb;
    /** Callback on buffer add. */
    interface_mme_buffer_add_cb_t buffer_add_cb;
    /** Callback on beacon add. */
    interface_beacon_add_cb_t beacon_add_cb;
    /** Actor user data. */
    void *actor_user_data;

    /** Buffer management. */
    u8 *buffer_list[INTERFACE_BUFFER_LIST_NUM_SLOTS];
    circular_buffer_t buffers;

    cyg_mutex_t buffer_mutex;

    /** Thread. */
    cyg_thread  thread;
    /** Thread handle. */
    cyg_handle_t thread_handle;
    /** Thread stack. */
    u8 thread_stack [INTERFACE_THREAD_STACK];

    /** Mailbox. */
    cyg_mbox mailbox;
    /** Mailbox handle. */
    cyg_handle_t mbox_handle;
};

#endif /* interface_inc_context_h */