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