nrfxlib API 0.1.0
Loading...
Searching...
No Matches
osal_ops.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 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
59 void *(*mem_cpy)(void *dest, const void *src, size_t count);
60
69 void *(*mem_set)(void *start, int val, size_t size);
70
80 int (*mem_cmp)(const void *addr1, const void *addr2, size_t size);
81
89 void *(*iomem_mmap)(unsigned long addr, unsigned long size);
90
96 void (*iomem_unmap)(volatile void *addr);
97
104 unsigned int (*iomem_read_reg32)(const volatile void *addr);
105
112 void (*iomem_write_reg32)(volatile void *addr, unsigned int val);
113
121 void (*iomem_cpy_from)(void *dest, const volatile void *src, size_t count);
122
130 void (*iomem_cpy_to)(volatile void *dest, const void *src, size_t count);
131
139 unsigned int (*qspi_read_reg32)(void *priv, unsigned long addr);
140
148 void (*qspi_write_reg32)(void *priv, unsigned long addr, unsigned int val);
149
158 void (*qspi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count);
159
168 void (*qspi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count);
169
177 unsigned int (*spi_read_reg32)(void *priv, unsigned long addr);
178
186 void (*spi_write_reg32)(void *priv, unsigned long addr, unsigned int val);
187
196 void (*spi_cpy_from)(void *priv, void *dest, unsigned long addr, size_t count);
197
206 void (*spi_cpy_to)(void *priv, unsigned long addr, const void *src, size_t count);
207
213 void *(*spinlock_alloc)(void);
214
220 void (*spinlock_free)(void *lock);
221
227 void (*spinlock_init)(void *lock);
228
234 void (*spinlock_take)(void *lock);
235
241 void (*spinlock_rel)(void *lock);
242
249 void (*spinlock_irq_take)(void *lock, unsigned long *flags);
250
257 void (*spinlock_irq_rel)(void *lock, unsigned long *flags);
258
266 int (*log_dbg)(const char *fmt, va_list args);
267
275 int (*log_info)(const char *fmt, va_list args);
276
284 int (*log_err)(const char *fmt, va_list args);
285
291 void *(*llist_node_alloc)(void);
292
298 void (*llist_node_free)(void *node);
299
306 void *(*llist_node_data_get)(void *node);
307
314 void (*llist_node_data_set)(void *node, void *data);
315
321 void *(*llist_alloc)(void);
322
328 void (*llist_free)(void *llist);
329
335 void (*llist_init)(void *llist);
336
343 void (*llist_add_node_tail)(void *llist, void *llist_node);
344
351 void (*llist_add_node_head)(void *llist, void *llist_node);
352
359 void *(*llist_get_node_head)(void *llist);
360
368 void *(*llist_get_node_nxt)(void *llist, void *llist_node);
369
376 void (*llist_del_node)(void *llist, void *llist_node);
377
384 unsigned int (*llist_len)(void *llist);
385
392 void *(*nbuf_alloc)(unsigned int size);
393
399 void (*nbuf_free)(void *nbuf);
400
407 void (*nbuf_headroom_res)(void *nbuf, unsigned int size);
408
416 unsigned int (*nbuf_headroom_get)(void *nbuf);
417
424 unsigned int (*nbuf_data_size)(void *nbuf);
425
432 void *(*nbuf_data_get)(void *nbuf);
433
441 void *(*nbuf_data_put)(void *nbuf, unsigned int size);
442
450 void *(*nbuf_data_push)(void *nbuf, unsigned int size);
451
459 void *(*nbuf_data_pull)(void *nbuf, unsigned int size);
460
467 unsigned char (*nbuf_get_priority)(void *nbuf);
468
475 unsigned char (*nbuf_get_chksum_done)(void *nbuf);
476
483 void (*nbuf_set_chksum_done)(void *nbuf, unsigned char chksum_done);
484
491 void *(*tasklet_alloc)(int type);
492
498 void (*tasklet_free)(void *tasklet);
499
507 void (*tasklet_init)(void *tasklet, void (*callback)(unsigned long), unsigned long data);
508
514 void (*tasklet_schedule)(void *tasklet);
515
521 void (*tasklet_kill)(void *tasklet);
522
529 int (*sleep_ms)(int msecs);
530
537 int (*delay_us)(int usecs);
538
544 unsigned long (*time_get_curr_us)(void);
545
552 unsigned int (*time_elapsed_us)(unsigned long start_time);
553
564 void *(*bus_pcie_init)(const char *dev_name,
565 unsigned int vendor_id,
566 unsigned int sub_vendor_id,
567 unsigned int device_id,
568 unsigned int sub_device_id);
569
575 void (*bus_pcie_deinit)(void *os_pcie_priv);
576
584 void *(*bus_pcie_dev_add)(void *pcie_priv,
585 void *osal_pcie_dev_ctx);
586
592 void (*bus_pcie_dev_rem)(void *os_pcie_dev_ctx);
593
600 enum nrf_wifi_status (*bus_pcie_dev_init)(void *os_pcie_dev_ctx);
601
607 void (*bus_pcie_dev_deinit)(void *os_pcie_dev_ctx);
608
617 enum nrf_wifi_status (*bus_pcie_dev_intr_reg)(void *os_pcie_dev_ctx,
618 void *callbk_data,
619 int (*callback_fn)(void *callbk_data));
620
626 void (*bus_pcie_dev_intr_unreg)(void *os_pcie_dev_ctx);
627
637 void *(*bus_pcie_dev_dma_map)(void *os_pcie_dev_ctx,
638 void *virt_addr,
639 size_t size,
640 enum nrf_wifi_osal_dma_dir dir);
641
650 void (*bus_pcie_dev_dma_unmap)(void *os_pcie_dev_ctx,
651 void *dma_addr,
652 size_t size,
653 enum nrf_wifi_osal_dma_dir dir);
654
661 void (*bus_pcie_dev_host_map_get)(void *os_pcie_dev_ctx,
662 struct nrf_wifi_osal_host_map *host_map);
663
669 void *(*bus_qspi_init)(void);
670
676 void (*bus_qspi_deinit)(void *os_qspi_priv);
677
685 void *(*bus_qspi_dev_add)(void *qspi_priv,
686 void *osal_qspi_dev_ctx);
687
693 void (*bus_qspi_dev_rem)(void *os_qspi_dev_ctx);
694
701 enum nrf_wifi_status (*bus_qspi_dev_init)(void *os_qspi_dev_ctx);
702
708 void (*bus_qspi_dev_deinit)(void *os_qspi_dev_ctx);
709
718 enum nrf_wifi_status (*bus_qspi_dev_intr_reg)(void *os_qspi_dev_ctx,
719 void *callbk_data,
720 int (*callback_fn)(void *callbk_data));
721
727 void (*bus_qspi_dev_intr_unreg)(void *os_qspi_dev_ctx);
728
735 void (*bus_qspi_dev_host_map_get)(void *os_qspi_dev_ctx,
736 struct nrf_wifi_osal_host_map *host_map);
737
743 void *(*bus_spi_init)(void);
744
750 void (*bus_spi_deinit)(void *os_spi_priv);
751
759 void *(*bus_spi_dev_add)(void *spi_priv,
760 void *osal_spi_dev_ctx);
761
767 void (*bus_spi_dev_rem)(void *os_spi_dev_ctx);
768
775 enum nrf_wifi_status (*bus_spi_dev_init)(void *os_spi_dev_ctx);
776
782 void (*bus_spi_dev_deinit)(void *os_spi_dev_ctx);
783
792 enum nrf_wifi_status (*bus_spi_dev_intr_reg)(void *os_spi_dev_ctx,
793 void *callbk_data,
794 int (*callback_fn)(void *callbk_data));
795
801 void (*bus_spi_dev_intr_unreg)(void *os_spi_dev_ctx);
802
809 void (*bus_spi_dev_host_map_get)(void *os_spi_dev_ctx,
810 struct nrf_wifi_osal_host_map *host_map);
811
812 #if defined(CONFIG_NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
818 void *(*timer_alloc)(void);
819
825 void (*timer_free)(void *timer);
826
834 void (*timer_init)(void *timer,
835 void (*callback)(unsigned long),
836 unsigned long data);
837
844 void (*timer_schedule)(void *timer, unsigned long duration);
845
851 void (*timer_kill)(void *timer);
852
859 int (*bus_qspi_ps_sleep)(void *os_qspi_priv);
860
867 int (*bus_qspi_ps_wake)(void *os_qspi_priv);
868
875 int (*bus_qspi_ps_status)(void *os_qspi_priv);
876 #endif /* CONFIG_NRF_WIFI_LOW_POWER */
877
886 void (*assert)(int test_val,
887 int val,
889 char *assert_msg);
890
897 unsigned int (*strlen)(const void *str);
898};
899#endif /* __OSAL_OPS_H__ */
nrf_wifi_assert_op_type
The type of assertion operation to be performed.
Definition: osal_structs.h:91
nrf_wifi_status
The status of an operation performed by the RPU driver.
Definition: osal_structs.h:29
nrf_wifi_osal_dma_dir
DMA direction for a DMA operation.
Definition: osal_structs.h:39
Structure declarations for the OSAL Layer of the Wi-Fi driver.
Structure representing a host map.
Definition: osal_structs.h:73
enum nrf_wifi_status(* bus_qspi_dev_init)(void *os_qspi_dev_ctx)
Initialize a QSPI device.
Definition: osal_ops.h:701
void(* bus_pcie_deinit)(void *os_pcie_priv)
Deinitialize the PCIe bus.
Definition: osal_ops.h:575
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:196
void(* spinlock_take)(void *lock)
Acquire a spinlock.
Definition: osal_ops.h:234
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:186
void(* bus_pcie_dev_deinit)(void *os_pcie_dev_ctx)
Deinitialize a PCIe device.
Definition: osal_ops.h:607
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:112
void(* bus_pcie_dev_rem)(void *os_pcie_dev_ctx)
Remove a PCIe device from the bus.
Definition: osal_ops.h:592
void(* bus_qspi_dev_deinit)(void *os_qspi_dev_ctx)
Deinitialize a QSPI device.
Definition: osal_ops.h:708
unsigned int(* llist_len)(void *llist)
Return the length of the linked list.
Definition: osal_ops.h:384
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:650
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:792
void(* spinlock_free)(void *lock)
Free a spinlock.
Definition: osal_ops.h:220
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:104
int(* sleep_ms)(int msecs)
Sleep for a specified number of milliseconds.
Definition: osal_ops.h:529
void(* mem_free)(void *buf)
Free allocated memory.
Definition: osal_ops.h:49
void(* llist_node_free)(void *node)
Free a linked list node.
Definition: osal_ops.h:298
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:343
void(* bus_qspi_deinit)(void *os_qspi_priv)
Deinitialize the QSPI bus.
Definition: osal_ops.h:676
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:121
unsigned int(* spi_read_reg32)(void *priv, unsigned long addr)
Read a 32-bit value from a SPI device register.
Definition: osal_ops.h:177
void(* spinlock_irq_take)(void *lock, unsigned long *flags)
Save interrupt states, disable interrupts, and acquire a spinlock.
Definition: osal_ops.h:249
enum nrf_wifi_status(* bus_pcie_dev_init)(void *os_pcie_dev_ctx)
Initialize a PCIe device.
Definition: osal_ops.h:600
int(* delay_us)(int usecs)
Delay for a specified number of microseconds.
Definition: osal_ops.h:537
void(* nbuf_set_chksum_done)(void *nbuf, unsigned char chksum_done)
Set the checksum status of a network buffer.
Definition: osal_ops.h:483
void(* bus_spi_dev_deinit)(void *os_spi_dev_ctx)
Deinitialize a SPI device.
Definition: osal_ops.h:782
void(* spinlock_init)(void *lock)
Initialize a spinlock.
Definition: osal_ops.h:227
unsigned long(* time_get_curr_us)(void)
Get the current time of the day in microseconds.
Definition: osal_ops.h:544
void(* nbuf_free)(void *nbuf)
Free a network buffer.
Definition: osal_ops.h:399
unsigned int(* qspi_read_reg32)(void *priv, unsigned long addr)
Read a 32-bit value from a QSPI device register.
Definition: osal_ops.h:139
void(* spinlock_irq_rel)(void *lock, unsigned long *flags)
Restore interrupt states and release a spinlock.
Definition: osal_ops.h:257
void(* bus_spi_dev_rem)(void *os_spi_dev_ctx)
Remove a SPI device from the bus.
Definition: osal_ops.h:767
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:148
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:886
unsigned int(* time_elapsed_us)(unsigned long start_time)
Return the time elapsed in microseconds since a specified time instant.
Definition: osal_ops.h:552
int(* log_err)(const char *fmt, va_list args)
Log an error message.
Definition: osal_ops.h:284
void(* llist_free)(void *llist)
Free a linked list.
Definition: osal_ops.h:328
int(* log_dbg)(const char *fmt, va_list args)
Log a debug message.
Definition: osal_ops.h:266
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:809
void(* tasklet_kill)(void *tasklet)
Terminate a tasklet.
Definition: osal_ops.h:521
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:661
void(* bus_qspi_dev_intr_unreg)(void *os_qspi_dev_ctx)
Unregister the interrupt handler for a QSPI device.
Definition: osal_ops.h:727
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:158
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:735
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:130
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:351
void(* tasklet_schedule)(void *tasklet)
Schedule a tasklet.
Definition: osal_ops.h:514
void(* tasklet_free)(void *tasklet)
Free a tasklet structure.
Definition: osal_ops.h:498
void(* spinlock_rel)(void *lock)
Release a spinlock.
Definition: osal_ops.h:241
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:718
void(* tasklet_init)(void *tasklet, void(*callback)(unsigned long), unsigned long data)
Initialize a tasklet structure.
Definition: osal_ops.h:507
unsigned char(* nbuf_get_priority)(void *nbuf)
Get the priority of a network buffer.
Definition: osal_ops.h:467
void(* bus_spi_dev_intr_unreg)(void *os_spi_dev_ctx)
Unregister the interrupt handler for a SPI device.
Definition: osal_ops.h:801
void(* llist_del_node)(void *llist, void *llist_node)
Remove a node from the linked list.
Definition: osal_ops.h:376
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:407
int(* mem_cmp)(const void *addr1, const void *addr2, size_t size)
Compare memory.
Definition: osal_ops.h:80
void(* bus_spi_deinit)(void *os_spi_priv)
Deinitialize the SPI bus.
Definition: osal_ops.h:750
unsigned int(* nbuf_data_size)(void *nbuf)
Get the size of the data area of a network buffer.
Definition: osal_ops.h:424
int(* log_info)(const char *fmt, va_list args)
Log an informational message.
Definition: osal_ops.h:275
void(* iomem_unmap)(volatile void *addr)
Unmap IO memory from CPU space.
Definition: osal_ops.h:96
enum nrf_wifi_status(* bus_spi_dev_init)(void *os_spi_dev_ctx)
Initialize a SPI device.
Definition: osal_ops.h:775
void(* bus_qspi_dev_rem)(void *os_qspi_dev_ctx)
Remove a QSPI device from the bus.
Definition: osal_ops.h:693
unsigned int(* strlen)(const void *str)
Get the length of a string.
Definition: osal_ops.h:897
void(* llist_node_data_set)(void *node, void *data)
Store the pointer to the data in the linked list node.
Definition: osal_ops.h:314
void(* llist_init)(void *llist)
Initialize a linked list.
Definition: osal_ops.h:335
void(* bus_pcie_dev_intr_unreg)(void *os_pcie_dev_ctx)
Unregister the interrupt handler for a PCIe device.
Definition: osal_ops.h:626
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:416
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:168
unsigned char(* nbuf_get_chksum_done)(void *nbuf)
Get the checksum status of a network buffer.
Definition: osal_ops.h:475
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:206
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:617
File containing OPs declarations for the OSAL Layer of the Wi-Fi driver.
Definition: osal_ops.h:27