summaryrefslogtreecommitdiff
path: root/cp/station/station.h
blob: dab1f204f62b18822ae239cf60a13ef9117d5f57 (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
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/station/station.h
 * \brief   
 * \ingroup cp_sta
 */
#ifndef CP_STATION_H_
#define CP_STATION_H_

#include <stdlib.h>

#include <cyg/kernel/kapi.h>
#include <cyg/hal/hal_arch.h>

#include "cp/interf/interf.h"
#include "cp/station/inc/station_types.h"
#include "cp/station/inc/station_apivs.h"
#include "cp/station/inc/station_actions.h"
#include "cp/station/inc/station_data.h"
#include "cp/beacon/beacon.h"
#include "cl/cl.h"
#include "mac/common/store.h"

/*
 * some global variables
 */

extern uint                         station_seed;
extern cyg_flag_t                   station_flag;


/**
 * \brief       Init station module
 * 				This is the cp entry point.
 * \param 
 * \return         
 */
void 
cp_station_init (mac_store_t *mac_store_ctx, cl_t *interf_cl_ctx, pbproc_t *pbproc_ctx, ca_t *ca_ctx);

/**
 * \brief          start mac service
 * \param 
 * \return         
 */
void
cp_station_mac_start(void);

/**
 * \brief          wait for a station event
 * \param 
 * \return         
 */
void 
cp_station_wait_event (cyg_addrword_t data);

/**
 * \brief       create an alarm that will generate an event after
 *              the specified delay
 * \param       cyg_flag : the event handle
 * \param       station_flag : the event flag
 * \param       event_delay_ms : the amount of time to wait
 * \return         
 */
void 
cp_station_gen_timed_event(cyg_flag_t *cyg_flag, station_flag_t station_flag, SEM_EVENT_TYPE  event_type, uint event_delay_ms);

/**
 * \brief       will stop an alarm previously created with station_gen_timed_event
 *  
 * \param       cyg_flag : the event handle
 * \param       station_flag : the event flag
 * \return         
 */
void 
cp_station_stop_timed_event(cyg_flag_t *cyg_flag, station_flag_t station_flag);


/**
 * \brief       this function is called when the amount of time specified 
 *              with station_wait_event() has elapsed.
 *              warning : this function is called in DSR context
 *              
 * \param       see ecos manual about alarm
 * \return         
 */
void 
cp_station_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data);


#endif /* CP_STATION_H_ */