1 /***************************************************************************/ /**
2  * @file  sl_wifi_host_interface.h
3  * @brief This file defines the host interface for Wi-Fi operations.
4  *******************************************************************************
5  * # License
6  * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
7  *******************************************************************************
8  *
9  * SPDX-License-Identifier: Zlib
10  *
11  * The licensor of this software is Silicon Laboratories Inc.
12  *
13  * This software is provided 'as-is', without any express or implied
14  * warranty. In no event will the authors be held liable for any damages
15  * arising from the use of this software.
16  *
17  * Permission is granted to anyone to use this software for any purpose,
18  * including commercial applications, and to alter it and redistribute it
19  * freely, subject to the following restrictions:
20  *
21  * 1. The origin of this software must not be misrepresented; you must not
22  *    claim that you wrote the original software. If you use this software
23  *    in a product, an acknowledgment in the product documentation would be
24  *    appreciated but is not required.
25  * 2. Altered source versions must be plainly marked as such, and must not be
26  *    misrepresented as being the original software.
27  * 3. This notice may not be removed or altered from any source distribution.
28  *
29  ******************************************************************************/
30 
31 #pragma once
32 
33 #include "sl_status.h"
34 #include "sl_slist.h"
35 #include "sl_common.h"
36 #include <stdbool.h>
37 #include <stdint.h>
38 
39 /** \addtogroup SL_WIFI_TYPES
40   * @{ */
41 
42 /**
43  * @enum sl_wifi_buffer_type_t
44  * @brief Enumeration for types of Wi-Fi buffers.
45  */
46 typedef enum {
47   SL_WIFI_TX_FRAME_BUFFER,    ///< Buffer for sending socket data to NWP
48   SL_WIFI_RX_FRAME_BUFFER,    ///< Buffer for storing response from NWP
49   SL_WIFI_CONTROL_BUFFER,     ///< Buffer for sending command to NWP
50   SL_WIFI_SCAN_RESULT_BUFFER, ///< Buffer for storing scan results
51 } sl_wifi_buffer_type_t;
52 
53 /**
54  * @struct sl_wifi_buffer_t
55  * @brief Structure representing a Wi-Fi buffer.
56  */
57 typedef struct {
58   sl_slist_node_t node; ///< Pointer to the node of the list of which the buffer is part of
59   uint32_t length;      ///< Size of the buffer in bytes
60   uint8_t
61     type; ///< Indicates the buffer type (SL_WIFI_TX_FRAME_BUFFER, SL_WIFI_RX_FRAME_BUFFER, and so on.) corresponding to the buffer.
62   uint8_t id;           ///< Buffer identifier. Can be used to uniquely identify a buffer. Loops every 256 packets.
63   uint8_t _reserved[2]; ///< Reserved.
64   uint8_t data[];       ///< Stores the data (header + payload) to be send to NWP
65 } sl_wifi_buffer_t;
66 
67 /**
68  * @struct sl_wifi_buffer_configuration_t
69  * @brief Structure representing the Wi-Fi buffer configuration.
70  */
71 typedef struct {
72   uint8_t tx_buffer_quota;      ///< Indicates the limit on buffers used for sending the data to NWP
73   uint8_t rx_buffer_quota;      ///< Indicates the limit on buffers used for storing the response from NWP
74   uint8_t control_buffer_quota; ///< Indicates the limit on buffers used for sending the command to NWP
75   uint32_t block_size;          ///< Indicates the block size in bytes
76   void *buffer_memory;          ///< Pointer to the chunk of memory allocated on the first invocation of malloc
77 } sl_wifi_buffer_configuration_t;
78 
79 /** @} */
80