1 /* 2 * Copyright (c) 2025 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file hal_api.h 9 * 10 * @brief Header containing API declarations for the HAL Layer of the Wi-Fi driver 11 * in the system mode of operation. 12 */ 13 14 #ifndef __HAL_API_SYS_H__ 15 #define __HAL_API_SYS_H__ 16 17 #include "osal_api.h" 18 #include "common/rpu_if.h" 19 #include "bal_api.h" 20 #include "common/hal_structs_common.h" 21 #include "common/hal_mem.h" 22 #include "common/hal_reg.h" 23 #include "common/hal_fw_patch_loader.h" 24 #include "common/hal_api_common.h" 25 26 struct nrf_wifi_hal_dev_ctx *nrf_wifi_sys_hal_dev_add(struct nrf_wifi_hal_priv *hpriv, 27 void *mac_dev_ctx); 28 29 30 void nrf_wifi_sys_hal_lock_rx(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx); 31 32 void nrf_wifi_sys_hal_unlock_rx(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx); 33 34 /** 35 * @brief Send a data command to the RPU. 36 * 37 * @param hal_ctx Pointer to HAL context. 38 * @param cmd_type Type of the data command to send to the RPU. 39 * @param data_cmd The data command to be sent to the RPU. 40 * @param data_cmd_size Size of the data command to be sent to the RPU. 41 * @param desc_id Descriptor ID of the buffer being submitted to RPU. 42 * @param pool_id Pool ID to which the buffer being submitted to RPU belongs. 43 * 44 * This function programs the relevant information about a data command, 45 * to the RPU. These buffers are needed by the RPU to receive data and 46 * management frames as well as to transmit data frames. 47 * 48 * @return The status of the operation. 49 */ 50 enum nrf_wifi_status nrf_wifi_sys_hal_data_cmd_send(struct nrf_wifi_hal_dev_ctx *hal_ctx, 51 enum NRF_WIFI_HAL_MSG_TYPE cmd_type, 52 void *data_cmd, 53 unsigned int data_cmd_size, 54 unsigned int desc_id, 55 unsigned int pool_id); 56 57 /** 58 * @brief Map a receive buffer for the Wi-Fi HAL. 59 * 60 * This function maps a receive buffer to the Wi-Fi HAL device context. 61 * 62 * @param hal_ctx Pointer to the Wi-Fi HAL device context. 63 * @param buf The buffer to be mapped. 64 * @param buf_len The length of the buffer. 65 * @param pool_id The pool ID of the buffer. 66 * @param buf_id The buffer ID. 67 * 68 * @return The status of the operation. 69 */ 70 unsigned long nrf_wifi_sys_hal_buf_map_rx(struct nrf_wifi_hal_dev_ctx *hal_ctx, 71 unsigned long buf, 72 unsigned int buf_len, 73 unsigned int pool_id, 74 unsigned int buf_id); 75 76 /** 77 * @brief Unmap a receive buffer from the Wi-Fi HAL. 78 * 79 * This function unmaps a receive buffer from the Wi-Fi HAL device context. 80 * 81 * @param hal_ctx Pointer to the Wi-Fi HAL device context. 82 * @param data_len The length of the data. 83 * @param pool_id The pool ID of the buffer. 84 * @param buf_id The buffer ID. 85 * 86 * @return The status of the operation. 87 */ 88 unsigned long nrf_wifi_sys_hal_buf_unmap_rx(struct nrf_wifi_hal_dev_ctx *hal_ctx, 89 unsigned int data_len, 90 unsigned int pool_id, 91 unsigned int buf_id); 92 93 /** 94 * @brief Map a transmit buffer for the Wi-Fi HAL. 95 * 96 * This function maps a transmit buffer to the Wi-Fi HAL device context. 97 * 98 * @param hal_ctx Pointer to the Wi-Fi HAL device context. 99 * @param buf The buffer to be mapped. 100 * @param buf_len The length of the buffer. 101 * @param desc_id The descriptor ID. 102 * @param token The token. 103 * @param buf_indx The buffer index. 104 * 105 * @return The status of the operation. 106 */ 107 unsigned long nrf_wifi_sys_hal_buf_map_tx(struct nrf_wifi_hal_dev_ctx *hal_ctx, 108 unsigned long buf, 109 unsigned int buf_len, 110 unsigned int desc_id, 111 unsigned int token, 112 unsigned int buf_indx); 113 114 /** 115 * @brief Unmap a transmit buffer from the Wi-Fi HAL. 116 * 117 * This function unmaps a transmit buffer from the Wi-Fi HAL device context. 118 * 119 * @param hal_ctx Pointer to the Wi-Fi HAL device context. 120 * @param desc_id The descriptor ID. 121 * 122 * @return The status of the operation. 123 */ 124 unsigned long nrf_wifi_sys_hal_buf_unmap_tx(struct nrf_wifi_hal_dev_ctx *hal_ctx, 125 unsigned int desc_id); 126 #endif /* __HAL_API_SYS_H__ */ 127