1 /*
2  * Copyright (c) 2018 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief
10  *   This file includes the Zephyr platform-specific initializers.
11  */
12 
13 #ifndef PLATFORM_ZEPHYR_H_
14 #define PLATFORM_ZEPHYR_H_
15 
16 #include <stdint.h>
17 
18 #include <openthread/instance.h>
19 #include <zephyr/net/net_pkt.h>
20 
21 /**
22  * This function initializes the alarm service used by OpenThread.
23  *
24  */
25 void platformAlarmInit(void);
26 
27 /**
28  * This function performs alarm driver processing.
29  *
30  * @param[in]  aInstance  The OpenThread instance structure.
31  *
32  */
33 void platformAlarmProcess(otInstance *aInstance);
34 
35 /**
36  * This function initializes the radio service used by OpenThread.
37  *
38  */
39 void platformRadioInit(void);
40 
41 /**
42  * This function performs radio driver processing.
43  *
44  * @param[in]  aInstance  The OpenThread instance structure.
45  *
46  */
47 void platformRadioProcess(otInstance *aInstance);
48 
49 /**
50  * This function performs UART driver processing.
51  *
52  * @param[in]  aInstance  The OpenThread instance structure.
53  *
54  */
55 void platformUartProcess(otInstance *aInstance);
56 
57 /**
58  * Outer component calls this method to notify UART driver that it should
59  * switch to panic mode and work in synchronous way.
60  */
61 void platformUartPanic(void);
62 
63 /**
64  * Get current channel from radio driver.
65  *
66  * @param[in]  aInstance  The OpenThread instance structure.
67  *
68  * @return Current channel radio driver operates on.
69  *
70  */
71 uint16_t platformRadioChannelGet(otInstance *aInstance);
72 
73 #if defined(CONFIG_OPENTHREAD_DIAG)
74 /**
75  * Set channel on radio driver.
76  *
77  * @param[in]  aChannel  The channel that the radio driver should use for operation.
78  *
79  */
80 void platformRadioChannelSet(uint8_t aChannel);
81 #endif /* CONFIG_OPENTHREAD_DIAG */
82 
83 #if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
84 /**
85  * Start/stop continuous carrier wave transmission.
86  */
87 otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable);
88 #endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */
89 
90 #if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
91 /**
92  * Start/stop modulated carrier wave transmission.
93  */
94 otError platformRadioTransmitModulatedCarrier(otInstance *aInstance, bool aEnable,
95 					      const uint8_t *aData);
96 #endif
97 
98 /**
99  * This function initializes the random number service used by OpenThread.
100  *
101  */
102 void platformRandomInit(void);
103 
104 /**
105  *  Initialize platform Shell driver.
106  */
107 void platformShellInit(otInstance *aInstance);
108 
109 
110 /**
111  * Notify OpenThread task about new rx message.
112  */
113 int notify_new_rx_frame(struct net_pkt *pkt);
114 
115 /**
116  * Notify OpenThread task about new tx message.
117  */
118 int notify_new_tx_frame(struct net_pkt *pkt);
119 
120 #endif /* PLATFORM_ZEPHYR_H_ */
121