1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @brief Header containing common functions for RPU hardware interaction
9  * using QSPI and SPI that can be invoked by shell or the driver.
10  */
11 
12 #ifndef __RPU_HW_IF_H_
13 #define __RPU_HW_IF_H_
14 
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <zephyr/drivers/gpio.h>
18 
19 enum {
20 	SYSBUS = 0,
21 	EXT_SYS_BUS,
22 	PBUS,
23 	PKTRAM,
24 	GRAM,
25 	LMAC_ROM,
26 	LMAC_RET_RAM,
27 	LMAC_SRC_RAM,
28 	UMAC_ROM,
29 	UMAC_RET_RAM,
30 	UMAC_SRC_RAM,
31 	NUM_MEM_BLOCKS
32 };
33 
34 extern char blk_name[][15];
35 extern uint32_t rpu_7002_memmap[][3];
36 
37 int rpu_read(unsigned int addr, void *data, int len);
38 int rpu_write(unsigned int addr, const void *data, int len);
39 
40 int rpu_sleep(void);
41 int rpu_wakeup(void);
42 int rpu_sleep_status(void);
43 void rpu_get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len);
44 int rpu_irq_config(struct gpio_callback *irq_callback_data, void (*irq_handler)());
45 int rpu_irq_remove(struct gpio_callback *irq_callback_data);
46 
47 int rpu_wrsr2(uint8_t data);
48 int rpu_rdsr2(void);
49 int rpu_rdsr1(void);
50 int rpu_clks_on(void);
51 
52 int rpu_init(void);
53 int rpu_enable(void);
54 int rpu_disable(void);
55 
56 #ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH
57 int sr_ant_switch(unsigned int ant_switch);
58 int sr_gpio_remove(void);
59 int sr_gpio_config(void);
60 #endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */
61 #endif /* __RPU_HW_IF_H_ */
62