1# SPDX-License-Identifier: BSD-3-Clause
2
3set(STATE_DEFS
4	-D__SPLIT__extra_size
5	-D__SPLIT__extra_align
6	-D__SPLIT__cpregs_size
7	-D__SPLIT__cpregs_align
8	-D__SPLIT__cp_names
9	-D__SPLIT__all_extra_size
10	-D__SPLIT__all_extra_align
11	-D__SPLIT__num_coprocessors
12	-D__SPLIT__cp_num
13	-D__SPLIT__cp_max
14	-D__SPLIT__cp_mask
15	-D__SPLIT__cp_id_mappings
16	-D__SPLIT__cp_mask_mappings
17	-D__SPLIT__init_mem_extra
18	-D__SPLIT__init_mem_cp
19	-D__SPLIT__save_extra
20	-D__SPLIT__restore_extra
21	-D__SPLIT__save_cpregs
22	-D__SPLIT__save_cp0
23	-D__SPLIT__save_cp1
24	-D__SPLIT__save_cp2
25	-D__SPLIT__save_cp3
26	-D__SPLIT__save_cp4
27	-D__SPLIT__save_cp5
28	-D__SPLIT__save_cp6
29	-D__SPLIT__save_cp7
30	-D__SPLIT__restore_cpregs
31	-D__SPLIT__restore_cp0
32	-D__SPLIT__restore_cp1
33	-D__SPLIT__restore_cp2
34	-D__SPLIT__restore_cp3
35	-D__SPLIT__restore_cp4
36	-D__SPLIT__restore_cp5
37	-D__SPLIT__restore_cp6
38	-D__SPLIT__restore_cp7
39	-D__SPLIT__cpregs_save_fn
40	-D__SPLIT__cpregs_restore_fn
41	-D__SPLIT__validate_cp
42	-D__SPLIT__invalidate_cp
43	-D__SPLIT__get_cpenable
44	-D__SPLIT__set_cpenable
45)
46
47set(DISASS_DEFS
48	-D__SPLIT__op0_format_lengths
49	-D__SPLIT__byte0_format_lengths
50	-D__SPLIT__disassemble_size
51	-D__SPLIT__disassemble
52)
53
54set(MISC_DEFS
55	-D__SPLIT__clear_regcached_code
56)
57
58#  Call0 ABI means the xthal... and xthal..._nw functions are
59#  identical.  If we're building for Call0 ABI, omit the ..._nw
60#  functions (except for xthal_get_intpending_nw, an interrupt handler
61#  helper function for which there is no duplicate and which does not
62#  obey _any_ calling conventions).
63set(INTERRUPTS_DEFS
64	-D__SPLIT__num_intlevels
65	-D__SPLIT__num_interrupts
66	-D__SPLIT__excm_level
67	-D__SPLIT__intlevel
68	-D__SPLIT__get_intenable
69	-D__SPLIT__set_intenable
70	-D__SPLIT__get_interrupt
71	-D__SPLIT__set_intset
72	-D__SPLIT__set_intclear
73)
74
75set(CACHE_DEFS
76	-D__SPLIT__get_cacheattr
77	-D__SPLIT__get_icacheattr
78	-D__SPLIT__set_cacheattr
79	-D__SPLIT__set_icacheattr
80	-D__SPLIT__set_dcacheattr
81	-D__SPLIT__set_idcacheattr
82	-D__SPLIT__idcache_is_enabled
83	-D__SPLIT__icache_is_enabled
84	-D__SPLIT__dcache_is_enabled
85	-D__SPLIT__idcache_is_enabled
86	-D__SPLIT__icache_all_invalidate
87	-D__SPLIT__dcache_all_invalidate
88	-D__SPLIT__dcache_all_writeback
89	-D__SPLIT__dcache_all_writeback_inv
90	-D__SPLIT__icache_all_unlock
91	-D__SPLIT__dcache_all_unlock
92	-D__SPLIT__icache_region_invalidate
93	-D__SPLIT__dcache_region_invalidate
94	-D__SPLIT__dcache_region_writeback
95	-D__SPLIT__dcache_region_writeback_inv
96	-D__SPLIT__icache_region_lock
97	-D__SPLIT__dcache_region_lock
98	-D__SPLIT__icache_region_unlock
99	-D__SPLIT__dcache_region_unlock
100	-D__SPLIT__icache_line_invalidate
101	-D__SPLIT__dcache_line_invalidate
102	-D__SPLIT__dcache_line_writeback
103	-D__SPLIT__dcache_line_writeback_inv
104	-D__SPLIT__icache_line_lock
105	-D__SPLIT__dcache_line_lock
106	-D__SPLIT__icache_line_unlock
107	-D__SPLIT__dcache_line_unlock
108	-D__SPLIT__icache_sync
109	-D__SPLIT__dcache_sync
110	-D__SPLIT__icache_get_ways
111	-D__SPLIT__icache_set_ways
112	-D__SPLIT__dcache_get_ways
113	-D__SPLIT__dcache_set_ways
114	-D__SPLIT__cache_coherence_on
115	-D__SPLIT__cache_coherence_off
116	-D__SPLIT__set_cache_prefetch_long
117	-D__SPLIT__set_cache_prefetch
118	-D__SPLIT__get_cache_prefetch
119	-D__SPLIT__hw_configid0
120	-D__SPLIT__hw_configid1
121	-D__SPLIT__release_major
122	-D__SPLIT__release_minor
123)
124
125add_library(hal STATIC "")
126target_link_libraries(hal sof_options)
127target_compile_definitions(hal PRIVATE
128	${STATE_DEFS}
129	${DISASS_DEFS}
130	${MISC_DEFS}
131	${INTERRUPTS_DEFS}
132	${CACHE_DEFS}
133)
134
135add_local_sources(hal
136	cache_asm.S
137	clock.S
138	int_asm.S
139	interrupts.c
140	memcopy.S
141	windowspill_asm.S
142	atomics.c
143)
144