-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac_event.h
78 lines (66 loc) · 3.28 KB
/
mac_event.h
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
/* Copyright (c) 2008 ATMEL Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
$Id: mac_event.h,v 1.1 2009/05/20 20:52:01 mvidales Exp $
*/
#ifndef CIRCULAR_QUEUE_H
#define CIRCULAR_QUEUE_H
// Includes
#include "mac.h"
#include "mac_route.h"
/**
@addtogroup mac_associate
@{
*/
// Macros & Defines
/**
List of event types processed by the MAC event system.
*/
typedef enum {MAC_EVENT_DATA_RX=0x10, ///< This node has received a packet 0x10
MAC_EVENT_ACK, ///< Received an ACK frame 0x11
MAC_EVENT_NACK, ///< Sent frame failed 0x12
MAC_EVENT_ACCESS_FAIL, ///< Channel access failure 0x13
MAC_EVENT_BEACON_RECEIVED, ///< This node received a beacon frame 0x14
MAC_EVENT_BEACON_REQUEST, ///< This node received a beacon request frame 0x15
MAC_EVENT_TIMER, ///< The timer has expired 0x16
MAC_EVENT_ASSOCIATION_REQUEST, ///< Received an association request frame -------- 0x17
MAC_EVENT_ASSOCIATION_RESPONSE, ///< Received an association response frame ------ 0x18
MAC_EVENT_ROUTE, ///< Received a routing packet. 0x19
} __attribute__((packed)) event_t;
/**
Object that defines a single event. @see event_queue.
*/
typedef struct {
event_t event; ///< Event type, see event_t for details.
u8 *data; ///< Associated data that goes with the event. Depends on event type.
} __attribute__((packed)) event_object_t;
// Prototypes
u8 mac_event_pending(void);
void mac_put_event(event_object_t *object);
event_object_t * mac_get_event(void);
void macTask(void);
/** @} */
#endif