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_IEEE802154_CARRIER_FUNCTIONS) 74 /** 75 * Start/stop continuous carrier wave transmission. 76 */ 77 otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable); 78 #endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */ 79 80 #if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS) 81 /** 82 * Start/stop modulated carrier wave transmission. 83 */ 84 otError platformRadioTransmitModulatedCarrier(otInstance *aInstance, bool aEnable, 85 const uint8_t *aData); 86 #endif 87 88 /** 89 * This function initializes the random number service used by OpenThread. 90 * 91 */ 92 void platformRandomInit(void); 93 94 /** 95 * Initialize platform Shell driver. 96 */ 97 void platformShellInit(otInstance *aInstance); 98 99 100 /** 101 * Notify OpenThread task about new rx message. 102 */ 103 int notify_new_rx_frame(struct net_pkt *pkt); 104 105 /** 106 * Notify OpenThread task about new tx message. 107 */ 108 int notify_new_tx_frame(struct net_pkt *pkt); 109 110 #endif /* PLATFORM_POSIX_H_ */ 111