1 /*
2 * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #ifndef __SOC_H__
8 #define __SOC_H__
9
10 #ifndef _ASMLANGUAGE
11 #include <soc/soc.h>
12 #include <rom/ets_sys.h>
13 #include <rom/spi_flash.h>
14 #include <zephyr/types.h>
15 #include <stdbool.h>
16 #include <esp_private/esp_clk.h>
17 #endif
18
19 /* ECALL Exception numbers */
20 #define SOC_MCAUSE_ECALL_EXP 11 /* Machine ECALL instruction */
21 #define SOC_MCAUSE_USER_ECALL_EXP 8 /* User ECALL instruction */
22
23 /* Interrupt Mask */
24 #define SOC_MCAUSE_IRQ_MASK (1 << 31)
25 /* Exception code Mask */
26 #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF
27
28 #ifndef _ASMLANGUAGE
29
30 void __esp_platform_start(void);
31
esp_core_id(void)32 static inline uint32_t esp_core_id(void)
33 {
34 return 0;
35 }
36
37 extern void esp_reset_reason_init(void);
38 extern void esp_rom_route_intr_matrix(int cpu_no, uint32_t model_num, uint32_t intr_num);
39 extern void esp_rom_intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
40 extern void esp_rom_uart_attach(void);
41 extern void esp_rom_uart_tx_wait_idle(uint8_t uart_no);
42 extern int esp_rom_uart_tx_one_char(uint8_t chr);
43 extern int esp_rom_gpio_matrix_in(uint32_t gpio, uint32_t signal_index,
44 bool inverted);
45 extern int esp_rom_gpio_matrix_out(uint32_t gpio, uint32_t signal_index,
46 bool out_inverted,
47 bool out_enabled_inverted);
48 extern void esp_rom_ets_set_user_start(uint32_t start);
49 extern void esprv_intc_int_set_threshold(int priority_threshold);
50 uint32_t soc_intr_get_next_source(void);
51 extern void esp_rom_Cache_Resume_ICache(uint32_t autoload);
52 extern int esp_rom_Cache_Invalidate_Addr(uint32_t addr, uint32_t size);
53 extern uint32_t esp_rom_Cache_Suspend_ICache(void);
54 extern void esp_rom_Cache_Invalidate_ICache_All(void);
55 extern int esp_rom_Cache_Dbus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr,
56 uint32_t psize, uint32_t num, uint32_t fixed);
57 extern int esp_rom_Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr,
58 uint32_t psize, uint32_t num, uint32_t fixed);
59
60 #endif /* _ASMLANGUAGE */
61
62 #endif /* __SOC_H__ */
63