Contiki 2.5
sicslowmac.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  * $Id: sicslowmac.h,v 1.3 2008/10/14 18:36:07 c_oflynn Exp $
32  */
33 
34 /**
35  * \file
36  * Example glue code between the existing MAC code and the
37  * Contiki mac interface
38  * \author
39  * Adam Dunkels <adam@sics.se>
40  * Eric Gnoske <egnoske@gmail.com>
41  * Blake Leverett <bleverett@gmail.com>
42  */
43 
44 /**
45  \addtogroup rf230mac
46 */
47 
48 #ifndef __SICSLOWMAC_H__
49 #define __SICSLOWMAC_H__
50 
51 #include <stdbool.h>
52 #include <stdint.h>
53 #include "contiki.h"
54 #include "dev/radio.h"
55 #include "frame.h"
56 
57 /* Macros & Defines */
58 
59 typedef enum {
60  MAC_EVENT_RX=0x10,
61  MAC_EVENT_ACK,
62  MAC_EVENT_NACK,
63  MAC_EVENT_SCAN,
64  MAC_EVENT_BEACON_REQ,
65  MAC_EVENT_DROPPED,
66  MAC_EVENT_TX
67  /* MAC_EVENT_TIMER */
68 } event_t;
69 
70 typedef struct {
71  event_t event; /**< Event type, see event_t for details. */
72  uint8_t *data; /**< Associated data that goes with the event. Depends on event type. */
73 } event_object_t;
74 
75 extern const struct mac_driver sicslowmac_driver;
76 
77 /* Prototypes */
78 PROCESS_NAME(mac_process);
79 
80 uint8_t mac_event_pending(void);
81 void mac_put_event(event_object_t *object);
82 event_object_t *mac_get_event(void);
83 void mac_task(process_event_t ev, process_data_t data);
84 uint8_t nwk_dataIndication(void);
85 const struct mac_driver *sicslowmac_init(const struct radio_driver *r);
86 /* void sicslowmac_input_packet(const struct radio_driver *d); */
87 int sicslowmac_dataRequest(void);
88 void sicslowmac_dataIndication(void);
89 void sicslowmac_resetRequest (bool setDefaultPIB);
90 int sicsloread(void);
91 void byte_reverse(uint8_t * bytes, uint8_t num);
92 struct mac_driver * sicslowmac_get_driver(void);
93 parsed_frame_t * sicslowmac_get_frame(void);
94 
95 #endif /* __SICSLOWMAC_H__ */