2 * Copyright (c) 2019, The OpenThread Authors.
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.
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.
31 * This file includes the platform-specific initializers.
35 #ifndef PLATFORM_EFR32_H_
36 #define PLATFORM_EFR32_H_
38 #include <openthread/instance.h>
40 #include "em_device.h"
41 #include "em_system.h"
43 #include "core_cm33.h"
46 // Global OpenThread instance structure
47 extern otInstance *sInstance;
49 // Global reference to rail handle
50 extern RAIL_Handle_t gRailHandle;
53 * This function initializes the alarm service used by OpenThread.
56 void efr32AlarmInit(void);
59 * This function performs alarm driver processing.
61 * @param[in] aInstance The OpenThread instance structure.
64 void efr32AlarmProcess(otInstance *aInstance);
67 * This function initializes the radio service used by OpenThead.
70 void efr32RadioInit(void);
73 * This function deinitializes the radio service used by OpenThead.
76 void efr32RadioDeinit(void);
79 * This function performs radio driver processing.
81 * @param[in] aInstance The OpenThread instance structure.
84 void efr32RadioProcess(otInstance *aInstance);
87 * This function performs UART driver processing.
90 void efr32UartProcess(void);
93 * Initialization of Misc module.
96 void efr32MiscInit(void);
99 * Initialization of ADC module for random number generator.
102 void efr32RandomInit(void);
105 * Initialization of Logger driver.
108 void efr32LogInit(void);
111 * Deinitialization of Logger driver.
114 void efr32LogDeinit(void);
117 * Registers the sleep callback handler. The callback is used to check that
118 * the application has no work pending and that it is safe to put the EFR32
119 * into a low energy sleep mode.
121 * The callback should return true if it is ok to enter sleep mode. Note
122 * that the callback itself is run with interrupts disabled and so should
123 * be kept as short as possible. Anny interrupt including those from timers
124 * will wake the EFR32 out of sleep mode.
126 * @param[in] aCallback Callback function.
129 void efr32SetSleepCallback(bool (*aCallback)(void), void (*aCallbackWake)(void));
132 * Put the EFR32 into a low power mode. Before sleeping it will call a callback
133 * in the application registered with efr32SetSleepCallback to ensure that there
134 * is no outstanding work in the application to do.
136 void efr32Sleep(void);
138 #endif // PLATFORM_EFR32_H_