1 /*
2  * Copyright (c) 2018 Foundries.io Ltd
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * Extra definitions required for CONFIG_RISCV_SOC_OFFSETS.
9  */
10 
11 #ifndef SOC_RISCV32_OPENISA_RV32M1_SOC_OFFSETS_H_
12 #define SOC_RISCV32_OPENISA_RV32M1_SOC_OFFSETS_H_
13 
14 #ifdef CONFIG_SOC_OPENISA_RV32M1_RI5CY
15 
16 #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE
17 /*
18  * Ensure offset macros are available in <offsets.h>.
19  *
20  * Also create a macro which contains the value of &EVENT0->INTPTPENDCLEAR,
21  * for use in assembly.
22  */
23 #define GEN_SOC_OFFSET_SYMS()					\
24 	GEN_OFFSET_SYM(soc_esf_t, lpstart0);			\
25 	GEN_OFFSET_SYM(soc_esf_t, lpend0);			\
26 	GEN_OFFSET_SYM(soc_esf_t, lpcount0);			\
27 	GEN_OFFSET_SYM(soc_esf_t, lpstart1);			\
28 	GEN_OFFSET_SYM(soc_esf_t, lpend1);			\
29 	GEN_OFFSET_SYM(soc_esf_t, lpcount1);			\
30 	GEN_ABSOLUTE_SYM(__EVENT_INTPTPENDCLEAR,		\
31 			 (uint32_t)&EVENT0->INTPTPENDCLEAR)
32 #else
33 
34 #define GEN_SOC_OFFSET_SYMS()					\
35 	GEN_ABSOLUTE_SYM(__EVENT_INTPTPENDCLEAR,		\
36 			 (uint32_t)&EVENT0->INTPTPENDCLEAR)
37 
38 #endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
39 
40 #endif /* CONFIG_SOC_OPENISA_RV32M1_RI5CY */
41 
42 #ifdef CONFIG_SOC_OPENISA_RV32M1_ZERO_RISCY
43 
44 #define GEN_SOC_OFFSET_SYMS()					\
45 	GEN_ABSOLUTE_SYM(__EVENT_INTPTPENDCLEAR,		\
46 			 (uint32_t)&EVENT1->INTPTPENDCLEAR)
47 
48 #endif /* CONFIG_SOC_OPENISA_RV32M1_ZERO_RISCY */
49 
50 #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_OFFSETS_H_ */
51