1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file hal_mem.h 9 * 10 * @brief Header containing memory read/write specific declarations for the 11 * HAL Layer of the Wi-Fi driver. 12 */ 13 14 #ifndef __HAL_MEM_H__ 15 #define __HAL_MEM_H__ 16 17 #include "hal_api_common.h" 18 19 /** 20 * Enum defining the types of RPU memory. 21 */ 22 enum HAL_RPU_MEM_TYPE { 23 /** GRAM memory type */ 24 HAL_RPU_MEM_TYPE_GRAM, 25 /** PKTRAM memory type */ 26 HAL_RPU_MEM_TYPE_PKTRAM, 27 /** Core ROM memory type */ 28 HAL_RPU_MEM_TYPE_CORE_ROM, 29 /** Core RET memory type */ 30 HAL_RPU_MEM_TYPE_CORE_RET, 31 /** Core SCRATCH memory type */ 32 HAL_RPU_MEM_TYPE_CORE_SCRATCH, 33 /** Maximum number of memory types */ 34 HAL_RPU_MEM_TYPE_MAX 35 }; 36 37 /** 38 * @brief Read from the RPU memory. 39 * 40 * This function reads a specified number of bytes from the RPU memory and 41 * copies them to the host memory. 42 * 43 * @param hal_ctx Pointer to HAL context. 44 * @param host_addr Pointer to the host memory where the contents read from 45 * the RPU memory are to be copied. 46 * @param rpu_mem_addr Absolute value of the RPU memory address from which the 47 * contents are to be read. 48 * @param len The length (in bytes) of the contents to be read from 49 * the RPU memory. 50 * 51 * @return Status 52 * - Pass: NRF_WIFI_STATUS_SUCCESS 53 * - Error: NRF_WIFI_STATUS_FAIL 54 */ 55 enum nrf_wifi_status hal_rpu_mem_read(struct nrf_wifi_hal_dev_ctx *hal_ctx, 56 void *host_addr, 57 unsigned int rpu_mem_addr, 58 unsigned int len); 59 60 /** 61 * @brief Write to the RPU memory. 62 * 63 * This function writes a specified number of bytes to the RPU memory from the 64 * host memory. 65 * 66 * @param hal_ctx Pointer to HAL context. 67 * @param rpu_mem_addr Absolute value of the RPU memory address where the 68 * contents are to be written. 69 * @param host_addr Pointer to the host memory from where the contents are 70 * to be copied to the RPU memory. 71 * @param len The length (in bytes) of the contents to be copied to 72 * the RPU memory. 73 * 74 * @return Status 75 * - Pass: NRF_WIFI_STATUS_SUCCESS 76 * - Error: NRF_WIFI_STATUS_FAIL 77 */ 78 enum nrf_wifi_status hal_rpu_mem_write(struct nrf_wifi_hal_dev_ctx *hal_ctx, 79 unsigned int rpu_mem_addr, 80 void *host_addr, 81 unsigned int len); 82 83 /** 84 * @brief Clear contents of RPU memory. 85 * 86 * This function fills the RPU memory with zeros. 87 * 88 * @param hal_ctx Pointer to HAL context. 89 * @param rpu_proc The RPU processor for which the memory is to be cleared. 90 * @param mem_type The type of the RPU memory to be cleared. 91 * 92 * @return Status 93 * - Pass: NRF_WIFI_STATUS_SUCCESS 94 * - Error: NRF_WIFI_STATUS_FAIL 95 */ 96 enum nrf_wifi_status hal_rpu_mem_clr(struct nrf_wifi_hal_dev_ctx *hal_ctx, 97 enum RPU_PROC_TYPE rpu_proc, 98 enum HAL_RPU_MEM_TYPE mem_type); 99 100 #endif /* __HAL_MEM_H__ */ 101