1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @brief Header containing OS interface specific declarations for the
9  * Zephyr OS layer of the Wi-Fi driver.
10  */
11 
12 #ifndef __SHIM_H__
13 #define __SHIM_H__
14 
15 #include <zephyr/kernel.h>
16 #include <zephyr/drivers/gpio.h>
17 #include <zephyr/net/net_pkt.h>
18 
19 /**
20  * struct zep_shim_bus_qspi_priv - Structure to hold context information for the Linux OS
21  *                        shim.
22  * @pcie_callbk_data: Callback data to be passed to the PCIe callback functions.
23  * @pcie_prb_callbk: The callback function to be called when a PCIe device
24  *                   has been probed.
25  * @pcie_rem_callbk: The callback function to be called when a PCIe device
26  *                   has been removed.
27  *
28  * This structure maintains the context information necessary for the operation
29  * of the Linux shim. Some of the elements of the structure need to be
30  * initialized during the initialization of the Linux shim while others need to
31  * be kept updated over the duration of the Linux shim operation.
32  */
33 struct zep_shim_bus_qspi_priv {
34 	void *qspi_dev;
35 
36 	bool dev_added;
37 	bool dev_init;
38 };
39 
40 struct zep_shim_intr_priv {
41 	struct gpio_callback gpio_cb_data;
42 	void *callbk_data;
43 	int (*callbk_fn)(void *callbk_data);
44 	struct k_work_delayable work;
45 };
46 
47 struct zep_shim_llist_node {
48 	sys_dnode_t head;
49 	void *data;
50 };
51 
52 struct zep_shim_llist {
53 	sys_dlist_t head;
54 	unsigned int len;
55 };
56 
57 void *net_pkt_to_nbuf(struct net_pkt *pkt);
58 void *net_pkt_from_nbuf(void *iface, void *frm);
59 #if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
60 void *net_raw_pkt_from_nbuf(void *iface,
61 			    void *frm,
62 			    unsigned short raw_hdr_len,
63 			    void *raw_rx_hdr,
64 			    bool pkt_free);
65 #endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
66 
67 #endif /* __SHIM_H__ */
68