1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file osal_structs.h 9 * @brief Structure declarations for the OSAL Layer of the Wi-Fi driver. 10 */ 11 12 #ifndef __OSAL_STRUCTS_H__ 13 #define __OSAL_STRUCTS_H__ 14 15 #ifdef __ZEPHYR__ 16 #include <stddef.h> 17 #include <stdbool.h> 18 #include <stdarg.h> 19 #elif __KERNEL__ 20 /* For Linux, use kernel internal headers instead of C headers*/ 21 #include <linux/stddef.h> 22 #include <linux/string.h> 23 #include <linux/version.h> 24 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) 25 #undef strlen 26 #include <linux/stdarg.h> 27 #else 28 #include <stdarg.h> 29 #endif 30 #else 31 #include <stddef.h> 32 #include <stdbool.h> 33 #include <stdarg.h> 34 #endif 35 36 /** 37 * @brief The status of an operation performed by the RPU driver. 38 */ 39 enum nrf_wifi_status { 40 /** The operation was successful. */ 41 NRF_WIFI_STATUS_SUCCESS, 42 /** The operation failed. */ 43 NRF_WIFI_STATUS_FAIL = -1 44 }; 45 46 /** 47 * @brief DMA direction for a DMA operation. 48 */ 49 enum nrf_wifi_osal_dma_dir { 50 /** Data needs to be DMAed to the device. */ 51 NRF_WIFI_OSAL_DMA_DIR_TO_DEV, 52 /** Data needs to be DMAed from the device. */ 53 NRF_WIFI_OSAL_DMA_DIR_FROM_DEV, 54 /** Data can be DMAed in either direction i.e to or from the device. */ 55 NRF_WIFI_OSAL_DMA_DIR_BIDI 56 }; 57 58 /** 59 * @brief The type of a tasklet. 60 */ 61 enum nrf_wifi_tasklet_type { 62 /** The tasklet is a bottom half tasklet i.e it is scheduled from an interrupt context used 63 * for all except TX done tasklets. 64 */ 65 NRF_WIFI_TASKLET_TYPE_BH, 66 /** The tasklet is an IRQ tasklet. It is scheduled from the Bus ISR, used internally by the 67 * SHIM layer. 68 */ 69 NRF_WIFI_TASKLET_TYPE_IRQ, 70 /** The tasklet is a TX done tasklet. It is scheduled from the BH tasklet for TX done 71 * interrupts. 72 */ 73 NRF_WIFI_TASKLET_TYPE_TX_DONE, 74 /** The tasklet is an RX tasklet. It is scheduled from the BH tasklet for RX interrupts. */ 75 NRF_WIFI_TASKLET_TYPE_RX, 76 /** The maximum number of tasklet types. */ 77 NRF_WIFI_TASKLET_TYPE_MAX 78 }; 79 80 /** 81 * @brief Structure representing a host map. 82 */ 83 struct nrf_wifi_osal_host_map { 84 /** The address of the host map. */ 85 unsigned long addr; 86 /** The size of the host map. */ 87 unsigned long size; 88 }; 89 90 /** 91 * @brief Structure representing the private data of the OSAL layer. 92 */ 93 struct nrf_wifi_osal_priv { 94 /** Pointer to the OSAL operations. */ 95 const struct nrf_wifi_osal_ops *ops; 96 }; 97 98 /** 99 * @brief The type of assertion operation to be performed. 100 */ 101 enum nrf_wifi_assert_op_type { 102 /** The assertion check for equality. */ 103 NRF_WIFI_ASSERT_EQUAL_TO, 104 /** The assertion check for non-equality. */ 105 NRF_WIFI_ASSERT_NOT_EQUAL_TO, 106 /** The assertion check for lesser value. */ 107 NRF_WIFI_ASSERT_LESS_THAN, 108 /** The assertion check for equal or lesser. */ 109 NRF_WIFI_ASSERT_LESS_THAN_EQUAL_TO, 110 /** The assertion check for condition of more than value. */ 111 NRF_WIFI_ASSERT_GREATER_THAN, 112 /** The assertion check for condition equal or more than value. */ 113 NRF_WIFI_ASSERT_GREATER_THAN_EQUAL_TO 114 }; 115 116 #endif /* __OSAL_STRUCTS_H__ */ 117