1 /*
2  *  Copyright (c) 2017, The OpenThread Authors.
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 are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "openthread-core-config.h"
30 
31 #include "fuzzer_platform.h"
32 
33 #include <string.h>
34 
35 #include <openthread/platform/alarm-micro.h>
36 #include <openthread/platform/alarm-milli.h>
37 #include <openthread/platform/diag.h>
38 #include <openthread/platform/entropy.h>
39 #include <openthread/platform/logging.h>
40 #include <openthread/platform/misc.h>
41 #include <openthread/platform/radio.h>
42 #include <openthread/platform/settings.h>
43 
44 #include "mac/mac_frame.hpp"
45 
46 using namespace ot;
47 
48 typedef struct AlarmState
49 {
50     uint32_t fire;
51     bool     isRunning;
52 } AlarmState;
53 
54 enum
55 {
56     IEEE802154_ACK_LENGTH = 5,
57 
58     IEEE802154_FRAME_TYPE_ACK = 2 << 0,
59 };
60 
61 static uint32_t     sAlarmNow;
62 static AlarmState   sAlarmMilli;
63 static AlarmState   sAlarmMicro;
64 static uint32_t     sRandomState = 1;
65 static uint8_t      sRadioTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE];
66 static otRadioFrame sRadioTransmitFrame;
67 static uint8_t      sRadioAckPsdu[OT_RADIO_FRAME_MAX_SIZE];
68 static otRadioFrame sRadioAckFrame;
69 static bool         sResetWasRequested = false;
70 static otRadioState sRadioState        = OT_RADIO_STATE_DISABLED;
71 
otMacFrameIsAckRequested(const otRadioFrame * aFrame)72 bool otMacFrameIsAckRequested(const otRadioFrame *aFrame)
73 {
74     return static_cast<const Mac::Frame *>(aFrame)->GetAckRequest();
75 }
76 
otMacFrameGetSequence(const otRadioFrame * aFrame)77 uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame)
78 {
79     return static_cast<const Mac::Frame *>(aFrame)->GetSequence();
80 }
81 
FuzzerPlatformInit(void)82 void FuzzerPlatformInit(void)
83 {
84     sRandomState = 1;
85     sAlarmNow    = 0;
86     memset(&sAlarmMilli, 0, sizeof(sAlarmMilli));
87     memset(&sAlarmMicro, 0, sizeof(sAlarmMicro));
88 
89     sRadioTransmitFrame.mPsdu = sRadioTransmitPsdu;
90     sRadioAckFrame.mPsdu      = sRadioAckPsdu;
91 }
92 
FuzzerPlatformProcess(otInstance * aInstance)93 void FuzzerPlatformProcess(otInstance *aInstance)
94 {
95     if (sRadioState == OT_RADIO_STATE_TRANSMIT)
96     {
97         sRadioState = OT_RADIO_STATE_RECEIVE;
98 
99         if (otMacFrameIsAckRequested(&sRadioTransmitFrame))
100         {
101             sRadioAckFrame.mLength  = IEEE802154_ACK_LENGTH;
102             sRadioAckFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK;
103             sRadioAckFrame.mPsdu[1] = 0;
104             sRadioAckFrame.mPsdu[2] = otMacFrameGetSequence(&sRadioTransmitFrame);
105             sRadioAckFrame.mChannel = sRadioTransmitFrame.mChannel;
106 
107             otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, &sRadioAckFrame, OT_ERROR_NONE);
108         }
109         else
110         {
111             otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, nullptr, OT_ERROR_NONE);
112         }
113     }
114 
115     if (sAlarmMilli.isRunning || sAlarmMicro.isRunning)
116     {
117         uint32_t fire = UINT32_MAX;
118 
119         if (sAlarmMilli.isRunning && fire > sAlarmMilli.fire)
120         {
121             fire = sAlarmMilli.fire;
122         }
123 
124         if (sAlarmMicro.isRunning && fire > sAlarmMicro.fire)
125         {
126             fire = sAlarmMicro.fire;
127         }
128 
129         sAlarmNow = fire;
130 
131         if (sAlarmMilli.isRunning && sAlarmNow >= sAlarmMilli.fire)
132         {
133             sAlarmMilli.isRunning = false;
134             otPlatAlarmMilliFired(aInstance);
135         }
136 
137 #if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
138         if (sAlarmMicro.isRunning && sAlarmNow >= sAlarmMicro.fire)
139         {
140             sAlarmMicro.isRunning = false;
141             otPlatAlarmMicroFired(aInstance);
142         }
143 #endif
144     }
145 }
146 
FuzzerPlatformResetWasRequested(void)147 bool FuzzerPlatformResetWasRequested(void)
148 {
149     return sResetWasRequested;
150 }
151 
otPlatAlarmMilliGetNow(void)152 uint32_t otPlatAlarmMilliGetNow(void)
153 {
154     return sAlarmNow / 1000;
155 }
156 
otPlatAlarmMilliStartAt(otInstance * aInstance,uint32_t aT0,uint32_t aDt)157 void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
158 {
159     OT_UNUSED_VARIABLE(aInstance);
160 
161     sAlarmMilli.fire      = (aT0 + aDt) * 1000;
162     sAlarmMilli.isRunning = true;
163 }
164 
otPlatAlarmMilliStop(otInstance * aInstance)165 void otPlatAlarmMilliStop(otInstance *aInstance)
166 {
167     OT_UNUSED_VARIABLE(aInstance);
168 
169     sAlarmMilli.isRunning = false;
170 }
171 
otPlatAlarmMicroGetNow(void)172 uint32_t otPlatAlarmMicroGetNow(void)
173 {
174     return sAlarmNow;
175 }
176 
otPlatAlarmMicroStartAt(otInstance * aInstance,uint32_t aT0,uint32_t aDt)177 void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
178 {
179     OT_UNUSED_VARIABLE(aInstance);
180 
181     sAlarmMicro.fire      = aT0 + aDt;
182     sAlarmMicro.isRunning = true;
183 }
184 
otPlatAlarmMicroStop(otInstance * aInstance)185 void otPlatAlarmMicroStop(otInstance *aInstance)
186 {
187     OT_UNUSED_VARIABLE(aInstance);
188 
189     sAlarmMicro.isRunning = false;
190 }
191 
otDiagIsEnabled(otInstance * aInstance)192 bool otDiagIsEnabled(otInstance *aInstance)
193 {
194     OT_UNUSED_VARIABLE(aInstance);
195 
196     return false;
197 }
198 
otDiagProcessCmd(otInstance * aInstance,uint8_t aArgsLength,char * aArgs[],char * aOutput,size_t aOutputMaxLen)199 otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen)
200 {
201     OT_UNUSED_VARIABLE(aInstance);
202     OT_UNUSED_VARIABLE(aArgsLength);
203     OT_UNUSED_VARIABLE(aArgs);
204     OT_UNUSED_VARIABLE(aOutput);
205     OT_UNUSED_VARIABLE(aOutputMaxLen);
206 
207     return OT_ERROR_NOT_IMPLEMENTED;
208 }
209 
otDiagProcessCmdLine(otInstance * aInstance,const char * aString,char * aOutput,size_t aOutputMaxLen)210 void otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen)
211 {
212     OT_UNUSED_VARIABLE(aInstance);
213     OT_UNUSED_VARIABLE(aString);
214     OT_UNUSED_VARIABLE(aOutput);
215     OT_UNUSED_VARIABLE(aOutputMaxLen);
216 }
217 
otPlatReset(otInstance * aInstance)218 void otPlatReset(otInstance *aInstance)
219 {
220     OT_UNUSED_VARIABLE(aInstance);
221 
222     sResetWasRequested = true;
223 }
224 
otPlatGetResetReason(otInstance * aInstance)225 otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
226 {
227     OT_UNUSED_VARIABLE(aInstance);
228     return OT_PLAT_RESET_REASON_POWER_ON;
229 }
230 
otPlatLog(otLogLevel aLogLevel,otLogRegion aLogRegion,const char * aFormat,...)231 void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
232 {
233     OT_UNUSED_VARIABLE(aLogLevel);
234     OT_UNUSED_VARIABLE(aLogRegion);
235     OT_UNUSED_VARIABLE(aFormat);
236 }
237 
otPlatWakeHost(void)238 void otPlatWakeHost(void)
239 {
240 }
241 
otPlatRadioGetIeeeEui64(otInstance * aInstance,uint8_t * aIeeeEui64)242 void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
243 {
244     OT_UNUSED_VARIABLE(aInstance);
245     OT_UNUSED_VARIABLE(aIeeeEui64);
246 }
247 
otPlatRadioSetPanId(otInstance * aInstance,uint16_t aPanId)248 void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
249 {
250     OT_UNUSED_VARIABLE(aInstance);
251     OT_UNUSED_VARIABLE(aPanId);
252 }
253 
otPlatRadioSetExtendedAddress(otInstance * aInstance,const otExtAddress * aExtAddr)254 void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddr)
255 {
256     OT_UNUSED_VARIABLE(aInstance);
257     OT_UNUSED_VARIABLE(aExtAddr);
258 }
259 
otPlatRadioSetShortAddress(otInstance * aInstance,uint16_t aShortAddress)260 void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aShortAddress)
261 {
262     OT_UNUSED_VARIABLE(aInstance);
263     OT_UNUSED_VARIABLE(aShortAddress);
264 }
265 
otPlatRadioSetPromiscuous(otInstance * aInstance,bool aEnabled)266 void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnabled)
267 {
268     OT_UNUSED_VARIABLE(aInstance);
269     OT_UNUSED_VARIABLE(aEnabled);
270 }
271 
otPlatRadioIsEnabled(otInstance * aInstance)272 bool otPlatRadioIsEnabled(otInstance *aInstance)
273 {
274     OT_UNUSED_VARIABLE(aInstance);
275     return true;
276 }
277 
otPlatRadioEnable(otInstance * aInstance)278 otError otPlatRadioEnable(otInstance *aInstance)
279 {
280     OT_UNUSED_VARIABLE(aInstance);
281 
282     sRadioState = OT_RADIO_STATE_SLEEP;
283 
284     return OT_ERROR_NONE;
285 }
286 
otPlatRadioDisable(otInstance * aInstance)287 otError otPlatRadioDisable(otInstance *aInstance)
288 {
289     OT_UNUSED_VARIABLE(aInstance);
290 
291     sRadioState = OT_RADIO_STATE_DISABLED;
292 
293     return OT_ERROR_NONE;
294 }
295 
otPlatRadioSleep(otInstance * aInstance)296 otError otPlatRadioSleep(otInstance *aInstance)
297 {
298     OT_UNUSED_VARIABLE(aInstance);
299 
300     sRadioState = OT_RADIO_STATE_SLEEP;
301 
302     return OT_ERROR_NONE;
303 }
304 
otPlatRadioReceive(otInstance * aInstance,uint8_t aChannel)305 otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
306 {
307     OT_UNUSED_VARIABLE(aInstance);
308     OT_UNUSED_VARIABLE(aChannel);
309 
310     sRadioState = OT_RADIO_STATE_RECEIVE;
311 
312     return OT_ERROR_NONE;
313 }
314 
otPlatRadioTransmit(otInstance * aInstance,otRadioFrame * aFrame)315 otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
316 {
317     sRadioState = OT_RADIO_STATE_TRANSMIT;
318 
319     otPlatRadioTxStarted(aInstance, aFrame);
320 
321     return OT_ERROR_NONE;
322 }
323 
otPlatRadioGetTransmitPower(otInstance * aInstance,int8_t * aPower)324 otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
325 {
326     OT_UNUSED_VARIABLE(aInstance);
327     OT_UNUSED_VARIABLE(aPower);
328     return OT_ERROR_NONE;
329 }
330 
otPlatRadioGetTransmitBuffer(otInstance * aInstance)331 otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
332 {
333     OT_UNUSED_VARIABLE(aInstance);
334     return &sRadioTransmitFrame;
335 }
336 
otPlatRadioGetRssi(otInstance * aInstance)337 int8_t otPlatRadioGetRssi(otInstance *aInstance)
338 {
339     OT_UNUSED_VARIABLE(aInstance);
340     return 0;
341 }
342 
otPlatRadioGetCaps(otInstance * aInstance)343 otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
344 {
345     OT_UNUSED_VARIABLE(aInstance);
346     return OT_RADIO_CAPS_NONE;
347 }
348 
otPlatRadioGetPromiscuous(otInstance * aInstance)349 bool otPlatRadioGetPromiscuous(otInstance *aInstance)
350 {
351     OT_UNUSED_VARIABLE(aInstance);
352     return false;
353 }
354 
otPlatRadioEnableSrcMatch(otInstance * aInstance,bool aEnable)355 void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
356 {
357     OT_UNUSED_VARIABLE(aInstance);
358     OT_UNUSED_VARIABLE(aEnable);
359 }
360 
otPlatRadioAddSrcMatchShortEntry(otInstance * aInstance,uint16_t aShortAddress)361 otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
362 {
363     OT_UNUSED_VARIABLE(aInstance);
364     OT_UNUSED_VARIABLE(aShortAddress);
365     return OT_ERROR_NONE;
366 }
367 
otPlatRadioAddSrcMatchExtEntry(otInstance * aInstance,const otExtAddress * aExtAddress)368 otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
369 {
370     OT_UNUSED_VARIABLE(aInstance);
371     OT_UNUSED_VARIABLE(aExtAddress);
372     return OT_ERROR_NONE;
373 }
374 
otPlatRadioClearSrcMatchShortEntry(otInstance * aInstance,uint16_t aShortAddress)375 otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
376 {
377     OT_UNUSED_VARIABLE(aInstance);
378     OT_UNUSED_VARIABLE(aShortAddress);
379     return OT_ERROR_NONE;
380 }
381 
otPlatRadioClearSrcMatchExtEntry(otInstance * aInstance,const otExtAddress * aExtAddress)382 otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
383 {
384     OT_UNUSED_VARIABLE(aInstance);
385     OT_UNUSED_VARIABLE(aExtAddress);
386     return OT_ERROR_NONE;
387 }
388 
otPlatRadioClearSrcMatchShortEntries(otInstance * aInstance)389 void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
390 {
391     OT_UNUSED_VARIABLE(aInstance);
392 }
393 
otPlatRadioClearSrcMatchExtEntries(otInstance * aInstance)394 void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
395 {
396     OT_UNUSED_VARIABLE(aInstance);
397 }
398 
otPlatRadioEnergyScan(otInstance * aInstance,uint8_t aScanChannel,uint16_t aScanDuration)399 otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
400 {
401     OT_UNUSED_VARIABLE(aInstance);
402     OT_UNUSED_VARIABLE(aScanChannel);
403     OT_UNUSED_VARIABLE(aScanDuration);
404     return OT_ERROR_NOT_IMPLEMENTED;
405 }
406 
otPlatRadioSetTransmitPower(otInstance * aInstance,int8_t aPower)407 otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
408 {
409     OT_UNUSED_VARIABLE(aInstance);
410     OT_UNUSED_VARIABLE(aPower);
411     return OT_ERROR_NOT_IMPLEMENTED;
412 }
413 
otPlatRadioGetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t * aThreshold)414 otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
415 {
416     OT_UNUSED_VARIABLE(aInstance);
417     OT_UNUSED_VARIABLE(aThreshold);
418     return OT_ERROR_NOT_IMPLEMENTED;
419 }
420 
otPlatRadioSetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t aThreshold)421 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
422 {
423     OT_UNUSED_VARIABLE(aInstance);
424     OT_UNUSED_VARIABLE(aThreshold);
425     return OT_ERROR_NOT_IMPLEMENTED;
426 }
427 
otPlatRadioGetReceiveSensitivity(otInstance * aInstance)428 int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
429 {
430     OT_UNUSED_VARIABLE(aInstance);
431     return 0;
432 }
433 
otPlatEntropyGet(uint8_t * aOutput,uint16_t aOutputLength)434 otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
435 {
436     for (uint16_t length = 0; length < aOutputLength; length++)
437     {
438         aOutput[length] = (uint8_t)rand();
439     }
440 
441     return OT_ERROR_NONE;
442 }
443 
otPlatSettingsInit(otInstance * aInstance)444 void otPlatSettingsInit(otInstance *aInstance)
445 {
446     OT_UNUSED_VARIABLE(aInstance);
447 }
448 
otPlatSettingsDeinit(otInstance * aInstance)449 void otPlatSettingsDeinit(otInstance *aInstance)
450 {
451     OT_UNUSED_VARIABLE(aInstance);
452 }
453 
otPlatSettingsGet(otInstance * aInstance,uint16_t aKey,int aIndex,uint8_t * aValue,uint16_t * aValueLength)454 otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
455 {
456     OT_UNUSED_VARIABLE(aInstance);
457     OT_UNUSED_VARIABLE(aKey);
458     OT_UNUSED_VARIABLE(aIndex);
459     OT_UNUSED_VARIABLE(aValue);
460     OT_UNUSED_VARIABLE(aValueLength);
461     return OT_ERROR_NOT_FOUND;
462 }
463 
otPlatSettingsSet(otInstance * aInstance,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)464 otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
465 {
466     OT_UNUSED_VARIABLE(aInstance);
467     OT_UNUSED_VARIABLE(aKey);
468     OT_UNUSED_VARIABLE(aValue);
469     OT_UNUSED_VARIABLE(aValueLength);
470     return OT_ERROR_NONE;
471 }
472 
otPlatSettingsAdd(otInstance * aInstance,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)473 otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
474 {
475     OT_UNUSED_VARIABLE(aInstance);
476     OT_UNUSED_VARIABLE(aKey);
477     OT_UNUSED_VARIABLE(aValue);
478     OT_UNUSED_VARIABLE(aValueLength);
479     return OT_ERROR_NONE;
480 }
481 
otPlatSettingsDelete(otInstance * aInstance,uint16_t aKey,int aIndex)482 otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
483 {
484     OT_UNUSED_VARIABLE(aInstance);
485     OT_UNUSED_VARIABLE(aKey);
486     OT_UNUSED_VARIABLE(aIndex);
487     return OT_ERROR_NONE;
488 }
489 
otPlatSettingsWipe(otInstance * aInstance)490 void otPlatSettingsWipe(otInstance *aInstance)
491 {
492     OT_UNUSED_VARIABLE(aInstance);
493 }
494 
otPlatDiagProcess(otInstance * aInstance,uint8_t aArgsLength,char * aArgs[],char * aOutput,size_t aOutputMaxLen)495 otError otPlatDiagProcess(otInstance *aInstance,
496                           uint8_t     aArgsLength,
497                           char *      aArgs[],
498                           char *      aOutput,
499                           size_t      aOutputMaxLen)
500 {
501     OT_UNUSED_VARIABLE(aInstance);
502     OT_UNUSED_VARIABLE(aArgsLength);
503     OT_UNUSED_VARIABLE(aArgs);
504     OT_UNUSED_VARIABLE(aOutput);
505     OT_UNUSED_VARIABLE(aOutputMaxLen);
506 
507     return OT_ERROR_INVALID_COMMAND;
508 }
509 
otPlatDiagModeSet(bool aMode)510 void otPlatDiagModeSet(bool aMode)
511 {
512     OT_UNUSED_VARIABLE(aMode);
513 }
514 
otPlatDiagModeGet(void)515 bool otPlatDiagModeGet(void)
516 {
517     return false;
518 }
519 
otPlatDiagChannelSet(uint8_t aChannel)520 void otPlatDiagChannelSet(uint8_t aChannel)
521 {
522     OT_UNUSED_VARIABLE(aChannel);
523 }
524 
otPlatDiagTxPowerSet(int8_t aTxPower)525 void otPlatDiagTxPowerSet(int8_t aTxPower)
526 {
527     OT_UNUSED_VARIABLE(aTxPower);
528 }
529 
otPlatDiagRadioReceived(otInstance * aInstance,otRadioFrame * aFrame,otError aError)530 void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
531 {
532     OT_UNUSED_VARIABLE(aInstance);
533     OT_UNUSED_VARIABLE(aFrame);
534     OT_UNUSED_VARIABLE(aError);
535 }
536 
otPlatDiagAlarmCallback(otInstance * aInstance)537 void otPlatDiagAlarmCallback(otInstance *aInstance)
538 {
539     OT_UNUSED_VARIABLE(aInstance);
540 }
541