summaryrefslogtreecommitdiff
path: root/mac/sar/test/inc/sar_unit_test_functions.h
blob: 906c2477cef1067da34e4faa07554fefca00d063 (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
#ifndef SAR_UNIT_TEST_FUNCTIONS_H_
#define SAR_UNIT_TEST_FUNCTIONS_H_

/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    sar_unit_test_functions.h
 * \brief   function for the unit tests.
 * \ingroup mac/sar/inc
 *
 */

#include <stdio.h>

#include "lib/rnd.h"
#include "mac/sar/sar.h"

/** TODO REMOVE THIS FUNCTIONS **/

/** PB pool a pool used by the Pb proc to stock the data received from the other
 * STA.
 * TODO TBR*/
struct pb_pool_t
{
    pb_t *head;
    pb_t *tail;
    uint quantity;
};
typedef struct pb_pool_t pb_pool_t;

/** Structure to konw the status of the PBDMA 
 * TBR*/
struct dma_status_t
{
BITFIELDS_WORD
    (
    u32 stop :1;,
    u32 request_irq :1;,
    u32 direction :1;,
    u32 cv_error :1;,
    u32 icv_reset :1;,
    u32 icv_store :1;,
    u32 append_zero :1;,
    u32 data_addr_mask :25;
)};
typedef struct dma_status_t dma_status_t;


struct sar_pbproc_t
{
    u32 cpt_expiration;
};
typedef struct sar_pbproc_t sar_pbproc_t;

/**
 * Initialise pbproc and return its context.
 * \param  config  global mac configuration
 * \param  store  MFS and STA store
 * \param  user_data  user data passed to any callback
 * \param  rx_cb  MPDU RX callback
 * \return  pbproc context
 */
pbproc_t * pbproc_init (mac_config_t *config, mac_store_t *store);

void
pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb,
        pbproc_rx_beacon_cb_t rx_beacon_cb);

void
pbproc_uninit(pbproc_t *ctx);

/**
 * Give segments back to pbproc for reception.
 * \param  ctx  pbproc context
 * \param  first  first segment
 * \param  last  last segment
 * \param  nb  number of segment
 */
void
pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *first, pb_t *last,
                uint nb);

/**
 * Get the current NTB.
 * \param  ctx  pbproc context
 * \return  current NTB
 */
u32 pbproc_get_ntb (pbproc_t *ctx);

/**
* Unregister an MFS from the Channel Access, so that it can no longer be
* sent.
* \param  ctx  ca context
* \param  mfs  the MFS to remove
* \return  true if successful
*
* If unsuccessful, the caller should try later because the MFS is currently
* been used for a transmission.
*/
bool
ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs);

/**
* Register an MFS with the Channel Access, so it can be sent.
* \param  ctx  ca context
* \param  mfs  the MFS to add
*/
void
ca_mfs_add (ca_t *ctx, mfs_tx_t *mfs);

void
ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs);

#endif /*SAR_UNIT_TEST_FUNCTIONS_H_*/