Change script for apply upstream code
[platform/upstream/connectedhomeip.git] / third_party / openthread / repo / examples / platforms / efr32mg13 / platform-band.h
1 /*
2  *  Copyright (c) 2020, 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 /**
30  * @file
31  *   This file defines the frequency band configuration structure for efr32.
32  *
33  */
34
35 #ifndef PLATFORM_BAND_H_
36 #define PLATFORM_BAND_H_
37
38 #include <openthread/platform/radio.h>
39
40 #include "rail.h"
41 #include "rail_config.h"
42 #include "rail_ieee802154.h"
43
44 #define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
45
46 #define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
47 #define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
48 #define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
49 #define RADIO_SCHEDULER_TX_PRIORITY 100
50 #define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
51
52 #define RADIO_TIMING_CSMA_OVERHEAD_US 500
53 #define RADIO_TIMING_DEFAULT_BYTETIME_US 32   // only used if RAIL_GetBitRate returns 0
54 #define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
55
56 typedef struct efr32RadioCounters
57 {
58     uint64_t mRailPlatTxTriggered;
59     uint64_t mRailPlatRadioReceiveDoneCbCount;
60     uint64_t mRailPlatRadioEnergyScanDoneCbCount;
61     uint64_t mRailPlatRadioTxDoneCbCount;
62     uint64_t mRailTxStarted;
63     uint64_t mRailTxStartFailed;
64     uint64_t mRailEventConfigScheduled;
65     uint64_t mRailEventConfigUnScheduled;
66     uint64_t mRailEventPacketSent;
67     uint64_t mRailEventChannelBusy;
68     uint64_t mRailEventEnergyScanCompleted;
69     uint64_t mRailEventCalNeeded;
70     uint64_t mRailEventPacketReceived;
71     uint64_t mRailEventNoAck;
72     uint64_t mRailEventTxAbort;
73     uint64_t mRailEventSchedulerStatusError;
74     uint64_t mRailEventsSchedulerStatusTransmitBusy;
75     uint32_t mRailEventsSchedulerStatusLastStatus;
76 } efr32RadioCounters;
77
78 typedef struct efr32CommonConfig
79 {
80     RAIL_Config_t mRailConfig;
81 #if RADIO_CONFIG_DMP_SUPPORT
82     RAILSched_Config_t railSchedState;
83 #endif
84     uint8_t
85         mRailTxFifo[RAIL_TX_FIFO_SIZE]; // must be 2 power between 64 and 4096, and bigger than OT_RADIO_FRAME_MAX_SIZE
86 } efr32CommonConfig;
87
88 typedef struct efr32BandConfig
89 {
90     const RAIL_ChannelConfig_t *mChannelConfig;
91     uint8_t                     mChannelMin;
92     uint8_t                     mChannelMax;
93 } efr32BandConfig;
94
95 #endif // PLATFORM_BAND_H_