Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
qspi_if.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef __QSPI_IF_H__
13#define __QSPI_IF_H__
14
15#include <zephyr/kernel.h>
16#include <zephyr/drivers/gpio.h>
17#ifdef CONFIG_NRF70_ON_QSPI
18#include <nrfx_qspi.h>
19#endif
20
21#define RPU_WAKEUP_NOW BIT(0) /* WAKEUP RPU - RW */
22#define RPU_AWAKE_BIT BIT(1) /* RPU AWAKE FROM SLEEP - RO */
23#define RPU_READY_BIT BIT(2) /* RPU IS READY - RO*/
24
26#ifdef CONFIG_NRF70_ON_QSPI
27 nrf_qspi_addrmode_t addrmode;
28 nrf_qspi_readoc_t readoc;
29 nrf_qspi_writeoc_t writeoc;
30 nrf_qspi_frequency_t sckfreq;
31#endif
32 unsigned char RDC4IO;
33 bool easydma;
39 struct k_sem lock;
40 unsigned int addrmask;
41 unsigned char qspi_slave_latency;
42#if defined(CONFIG_NRF70_ON_QSPI) && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC)
43 nrf_qspi_encryption_t p_cfg;
44#endif /*CONFIG_NRF70_ON_QSPI && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC)*/
46 char *test_name;
54};
55struct qspi_dev {
56 int (*deinit)(void);
57 void *config;
58 int (*init)(struct qspi_config *config);
59 int (*write)(unsigned int addr, const void *data, int len);
60 int (*read)(unsigned int addr, void *data, int len);
61 int (*hl_read)(unsigned int addr, void *data, int len);
62 void (*hard_reset)(void);
63};
64
65int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data);
66
67int qspi_init(struct qspi_config *config);
68
69int qspi_write(unsigned int addr, const void *data, int len);
70
71int qspi_read(unsigned int addr, void *data, int len);
72
73int qspi_hl_read(unsigned int addr, void *data, int len);
74
75int qspi_deinit(void);
76
77void gpio_free_irq(int pin, struct gpio_callback *button_cb_data);
78
79int gpio_request_irq(int pin, struct gpio_callback *button_cb_data, void (*irq_handler)());
80
82
83struct qspi_dev *qspi_dev(void);
85
86int qspi_cmd_sleep_rpu(const struct device *dev);
87
88void hard_reset(void);
89void get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len);
90
91extern struct device qspi_perip;
92
94int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data);
95int qspi_wait_while_rpu_awake(const struct device *dev);
96
97int qspi_RDSR1(const struct device *dev, uint8_t *rdsr1);
98int qspi_RDSR2(const struct device *dev, uint8_t *rdsr2);
99int qspi_WRSR2(const struct device *dev, const uint8_t wrsr2);
100
101#ifdef CONFIG_NRF_WIFI_LOW_POWER
102int func_rpu_sleep(void);
103int func_rpu_wake(void);
104int func_rpu_sleep_status(void);
105#endif /* CONFIG_NRF_WIFI_LOW_POWER */
106
107#define QSPI_KEY_LEN_BYTES 16
108
115
116#endif /* __QSPI_IF_H__ */
Public APIs for GPIO drivers.
Public kernel APIs.
struct qspi_config * qspi_defconfig(void)
void get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len)
struct device qspi_perip
int qspi_read(unsigned int addr, void *data, int len)
int qspi_deinit(void)
int qspi_init(struct qspi_config *config)
int qspi_RDSR1(const struct device *dev, uint8_t *rdsr1)
int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data)
int qspi_WRSR2(const struct device *dev, const uint8_t wrsr2)
int gpio_request_irq(int pin, struct gpio_callback *button_cb_data, void(*irq_handler)())
struct qspi_config * qspi_get_config(void)
int qspi_write(unsigned int addr, const void *data, int len)
int qspi_wait_while_rpu_awake(const struct device *dev)
void gpio_free_irq(int pin, struct gpio_callback *button_cb_data)
int qspi_hl_read(unsigned int addr, void *data, int len)
int qspi_cmd_sleep_rpu(const struct device *dev)
int qspi_enable_encryption(uint8_t *key)
Enable encryption.
struct qspi_dev * qspi_dev(void)
int qspi_RDSR2(const struct device *dev, uint8_t *rdsr2)
void hard_reset(void)
int qspi_validate_rpu_wake_writecmd(const struct device *dev)
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
void * data
Address of the device instance private data.
Definition device.h:421
GPIO callback structure.
Definition gpio.h:741
Definition qspi_if.h:25
unsigned char RDC4IO
Definition qspi_if.h:32
bool CMD_CNONCE
Definition qspi_if.h:37
char * test_name
Definition qspi_if.h:46
int test_end
Definition qspi_if.h:48
unsigned int addrmask
Definition qspi_if.h:40
int test_timediff_read
Definition qspi_if.h:50
int test_timediff_write
Definition qspi_if.h:51
bool single_op
Definition qspi_if.h:34
int test_start
Definition qspi_if.h:47
bool easydma
Definition qspi_if.h:33
int test_iteration
Definition qspi_if.h:53
bool encryption
Definition qspi_if.h:36
int test_iterations
Definition qspi_if.h:49
int test_hlread
Definition qspi_if.h:45
bool quad_spi
Definition qspi_if.h:35
unsigned char qspi_slave_latency
Definition qspi_if.h:41
struct k_sem lock
Definition qspi_if.h:39
int test_status
Definition qspi_if.h:52
bool enc_enabled
Definition qspi_if.h:38
Definition qspi_if.h:55
int(* deinit)(void)
Definition qspi_if.h:56
int(* read)(unsigned int addr, void *data, int len)
Definition qspi_if.h:60
int(* hl_read)(unsigned int addr, void *data, int len)
Definition qspi_if.h:61
void(* hard_reset)(void)
Definition qspi_if.h:62
int(* write)(unsigned int addr, const void *data, int len)
Definition qspi_if.h:59
void * config
Definition qspi_if.h:57
int(* init)(struct qspi_config *config)
Definition qspi_if.h:58