nRF WiFi
Loading...
Searching...
No Matches
osal_ops.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
12#ifndef __OSAL_OPS_H__
13#define __OSAL_OPS_H__
14
15#include "osal_structs.h"
16
17
34 void *(*mem_alloc)(size_t size);
35
42 void *(*mem_zalloc)(size_t size);
43
49 void (*mem_free)(void *buf);
50
57 void *(*data_mem_zalloc)(size_t size);
58
64 void (*data_mem_free)(void *buf);
65
74 void *(*mem_cpy)(void *dest, const void *src, size_t count);
75
84 void *(*mem_set)(void *start, int val, size_t size);
85
95 int (*mem_cmp)(const void *addr1, const void *addr2, size_t size);
96
104 void *(*iomem_mmap)(unsigned long addr, unsigned long size);
105
111 void (*iomem_unmap)(volatile void *addr);
112
119 unsigned int (*iomem_read_reg32)(const volatile void *addr);
120
127 void (*iomem_write_reg32)(volatile void *addr, unsigned int val);
128
136 void (*iomem_cpy_from)(void *dest, const volatile void *src, size_t count);
137
145 void (*iomem_cpy_to)(volatile void *dest, const void *src, size_t count);
146
154 unsigned int (*qspi_read_reg32)(void *priv, unsigned long addr);
155
163 void (*qspi_write_reg32)(void *priv, unsigned long addr, unsigned int val);
164
173 void (*qspi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count);
174
183 void (*qspi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count);
184
192 unsigned int (*spi_read_reg32)(void *priv, unsigned long addr);
193
201 void (*spi_write_reg32)(void *priv, unsigned long addr, unsigned int val);
202
211 void (*spi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count);
212
221 void (*spi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count);
222
228 void *(*spinlock_alloc)(void);
229
235 void (*spinlock_free)(void *lock);
236
242 void (*spinlock_init)(void *lock);
243
249 void (*spinlock_take)(void *lock);
250
256 void (*spinlock_rel)(void *lock);
257
264 void (*spinlock_irq_take)(void *lock, unsigned long *flags);
265
272 void (*spinlock_irq_rel)(void *lock, unsigned long *flags);
273
281 int (*log_dbg)(const char *fmt, va_list args);
282
290 int (*log_info)(const char *fmt, va_list args);
291
299 int (*log_err)(const char *fmt, va_list args);
300
306 void *(*llist_node_alloc)(void);
307
313 void *(*ctrl_llist_node_alloc)(void);
314
320 void (*llist_node_free)(void *node);
321
327 void (*ctrl_llist_node_free)(void *node);
328
335 void *(*llist_node_data_get)(void *node);
336
343 void (*llist_node_data_set)(void *node, void *data);
344
350 void *(*llist_alloc)(void);
351
357 void *(*ctrl_llist_alloc)(void);
358
364 void (*llist_free)(void *llist);
365
371 void (*ctrl_llist_free)(void *llist);
372
378 void (*llist_init)(void *llist);
379
386 void (*llist_add_node_tail)(void *llist, void *llist_node);
387
394 void (*llist_add_node_head)(void *llist, void *llist_node);
395
402 void *(*llist_get_node_head)(void *llist);
403
411 void *(*llist_get_node_nxt)(void *llist, void *llist_node);
412
419 void (*llist_del_node)(void *llist, void *llist_node);
420
427 unsigned int (*llist_len)(void *llist);
428
435 void *(*nbuf_alloc)(unsigned int size);
436
442 void (*nbuf_free)(void *nbuf);
443
450 void (*nbuf_headroom_res)(void *nbuf, unsigned int size);
451
459 unsigned int (*nbuf_headroom_get)(void *nbuf);
460
467 unsigned int (*nbuf_data_size)(void *nbuf);
468
475 void *(*nbuf_data_get)(void *nbuf);
476
484 void *(*nbuf_data_put)(void *nbuf, unsigned int size);
485
493 void *(*nbuf_data_push)(void *nbuf, unsigned int size);
494
502 void *(*nbuf_data_pull)(void *nbuf, unsigned int size);
503
510 unsigned char (*nbuf_get_priority)(void *nbuf);
511
518 unsigned char (*nbuf_get_chksum_done)(void *nbuf);
519
526 void (*nbuf_set_chksum_done)(void *nbuf, unsigned char chksum_done);
527#if defined(NRF70_RAW_DATA_TX) || defined(__DOXYGEN__)
534 void *(*nbuf_set_raw_tx_hdr)(void *nbuf, unsigned short raw_hdr_len);
541 void *(*nbuf_get_raw_tx_hdr)(void *nbuf);
542
550 bool (*nbuf_is_raw_tx)(void *nbuf);
551#endif /* NRF70_RAW_DATA_TX || __DOXYGEN__ */
558 void *(*tasklet_alloc)(int type);
559
565 void (*tasklet_free)(void *tasklet);
566
574 void (*tasklet_init)(void *tasklet, void (*callback)(unsigned long), unsigned long data);
575
581 void (*tasklet_schedule)(void *tasklet);
582
588 void (*tasklet_kill)(void *tasklet);
589
596 int (*sleep_ms)(int msecs);
597
604 int (*delay_us)(int usecs);
605
611 unsigned long (*time_get_curr_us)(void);
612
619 unsigned int (*time_elapsed_us)(unsigned long start_time);
620
625 unsigned long (*time_get_curr_ms)(void);
626
633 unsigned int (*time_elapsed_ms)(unsigned long start_time_us);
634
645 void *(*bus_pcie_init)(const char *dev_name,
646 unsigned int vendor_id,
647 unsigned int sub_vendor_id,
648 unsigned int device_id,
649 unsigned int sub_device_id);
650
656 void (*bus_pcie_deinit)(void *os_pcie_priv);
657
665 void *(*bus_pcie_dev_add)(void *pcie_priv,
666 void *osal_pcie_dev_ctx);
667
673 void (*bus_pcie_dev_rem)(void *os_pcie_dev_ctx);
674
681 enum nrf_wifi_status (*bus_pcie_dev_init)(void *os_pcie_dev_ctx);
682
688 void (*bus_pcie_dev_deinit)(void *os_pcie_dev_ctx);
689
698 enum nrf_wifi_status (*bus_pcie_dev_intr_reg)(void *os_pcie_dev_ctx,
699 void *callbk_data,
700 int (*callback_fn)(void *callbk_data));
701
707 void (*bus_pcie_dev_intr_unreg)(void *os_pcie_dev_ctx);
708
718 void *(*bus_pcie_dev_dma_map)(void *os_pcie_dev_ctx,
719 void *virt_addr,
720 size_t size,
721 enum nrf_wifi_osal_dma_dir dir);
722
731 void (*bus_pcie_dev_dma_unmap)(void *os_pcie_dev_ctx,
732 void *dma_addr,
733 size_t size,
734 enum nrf_wifi_osal_dma_dir dir);
735
742 void (*bus_pcie_dev_host_map_get)(void *os_pcie_dev_ctx,
743 struct nrf_wifi_osal_host_map *host_map);
744
750 void *(*bus_qspi_init)(void);
751
757 void (*bus_qspi_deinit)(void *os_qspi_priv);
758
766 void *(*bus_qspi_dev_add)(void *qspi_priv,
767 void *osal_qspi_dev_ctx);
768
774 void (*bus_qspi_dev_rem)(void *os_qspi_dev_ctx);
775
782 enum nrf_wifi_status (*bus_qspi_dev_init)(void *os_qspi_dev_ctx);
783
789 void (*bus_qspi_dev_deinit)(void *os_qspi_dev_ctx);
790
799 enum nrf_wifi_status (*bus_qspi_dev_intr_reg)(void *os_qspi_dev_ctx,
800 void *callbk_data,
801 int (*callback_fn)(void *callbk_data));
802
808 void (*bus_qspi_dev_intr_unreg)(void *os_qspi_dev_ctx);
809
816 void (*bus_qspi_dev_host_map_get)(void *os_qspi_dev_ctx,
817 struct nrf_wifi_osal_host_map *host_map);
818
824 void *(*bus_spi_init)(void);
825
831 void (*bus_spi_deinit)(void *os_spi_priv);
832
840 void *(*bus_spi_dev_add)(void *spi_priv,
841 void *osal_spi_dev_ctx);
842
848 void (*bus_spi_dev_rem)(void *os_spi_dev_ctx);
849
856 enum nrf_wifi_status (*bus_spi_dev_init)(void *os_spi_dev_ctx);
857
863 void (*bus_spi_dev_deinit)(void *os_spi_dev_ctx);
864
873 enum nrf_wifi_status (*bus_spi_dev_intr_reg)(void *os_spi_dev_ctx,
874 void *callbk_data,
875 int (*callback_fn)(void *callbk_data));
876
882 void (*bus_spi_dev_intr_unreg)(void *os_spi_dev_ctx);
883
890 void (*bus_spi_dev_host_map_get)(void *os_spi_dev_ctx,
891 struct nrf_wifi_osal_host_map *host_map);
892
893 #if defined(NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
899 void *(*timer_alloc)(void);
900
906 void (*timer_free)(void *timer);
907
915 void (*timer_init)(void *timer,
916 void (*callback)(unsigned long),
917 unsigned long data);
918
925 void (*timer_schedule)(void *timer, unsigned long duration);
926
932 void (*timer_kill)(void *timer);
933
940 int (*bus_qspi_ps_sleep)(void *os_qspi_priv);
941
948 int (*bus_qspi_ps_wake)(void *os_qspi_priv);
949
956 int (*bus_qspi_ps_status)(void *os_qspi_priv);
957 #endif /* NRF_WIFI_LOW_POWER */
958
967 void (*assert)(int test_val,
968 int val,
970 char *assert_msg);
971
978 unsigned int (*strlen)(const void *str);
979
985 unsigned char (*rand8_get)(void);
986};
987#endif /* __OSAL_OPS_H__ */
unsigned char src[6]
Definition fmac_util.h:1
unsigned char dest[6]
Definition host_rpu_data_if.h:5
unsigned int type
Definition host_rpu_umac_if.h:1
nrf_wifi_assert_op_type
The type of assertion operation to be performed.
Definition osal_structs.h:101
nrf_wifi_status
The status of an operation performed by the RPU driver.
Definition osal_structs.h:39
nrf_wifi_osal_dma_dir
DMA direction for a DMA operation.
Definition osal_structs.h:49
Structure declarations for the OSAL Layer of the Wi-Fi driver.
unsigned int addr
Definition rpu_if.h:1
Structure representing a host map.
Definition osal_structs.h:83
enum nrf_wifi_status(* bus_qspi_dev_init)(void *os_qspi_dev_ctx)
Initialize a QSPI device.
Definition osal_ops.h:782
void(* bus_pcie_deinit)(void *os_pcie_priv)
Deinitialize the PCIe bus.
Definition osal_ops.h:656
void(* spi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count)
Copy data from SPI device memory to host memory.
Definition osal_ops.h:211
void(* spinlock_take)(void *lock)
Acquire a spinlock.
Definition osal_ops.h:249
void(* spi_write_reg32)(void *priv, unsigned long addr, unsigned int val)
Write a 32-bit value to a SPI device register.
Definition osal_ops.h:201
void(* bus_pcie_dev_deinit)(void *os_pcie_dev_ctx)
Deinitialize a PCIe device.
Definition osal_ops.h:688
void(* iomem_write_reg32)(volatile void *addr, unsigned int val)
Write a 32-bit value to a device register using a memory mapped address.
Definition osal_ops.h:127
void(* bus_pcie_dev_rem)(void *os_pcie_dev_ctx)
Remove a PCIe device from the bus.
Definition osal_ops.h:673
void(* timer_init)(void *timer, void(*callback)(unsigned long), unsigned long data)
Initialize a timer.
Definition osal_ops.h:915
void(* bus_qspi_dev_deinit)(void *os_qspi_dev_ctx)
Deinitialize a QSPI device.
Definition osal_ops.h:789
void(* timer_schedule)(void *timer, unsigned long duration)
Schedule a timer.
Definition osal_ops.h:925
unsigned int(* llist_len)(void *llist)
Return the length of the linked list.
Definition osal_ops.h:427
void(* bus_pcie_dev_dma_unmap)(void *os_pcie_dev_ctx, void *dma_addr, size_t size, enum nrf_wifi_osal_dma_dir dir)
Unmap a DMA buffer for a PCIe device.
Definition osal_ops.h:731
enum nrf_wifi_status(* bus_spi_dev_intr_reg)(void *os_spi_dev_ctx, void *callbk_data, int(*callback_fn)(void *callbk_data))
Register an interrupt handler for a SPI device.
Definition osal_ops.h:873
void(* spinlock_free)(void *lock)
Free a spinlock.
Definition osal_ops.h:235
unsigned int(* iomem_read_reg32)(const volatile void *addr)
Read a 32-bit value from a device register using a memory mapped address.
Definition osal_ops.h:119
int(* sleep_ms)(int msecs)
Sleep for a specified number of milliseconds.
Definition osal_ops.h:596
void(* mem_free)(void *buf)
Free memory allocated for control messages.
Definition osal_ops.h:49
void(* llist_node_free)(void *node)
Free a linked list node.
Definition osal_ops.h:320
void(* llist_add_node_tail)(void *llist, void *llist_node)
Add a linked list node to the tail of a linked list.
Definition osal_ops.h:386
void(* bus_qspi_deinit)(void *os_qspi_priv)
Deinitialize the QSPI bus.
Definition osal_ops.h:757
void(* iomem_cpy_from)(void *dest, const volatile void *src, size_t count)
Copy data from memory mapped device memory to host memory.
Definition osal_ops.h:136
void(* ctrl_llist_free)(void *llist)
Free a linked list for control path.
Definition osal_ops.h:371
unsigned int(* spi_read_reg32)(void *priv, unsigned long addr)
Read a 32-bit value from a SPI device register.
Definition osal_ops.h:192
int(* bus_qspi_ps_sleep)(void *os_qspi_priv)
Put the QSPI bus to sleep.
Definition osal_ops.h:940
void(* spinlock_irq_take)(void *lock, unsigned long *flags)
Save interrupt states, disable interrupts, and acquire a spinlock.
Definition osal_ops.h:264
void(* data_mem_free)(void *buf)
Free memory allocated for data.
Definition osal_ops.h:64
enum nrf_wifi_status(* bus_pcie_dev_init)(void *os_pcie_dev_ctx)
Initialize a PCIe device.
Definition osal_ops.h:681
int(* delay_us)(int usecs)
Delay for a specified number of microseconds.
Definition osal_ops.h:604
void(* nbuf_set_chksum_done)(void *nbuf, unsigned char chksum_done)
Set the checksum status of a network buffer.
Definition osal_ops.h:526
void(* bus_spi_dev_deinit)(void *os_spi_dev_ctx)
Deinitialize a SPI device.
Definition osal_ops.h:863
void(* spinlock_init)(void *lock)
Initialize a spinlock.
Definition osal_ops.h:242
unsigned long(* time_get_curr_us)(void)
Get the current time of the day in microseconds.
Definition osal_ops.h:611
void(* nbuf_free)(void *nbuf)
Free a network buffer.
Definition osal_ops.h:442
unsigned int(* qspi_read_reg32)(void *priv, unsigned long addr)
Read a 32-bit value from a QSPI device register.
Definition osal_ops.h:154
void(* spinlock_irq_rel)(void *lock, unsigned long *flags)
Restore interrupt states and release a spinlock.
Definition osal_ops.h:272
void(* timer_kill)(void *timer)
Terminate a timer.
Definition osal_ops.h:932
void(* bus_spi_dev_rem)(void *os_spi_dev_ctx)
Remove a SPI device from the bus.
Definition osal_ops.h:848
void(* qspi_write_reg32)(void *priv, unsigned long addr, unsigned int val)
Write a 32-bit value to a QSPI device register.
Definition osal_ops.h:163
void(* assert)(int test_val, int val, enum nrf_wifi_assert_op_type op, char *assert_msg)
Assert a condition and display an error message if the condition is false.
Definition osal_ops.h:967
unsigned int(* time_elapsed_us)(unsigned long start_time)
Return the time elapsed in microseconds since a specified time instant.
Definition osal_ops.h:619
int(* log_err)(const char *fmt, va_list args)
Log an error message.
Definition osal_ops.h:299
void(* llist_free)(void *llist)
Free a linked list.
Definition osal_ops.h:364
int(* log_dbg)(const char *fmt, va_list args)
Log a debug message.
Definition osal_ops.h:281
void(* bus_spi_dev_host_map_get)(void *os_spi_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get the host mapping of a SPI device.
Definition osal_ops.h:890
void(* tasklet_kill)(void *tasklet)
Terminate a tasklet.
Definition osal_ops.h:588
void(* bus_pcie_dev_host_map_get)(void *os_pcie_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get the host mapping of a PCIe device.
Definition osal_ops.h:742
void(* bus_qspi_dev_intr_unreg)(void *os_qspi_dev_ctx)
Unregister the interrupt handler for a QSPI device.
Definition osal_ops.h:808
void(* ctrl_llist_node_free)(void *node)
Free a linked list node from control pool.
Definition osal_ops.h:327
bool(* nbuf_is_raw_tx)(void *nbuf)
Check if the network buffer is a raw Tx buffer.
Definition osal_ops.h:550
void(* qspi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count)
Copy data from QSPI device memory to host memory.
Definition osal_ops.h:173
void(* bus_qspi_dev_host_map_get)(void *os_qspi_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get the host mapping of a QSPI device.
Definition osal_ops.h:816
void(* iomem_cpy_to)(volatile void *dest, const void *src, size_t count)
Copy data from host memory to memory mapped device memory.
Definition osal_ops.h:145
void(* llist_add_node_head)(void *llist, void *llist_node)
Add a linked list node to the head of a linked list.
Definition osal_ops.h:394
void(* tasklet_schedule)(void *tasklet)
Schedule a tasklet.
Definition osal_ops.h:581
void(* tasklet_free)(void *tasklet)
Free a tasklet structure.
Definition osal_ops.h:565
void(* spinlock_rel)(void *lock)
Release a spinlock.
Definition osal_ops.h:256
enum nrf_wifi_status(* bus_qspi_dev_intr_reg)(void *os_qspi_dev_ctx, void *callbk_data, int(*callback_fn)(void *callbk_data))
Register an interrupt handler for a QSPI device.
Definition osal_ops.h:799
void(* tasklet_init)(void *tasklet, void(*callback)(unsigned long), unsigned long data)
Initialize a tasklet structure.
Definition osal_ops.h:574
unsigned char(* nbuf_get_priority)(void *nbuf)
Get the priority of a network buffer.
Definition osal_ops.h:510
void(* bus_spi_dev_intr_unreg)(void *os_spi_dev_ctx)
Unregister the interrupt handler for a SPI device.
Definition osal_ops.h:882
int(* bus_qspi_ps_status)(void *os_qspi_priv)
Get the power state of the QSPI bus.
Definition osal_ops.h:956
void(* llist_del_node)(void *llist, void *llist_node)
Remove a node from the linked list.
Definition osal_ops.h:419
void(* nbuf_headroom_res)(void *nbuf, unsigned int size)
Reserve headroom at the beginning of the data area of a network buffer.
Definition osal_ops.h:450
int(* mem_cmp)(const void *addr1, const void *addr2, size_t size)
Compare memory.
Definition osal_ops.h:95
void(* bus_spi_deinit)(void *os_spi_priv)
Deinitialize the SPI bus.
Definition osal_ops.h:831
unsigned int(* nbuf_data_size)(void *nbuf)
Get the size of the data area of a network buffer.
Definition osal_ops.h:467
int(* log_info)(const char *fmt, va_list args)
Log an informational message.
Definition osal_ops.h:290
unsigned long(* time_get_curr_ms)(void)
Get the current time of the day in milliseconds.
Definition osal_ops.h:625
void(* iomem_unmap)(volatile void *addr)
Unmap IO memory from CPU space.
Definition osal_ops.h:111
enum nrf_wifi_status(* bus_spi_dev_init)(void *os_spi_dev_ctx)
Initialize a SPI device.
Definition osal_ops.h:856
void(* bus_qspi_dev_rem)(void *os_qspi_dev_ctx)
Remove a QSPI device from the bus.
Definition osal_ops.h:774
unsigned int(* strlen)(const void *str)
Get the length of a string.
Definition osal_ops.h:978
void(* llist_node_data_set)(void *node, void *data)
Store the pointer to the data in the linked list node.
Definition osal_ops.h:343
void(* llist_init)(void *llist)
Initialize a linked list.
Definition osal_ops.h:378
int(* bus_qspi_ps_wake)(void *os_qspi_priv)
Wake up the QSPI bus from sleep.
Definition osal_ops.h:948
unsigned char(* rand8_get)(void)
Get a random 8-bit value.
Definition osal_ops.h:985
void(* bus_pcie_dev_intr_unreg)(void *os_pcie_dev_ctx)
Unregister the interrupt handler for a PCIe device.
Definition osal_ops.h:707
unsigned int(* nbuf_headroom_get)(void *nbuf)
Get the size of the reserved headroom at the beginning of the data area of a network buffer.
Definition osal_ops.h:459
void(* qspi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count)
Copy data from host memory to QSPI device memory.
Definition osal_ops.h:183
unsigned char(* nbuf_get_chksum_done)(void *nbuf)
Get the checksum status of a network buffer.
Definition osal_ops.h:518
void(* spi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count)
Copy data from host memory to SPI device memory.
Definition osal_ops.h:221
void(* timer_free)(void *timer)
Free a timer.
Definition osal_ops.h:906
enum nrf_wifi_status(* bus_pcie_dev_intr_reg)(void *os_pcie_dev_ctx, void *callbk_data, int(*callback_fn)(void *callbk_data))
Register an interrupt handler for a PCIe device.
Definition osal_ops.h:698
unsigned int(* time_elapsed_ms)(unsigned long start_time_us)
Return the time elapsed in milliseconds since a specified time instant.
Definition osal_ops.h:633
File containing OPs declarations for the OSAL Layer of the Wi-Fi driver.
Definition osal_ops.h:27