nrfxlib API 0.1.0
Loading...
Searching...
No Matches
osal_api.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_API_H__
13#define __OSAL_API_H__
14
15#include "osal_structs.h"
16
17/* Have to match zephyr/include/zephyr/logging/log_core.h */
18#define NRF_WIFI_LOG_LEVEL_ERR 1U
19#define NRF_WIFI_LOG_LEVEL_INF 3U
20#define NRF_WIFI_LOG_LEVEL_DBG 4U
21
22#ifndef CONFIG_NRF700X_LOG_VERBOSE
23#define __func__ "<snipped>"
24#endif /* CONFIG_NRF700X_LOG_VERBOSE */
25
35void nrf_wifi_osal_init(const struct nrf_wifi_osal_ops *ops);
36
46
56void *nrf_wifi_osal_mem_alloc(size_t size);
57
67void *nrf_wifi_osal_mem_zalloc(size_t size);
68
78void nrf_wifi_osal_mem_free(void *buf);
79
92void *nrf_wifi_osal_mem_cpy(void *dest,
93 const void *src,
94 size_t count);
95
106void *nrf_wifi_osal_mem_set(void *start,
107 int val,
108 size_t size);
109
110
120void *nrf_wifi_osal_iomem_mmap(unsigned long addr,
121 unsigned long size);
122
131void nrf_wifi_osal_iomem_unmap(volatile void *addr);
132
139unsigned int nrf_wifi_osal_iomem_read_reg32(const volatile void *addr);
140
151void nrf_wifi_osal_iomem_write_reg32(volatile void *addr,
152 unsigned int val);
153
166 const volatile void *src,
167 size_t count);
168
180void nrf_wifi_osal_iomem_cpy_to(volatile void *dest,
181 const void *src,
182 size_t count);
183
184
193
203
204
214
215
225
226
236
237
249 unsigned long *flags);
250
251
263 unsigned long *flags);
264
265
266#if CONFIG_WIFI_NRF700X_LOG_LEVEL >= NRF_WIFI_LOG_LEVEL_DBG
276int nrf_wifi_osal_log_dbg(const char *fmt, ...);
277#else
278#define nrf_wifi_osal_log_dbg(fmt, ...)
279#endif
280
281#if CONFIG_WIFI_NRF700X_LOG_LEVEL >= NRF_WIFI_LOG_LEVEL_INF
291int nrf_wifi_osal_log_info(const char *fmt, ...);
292#else
293#define nrf_wifi_osal_log_info(fmt, ...)
294#endif
295
296#if CONFIG_WIFI_NRF700X_LOG_LEVEL >= NRF_WIFI_LOG_LEVEL_ERR
306int nrf_wifi_osal_log_err(const char *fmt, ...);
307#else
308#define nrf_wifi_osal_log_err(fmt, ...)
309#endif
310
320
330
341
342
353 void *data);
354
355
364
373void nrf_wifi_osal_llist_free(void *llist);
374
375
384void nrf_wifi_osal_llist_init(void *llist);
385
386
398 void *llist_node);
399
400
412 void *llist_node);
423
424
436 void *llist_node);
437
438
450 void *llist_node);
451
452
461unsigned int nrf_wifi_osal_llist_len(void *llist);
462
463
472void *nrf_wifi_osal_nbuf_alloc(unsigned int size);
473
474
484void nrf_wifi_osal_nbuf_free(void *nbuf);
485
486
498 unsigned int size);
499
500
501
511unsigned int nrf_wifi_osal_nbuf_headroom_get(void *nbuf);
512
521unsigned int nrf_wifi_osal_nbuf_data_size(void *nbuf);
522
523
533
534
547 unsigned int size);
548
549
562 unsigned int size);
563
564
577 unsigned int size);
578
579
588unsigned char nrf_wifi_osal_nbuf_get_priority(void *nbuf);
589
598unsigned char nrf_wifi_osal_nbuf_get_chksum_done(void *nbuf);
599
610 unsigned char chksum_done);
611
621
631void nrf_wifi_osal_tasklet_free(void *tasklet);
632
633
644void nrf_wifi_osal_tasklet_init(void *tasklet,
645 void (*callbk_fn)(unsigned long),
646 unsigned long data);
647
648
660
661
671void nrf_wifi_osal_tasklet_kill(void *tasklet);
672
673
682void nrf_wifi_osal_sleep_ms(unsigned int msecs);
683
684
695void nrf_wifi_osal_delay_us(unsigned long usecs);
696
697
706
715unsigned int nrf_wifi_osal_time_elapsed_us(unsigned long start_time_us);
716
729void *nrf_wifi_osal_bus_pcie_init(const char *dev_name,
730 unsigned int vendor_id,
731 unsigned int sub_vendor_id,
732 unsigned int device_id,
733 unsigned int sub_device_id);
734
735
745void nrf_wifi_osal_bus_pcie_deinit(void *os_pcie_priv);
746
747
755void *nrf_wifi_osal_bus_pcie_dev_add(void *os_pcie_priv,
756 void *osal_pcie_dev_ctx);
757
758
768void nrf_wifi_osal_bus_pcie_dev_rem(void *os_pcie_dev_ctx);
769
770
781
782
792void nrf_wifi_osal_bus_pcie_dev_deinit(void *os_pcie_dev_ctx);
793
794
807 void *callbk_data,
808 int (*callbk_fn)(void *callbk_data));
809
810
819void nrf_wifi_osal_bus_pcie_dev_intr_unreg(void *os_pcie_dev_ctx);
820
821
839void *nrf_wifi_osal_bus_pcie_dev_dma_map(void *os_pcie_dev_ctx,
840 void *virt_addr,
841 size_t size,
842 enum nrf_wifi_osal_dma_dir dir);
843
844
856void nrf_wifi_osal_bus_pcie_dev_dma_unmap(void *os_pcie_dev_ctx,
857 void *dma_addr,
858 size_t size,
859 enum nrf_wifi_osal_dma_dir dir);
860
861
872 struct nrf_wifi_osal_host_map *host_map);
873
874
875
876
885
895void nrf_wifi_osal_bus_qspi_deinit(void *os_qspi_priv);
896
897
908void *nrf_wifi_osal_bus_qspi_dev_add(void *os_qspi_priv,
909 void *osal_qspi_dev_ctx);
910
911
921void nrf_wifi_osal_bus_qspi_dev_rem(void *os_qspi_dev_ctx);
922
923
936
937
947void nrf_wifi_osal_bus_qspi_dev_deinit(void *os_qspi_dev_ctx);
948
949
962 void *callbk_data,
963 int (*callbk_fn)(void *callbk_data));
964
965
975void nrf_wifi_osal_bus_qspi_dev_intr_unreg(void *os_qspi_dev_ctx);
976
977
988 struct nrf_wifi_osal_host_map *host_map);
989
997unsigned int nrf_wifi_osal_qspi_read_reg32(void *priv,
998 unsigned long addr);
999
1009 unsigned long addr,
1010 unsigned int val);
1011
1022 void *dest,
1023 unsigned long addr,
1024 size_t count);
1025
1036 unsigned long addr,
1037 const void *src,
1038 size_t count);
1039
1048
1058void nrf_wifi_osal_bus_spi_deinit(void *os_spi_priv);
1059
1060
1070void *nrf_wifi_osal_bus_spi_dev_add(void *os_spi_priv,
1071 void *osal_spi_dev_ctx);
1072
1073
1083void nrf_wifi_osal_bus_spi_dev_rem(void *os_spi_dev_ctx);
1084
1085
1098
1099
1109void nrf_wifi_osal_bus_spi_dev_deinit(void *os_spi_dev_ctx);
1110
1111
1126 void *callbk_data,
1127 int (*callbk_fn)(void *callbk_data));
1128
1129
1139void nrf_wifi_osal_bus_spi_dev_intr_unreg(void *os_spi_dev_ctx);
1140
1141
1152 struct nrf_wifi_osal_host_map *host_map);
1153
1161unsigned int nrf_wifi_osal_spi_read_reg32(void *priv,
1162 unsigned long addr);
1163
1173 unsigned long addr,
1174 unsigned int val);
1175
1186 void *dest,
1187 unsigned long addr,
1188 size_t count);
1189
1200 unsigned long addr,
1201 const void *src,
1202 size_t count);
1203
1204
1205#if defined(CONFIG_NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
1213void *nrf_wifi_osal_timer_alloc(void);
1214
1223void nrf_wifi_osal_timer_free(void *timer);
1224
1225
1238void nrf_wifi_osal_timer_init(void *timer,
1239 void (*callbk_fn)(unsigned long),
1240 unsigned long data);
1241
1242
1253void nrf_wifi_osal_timer_schedule(void *timer,
1254 unsigned long duration);
1255
1256
1263void nrf_wifi_osal_timer_kill(void *timer);
1264
1271int nrf_wifi_osal_bus_qspi_ps_sleep(void *os_qspi_priv);
1272
1279int nrf_wifi_osal_bus_qspi_ps_wake(void *os_qspi_priv);
1280
1289int nrf_wifi_osal_bus_qspi_ps_status(void *os_qspi_priv);
1290#endif /* CONFIG_NRF_WIFI_LOW_POWER */
1291
1304 int val,
1306 char *msg);
1307
1316unsigned int nrf_wifi_osal_strlen(const void *str);
1317
1329int nrf_wifi_osal_mem_cmp(const void *addr1,
1330 const void *addr2,
1331 size_t count);
1332#endif /* __OSAL_API_H__ */
unsigned int nrf_wifi_osal_llist_len(void *llist)
Get length of a linked list.
void nrf_wifi_osal_spi_cpy_to(void *priv, unsigned long addr, const void *src, size_t count)
Copies data from a source buffer to a SPI slave device.
void nrf_wifi_osal_llist_add_node_tail(void *llist, void *llist_node)
Add a node to the tail of a linked list.
void nrf_wifi_osal_tasklet_init(void *tasklet, void(*callbk_fn)(unsigned long), unsigned long data)
Initialize a tasklet.
void nrf_wifi_osal_deinit(void)
Deinitialize the OSAL layer.
void nrf_wifi_osal_assert(int test, int val, enum nrf_wifi_assert_op_type op, char *msg)
nrf_wifi_osal_assert() - Assert a condition with a value.
unsigned char nrf_wifi_osal_nbuf_get_priority(void *nbuf)
Get the priority of a network buffer.
void nrf_wifi_osal_iomem_cpy_to(volatile void *dest, const void *src, size_t count)
Copy data to the memory of a memory mapped IO device from host memory.
void nrf_wifi_osal_qspi_cpy_from(void *priv, void *dest, unsigned long addr, size_t count)
Copies data from a QSPI slave device to a destination buffer.
void nrf_wifi_osal_tasklet_kill(void *tasklet)
Terminate a tasklet.
void * nrf_wifi_osal_llist_alloc(void)
Allocate a linked list.
void nrf_wifi_osal_bus_pcie_dev_intr_unreg(void *os_pcie_dev_ctx)
Unregister an interrupt handler for a PCIe device.
#define nrf_wifi_osal_log_info(fmt,...)
Definition: osal_api.h:293
void nrf_wifi_osal_bus_pcie_deinit(void *os_pcie_priv)
Deinitialize a PCIe device driver.
void nrf_wifi_osal_spinlock_init(void *lock)
Initialize a busy lock.
void nrf_wifi_osal_bus_pcie_dev_rem(void *os_pcie_dev_ctx)
Remove a PCIe device instance.
enum nrf_wifi_status nrf_wifi_osal_bus_qspi_dev_init(void *os_qspi_dev_ctx)
Initialize a qspi device instance.
enum nrf_wifi_status nrf_wifi_osal_bus_qspi_dev_intr_reg(void *os_qspi_dev_ctx, void *callbk_data, int(*callbk_fn)(void *callbk_data))
void * nrf_wifi_osal_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_ctx)
void * nrf_wifi_osal_llist_node_alloc(void)
Allocate a linked list node.
void nrf_wifi_osal_spinlock_irq_rel(void *lock, unsigned long *flags)
Release a busy lock and enable interrupts.
void * nrf_wifi_osal_mem_set(void *start, int val, size_t size)
Fill a block of memory with a particular value.
void nrf_wifi_osal_spi_cpy_from(void *priv, void *dest, unsigned long addr, size_t count)
Copies data from a SPI slave device to a destination buffer.
void nrf_wifi_osal_bus_pcie_dev_dma_unmap(void *os_pcie_dev_ctx, void *dma_addr, size_t size, enum nrf_wifi_osal_dma_dir dir)
Unmap DMA mapped host memory.
void nrf_wifi_osal_spinlock_free(void *lock)
Free a busy lock.
void * nrf_wifi_osal_llist_node_data_get(void *node)
Get data stored in a linked list node.
#define nrf_wifi_osal_log_err(fmt,...)
Definition: osal_api.h:308
void nrf_wifi_osal_tasklet_free(void *tasklet)
Free a tasklet.
enum nrf_wifi_status nrf_wifi_osal_bus_spi_dev_init(void *os_spi_dev_ctx)
Initialize a spi device instance.
unsigned int nrf_wifi_osal_spi_read_reg32(void *priv, unsigned long addr)
Read value from a 32 bit register on a SPI slave device.
void nrf_wifi_osal_init(const struct nrf_wifi_osal_ops *ops)
Initialize the OSAL layer.
void * nrf_wifi_osal_llist_get_node_nxt(void *llist, void *llist_node)
Get the next node in a linked list.
void nrf_wifi_osal_llist_node_free(void *node)
Free a linked list node.
unsigned int nrf_wifi_osal_time_elapsed_us(unsigned long start_time_us)
Get elapsed time in microseconds.
void nrf_wifi_osal_llist_node_data_set(void *node, void *data)
Set data in a linked list node.
#define nrf_wifi_osal_log_dbg(fmt,...)
Definition: osal_api.h:278
unsigned int nrf_wifi_osal_nbuf_data_size(void *nbuf)
Get the size of data in a network buffer.
void * nrf_wifi_osal_nbuf_data_push(void *nbuf, unsigned int size)
Extend the head portion of the data in a network buffer.
void nrf_wifi_osal_iomem_unmap(volatile void *addr)
Unmap previously mapped IO memory from CPU space.
void nrf_wifi_osal_tasklet_schedule(void *tasklet)
Schedule a tasklet.
void nrf_wifi_osal_spinlock_irq_take(void *lock, unsigned long *flags)
Acquire a busy lock and disable interrupts.
void nrf_wifi_osal_bus_qspi_deinit(void *os_qspi_priv)
Deinitialize a qspi device driver.
void nrf_wifi_osal_bus_qspi_dev_rem(void *os_qspi_dev_ctx)
unsigned int nrf_wifi_osal_nbuf_headroom_get(void *nbuf)
Get the size of the headroom in a network buffer.
void * nrf_wifi_osal_bus_qspi_init(void)
Initialize a qspi driver.
unsigned int nrf_wifi_osal_strlen(const void *str)
Gives the length of the string @str.
unsigned int nrf_wifi_osal_qspi_read_reg32(void *priv, unsigned long addr)
Read value from a 32 bit register on a QSPI slave device.
void nrf_wifi_osal_bus_spi_dev_host_map_get(void *os_spi_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get host mapped address for a spi device.
void nrf_wifi_osal_qspi_write_reg32(void *priv, unsigned long addr, unsigned int val)
Writes a 32 bit value to a 32 bit device register on a QSPI slave device.
void * nrf_wifi_osal_spinlock_alloc(void)
Allocate a busy lock.
void nrf_wifi_osal_bus_spi_deinit(void *os_spi_priv)
Deinitialize a spi device driver.
void * nrf_wifi_osal_bus_pcie_dev_dma_map(void *os_pcie_dev_ctx, void *virt_addr, size_t size, enum nrf_wifi_osal_dma_dir dir)
void nrf_wifi_osal_spinlock_take(void *lock)
Acquire a busy lock.
void * nrf_wifi_osal_bus_spi_init(void)
Initialize a spi driver.
void nrf_wifi_osal_qspi_cpy_to(void *priv, unsigned long addr, const void *src, size_t count)
Copies data from a source buffer to a QSPI slave device.
void * nrf_wifi_osal_llist_get_node_head(void *llist)
Get the head of a linked list.
void nrf_wifi_osal_nbuf_headroom_res(void *nbuf, unsigned int size)
Reserve headroom space in a network buffer.
void nrf_wifi_osal_llist_free(void *llist)
Free a linked list.
void nrf_wifi_osal_bus_qspi_dev_intr_unreg(void *os_qspi_dev_ctx)
void nrf_wifi_osal_llist_add_node_head(void *llist, void *llist_node)
Add a node to the head of a linked list.
unsigned int nrf_wifi_osal_iomem_read_reg32(const volatile void *addr)
Read value from a 32 bit IO memory mapped register.
int nrf_wifi_osal_mem_cmp(const void *addr1, const void *addr2, size_t count)
Compare contents from one memory location to another.
void nrf_wifi_osal_llist_init(void *llist)
Initialize a linked list.
void nrf_wifi_osal_delay_us(unsigned long usecs)
Delay for a specified duration in microseconds.
void * nrf_wifi_osal_mem_zalloc(size_t size)
Allocated zero-initialized memory.
void * nrf_wifi_osal_iomem_mmap(unsigned long addr, unsigned long size)
Memory map IO memory into CPU space.
void * nrf_wifi_osal_mem_alloc(size_t size)
Allocate memory.
void * nrf_wifi_osal_nbuf_alloc(unsigned int size)
Allocate a network buffer.
void * nrf_wifi_osal_nbuf_data_pull(void *nbuf, unsigned int size)
Reduce the head portion of the data in a network buffer.
void nrf_wifi_osal_iomem_cpy_from(void *dest, const volatile void *src, size_t count)
Copy data from the memory of a memory mapped IO device to host memory.
void nrf_wifi_osal_bus_spi_dev_intr_unreg(void *os_spi_dev_ctx)
Unregister an interrupt handler for a spi device.
void nrf_wifi_osal_spinlock_rel(void *lock)
Releases a busy lock.
void * nrf_wifi_osal_nbuf_data_get(void *nbuf)
Get a handle to the data in a network buffer.
unsigned char nrf_wifi_osal_nbuf_get_chksum_done(void *nbuf)
Get the checksum status of a network buffer.
void * nrf_wifi_osal_nbuf_data_put(void *nbuf, unsigned int size)
Extend the tail portion of the data in a network buffer.
void nrf_wifi_osal_bus_spi_dev_rem(void *os_spi_dev_ctx)
Remove a spi device instance.
void nrf_wifi_osal_mem_free(void *buf)
Free previously allocated memory.
void nrf_wifi_osal_bus_pcie_dev_host_map_get(void *os_pcie_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get host mapped address for a PCIe device.
void nrf_wifi_osal_bus_qspi_dev_host_map_get(void *os_qspi_dev_ctx, struct nrf_wifi_osal_host_map *host_map)
Get host mapped address for a qspi device.
void nrf_wifi_osal_llist_del_node(void *llist, void *llist_node)
Delete node from a linked list.
void nrf_wifi_osal_nbuf_free(void *nbuf)
Free a network buffer.
void nrf_wifi_osal_iomem_write_reg32(volatile void *addr, unsigned int val)
Write a 32 bit value to a IO memory mapped register.
unsigned long nrf_wifi_osal_time_get_curr_us(void)
Get current system uptime in microseconds.
void nrf_wifi_osal_bus_qspi_dev_deinit(void *os_qspi_dev_ctx)
enum nrf_wifi_status nrf_wifi_osal_bus_pcie_dev_intr_reg(void *os_pcie_dev_ctx, void *callbk_data, int(*callbk_fn)(void *callbk_data))
Register an interrupt handler for a PCIe device.
void * nrf_wifi_osal_bus_pcie_init(const char *dev_name, unsigned int vendor_id, unsigned int sub_vendor_id, unsigned int device_id, unsigned int sub_device_id)
Initialize a PCIe driver.
void nrf_wifi_osal_bus_pcie_dev_deinit(void *os_pcie_dev_ctx)
Deinitialize a PCIe device instance.
void * nrf_wifi_osal_bus_pcie_dev_add(void *os_pcie_priv, void *osal_pcie_dev_ctx)
void * nrf_wifi_osal_tasklet_alloc(int type)
Allocate a tasklet.
void * nrf_wifi_osal_bus_spi_dev_add(void *os_spi_priv, void *osal_spi_dev_ctx)
void * nrf_wifi_osal_mem_cpy(void *dest, const void *src, size_t count)
Copy contents from one memory location to another.
enum nrf_wifi_status nrf_wifi_osal_bus_pcie_dev_init(void *os_pcie_dev_ctx)
Initialize a PCIe device instance.
void nrf_wifi_osal_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done)
Set the checksum status of a network buffer.
void nrf_wifi_osal_bus_spi_dev_deinit(void *os_spi_dev_ctx)
Deinitialize a spi device instance.
enum nrf_wifi_status nrf_wifi_osal_bus_spi_dev_intr_reg(void *os_spi_dev_ctx, void *callbk_data, int(*callbk_fn)(void *callbk_data))
Register a interrupt handler for a spi device.
void nrf_wifi_osal_spi_write_reg32(void *priv, unsigned long addr, unsigned int val)
Writes a 32 bit value to a 32 bit device register on a SPI slave device.
void nrf_wifi_osal_sleep_ms(unsigned int msecs)
Sleep for a specified duration in milliseconds.
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
File containing OPs declarations for the OSAL Layer of the Wi-Fi driver.
Definition: osal_ops.h:27