]> oss.titaniummirror.com Git - tinyos-2.x.git/blob - tos/lib/mac/tkn154/dummies/NoFrameDispatchP.nc
+ modified radio driver (PHY) interfaces: CSMA-CA algorithm is now pushed to radio...
[tinyos-2.x.git] / tos / lib / mac / tkn154 / dummies / NoFrameDispatchP.nc
1 /*
2 * Copyright (c) 2008, Technische Universitaet Berlin
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 * - Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * - 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 * - Neither the name of the Technische Universitaet Berlin nor the names
14 * of its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * - Revision -------------------------------------------------------------
30 * $Revision$
31 * $Date$
32 * @author Jan Hauer <hauer@tkn.tu-berlin.de>
33 * ========================================================================
34 */
35
36 #include "TKN154_PHY.h"
37 #include "TKN154_MAC.h"
38
39 generic module NoFrameDispatchP(uint8_t superframeDirection)
40 {
41 provides
42 {
43 interface Init as Reset;
44 interface FrameTx as FrameTx;
45 interface FrameRx as FrameRx[uint8_t frameType];
46 interface FrameExtracted as FrameExtracted[uint8_t frameType];
47 interface FrameTxNow as BroadcastTx;
48 interface Notify<bool> as WasRxEnabled;
49 interface Notify<bool> as FindBeacon;
50 }
51 uses
52 {
53 interface Alarm<TSymbolIEEE802154,uint32_t> as CapEndAlarm;
54 interface Alarm<TSymbolIEEE802154,uint32_t> as BLEAlarm;
55 interface Alarm<TSymbolIEEE802154,uint32_t> as IndirectTxWaitAlarm;
56 interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
57 interface Resource as Token;
58 interface GetNow<bool> as IsTokenRequested;
59 interface ResourceTransfer as TokenToCfp;
60 interface ResourceTransferred as TokenTransferred;
61 interface GetNow<uint32_t> as CapStart;
62 interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
63 interface GetNow<uint32_t> as CapLen;
64 interface GetNow<bool> as IsBLEActive;
65 interface GetNow<uint16_t> as BLELen;
66 interface GetNow<bool> as IsRxBroadcastPending;
67 interface GetNow<bool> as IsRxEnableActive;
68 interface Get<ieee154_txframe_t*> as GetIndirectTxFrame;
69 interface Notify<bool> as RxEnableStateChange;
70 interface GetNow<bool> as IsTrackingBeacons;
71 interface FrameUtility;
72 interface RadioTx;
73 interface RadioRx;
74 interface RadioOff;
75 interface GetNow<bool> as IsBeaconEnabledPAN;
76 interface MLME_GET;
77 interface MLME_SET;
78 interface Ieee802154Debug as Debug;
79 interface TimeCalc;
80 interface Leds;
81 interface SetNow<ieee154_cap_frame_backup_t*> as FrameBackup;
82 interface GetNow<ieee154_cap_frame_backup_t*> as FrameRestore;
83 }
84 }
85 implementation
86 {
87 command error_t Reset.init()
88 {
89 return SUCCESS;
90 }
91
92 async event void TokenTransferred.transferred()
93 {
94 call TokenToCfp.transfer();
95 }
96
97 command ieee154_status_t FrameTx.transmit(ieee154_txframe_t *frame)
98 {
99 return IEEE154_TRANSACTION_OVERFLOW;
100 }
101
102 async event void RadioTx.loadDone(){ }
103 async event void RadioOff.offDone(){ }
104 async event void RadioRx.prepareDone(){ }
105
106 async event void CapEndAlarm.fired(){ }
107 async event void BLEAlarm.fired(){ }
108 event void RxEnableStateChange.notify(bool whatever){ }
109 async event void BroadcastAlarm.fired(){ }
110
111 async event void IndirectTxWaitAlarm.fired() { }
112
113 async event void RadioTx.transmitUnslottedCsmaCaDone(ieee154_txframe_t *frame,
114 bool ackPendingFlag, ieee154_csma_t *csmaParams, error_t result)
115 {
116 }
117
118 async event void RadioTx.transmitSlottedCsmaCaDone(ieee154_txframe_t *frame, ieee154_reftime_t *txTime,
119 bool ackPendingFlag, uint16_t remainingBackoff, ieee154_csma_t *csmaParams, error_t result)
120 {
121 }
122
123 void transmitDone(ieee154_txframe_t *frame, ieee154_reftime_t *txTime,
124 bool ackPendingFlag, ieee154_csma_t *csmaParams, error_t result)
125 {
126 }
127
128 event message_t* RadioRx.received(message_t* frame, ieee154_reftime_t *timestamp)
129 {
130 return frame;
131 }
132
133 async command ieee154_status_t BroadcastTx.transmitNow(ieee154_txframe_t *frame)
134 {
135 return IEEE154_TRANSACTION_OVERFLOW;
136 }
137
138 event void Token.granted()
139 {
140 }
141
142 async event void RadioTx.transmitDone(ieee154_txframe_t *frame, ieee154_reftime_t *txTime){}
143
144 default event void FrameTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status){}
145 default event message_t* FrameRx.received[uint8_t client](message_t* data){return data;}
146 default async command bool IsRxEnableActive.getNow(){return FALSE;}
147
148 default async command void IndirectTxWaitAlarm.start(uint32_t dt){call Leds.led0On();}
149 default async command void IndirectTxWaitAlarm.stop(){call Leds.led0On();}
150 default async command void IndirectTxWaitAlarm.startAt(uint32_t t0, uint32_t dt){call Leds.led0On();}
151
152 default async command void BroadcastAlarm.start(uint32_t dt){call Leds.led0On();}
153 default async command void BroadcastAlarm.stop(){call Leds.led0On();}
154 default async command void BroadcastAlarm.startAt(uint32_t t0, uint32_t dt){call Leds.led0On();}
155
156 default async command bool IsRxBroadcastPending.getNow(){ return FALSE;}
157 default async event void BroadcastTx.transmitNowDone(ieee154_txframe_t *frame, ieee154_status_t status){}
158 default event message_t* FrameExtracted.received[uint8_t client](message_t* msg, ieee154_txframe_t *txFrame){return msg;}
159 default async command error_t FrameBackup.setNow(ieee154_cap_frame_backup_t* val ){return FAIL;}
160 default async command ieee154_cap_frame_backup_t* FrameRestore.getNow(){return NULL;}
161
162 command error_t WasRxEnabled.enable(){return FAIL;}
163 command error_t WasRxEnabled.disable(){return FAIL;}
164 command error_t FindBeacon.enable(){return FAIL;}
165 command error_t FindBeacon.disable(){return FAIL;}
166 }