Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
arc_connect.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Synopsys.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_
15#define ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_
16
17#ifndef _ASMLANGUAGE
18#include <zephyr/types.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define _ARC_V2_CONNECT_BCR 0x0d0
25#define _ARC_V2_CONNECT_IDU_BCR 0x0d5
26#define _ARC_V2_CONNECT_GFRC_BCR 0x0d6
27#define _ARC_V2_CONNECT_CMD 0x600
28#define _ARC_V2_CONNECT_WDATA 0x601
29#define _ARC_V2_CONNECT_READBACK 0x602
30
31
32#define ARC_CONNECT_CMD_CHECK_CORE_ID 0x0
33
34#define ARC_CONNECT_CMD_INTRPT_GENERATE_IRQ 0x1
35#define ARC_CONNECT_CMD_INTRPT_GENERATE_ACK 0x2
36#define ARC_CONNECT_CMD_INTRPT_READ_STATUS 0x3
37#define ARC_CONNECT_CMD_INTRPT_CHECK_SOURCE 0x4
38
39#define ARC_CONNECT_CMD_SEMA_CLAIM_AND_READ 0x11
40#define ARC_CONNECT_CMD_SEMA_RELEASE 0x12
41#define ARC_CONNECT_CMD_SEMA_FORCE_RELEASE 0x13
42
43#define ARC_CONNECT_CMD_MSG_SRAM_SET_ADDR 0x21
44#define ARC_CONNECT_CMD_MSG_SRAM_READ_ADDR 0x22
45#define ARC_CONNECT_CMD_MSG_SRAM_SET_ADDR_OFFSET 0x23
46#define ARC_CONNECT_CMD_MSG_SRAM_READ_ADDR_OFFSET 0x24
47#define ARC_CONNECT_CMD_MSG_SRAM_WRITE 0x25
48#define ARC_CONNECT_CMD_MSG_SRAM_WRITE_INC 0x26
49#define ARC_CONNECT_CMD_MSG_SRAM_WRITE_IMM 0x27
50#define ARC_CONNECT_CMD_MSG_SRAM_READ 0x28
51#define ARC_CONNECT_CMD_MSG_SRAM_READ_INC 0x29
52#define ARC_CONNECT_CMD_MSG_SRAM_READ_IMM 0x2a
53#define ARC_CONNECT_CMD_MSG_SRAM_SET_ECC_CTRL 0x2b
54#define ARC_CONNECT_CMD_MSG_SRAM_READ_ECC_CTRL 0x2c
55
56#define ARC_CONNECT_CMD_DEBUG_RESET 0x31
57#define ARC_CONNECT_CMD_DEBUG_HALT 0x32
58#define ARC_CONNECT_CMD_DEBUG_RUN 0x33
59#define ARC_CONNECT_CMD_DEBUG_SET_MASK 0x34
60#define ARC_CONNECT_CMD_DEBUG_READ_MASK 0x35
61#define ARC_CONNECT_CMD_DEBUG_SET_SELECT 0x36
62#define ARC_CONNECT_CMD_DEBUG_READ_SELECT 0x37
63#define ARC_CONNECT_CMD_DEBUG_READ_EN 0x38
64#define ARC_CONNECT_CMD_DEBUG_READ_CMD 0x39
65#define ARC_CONNECT_CMD_DEBUG_READ_CORE 0x3a
66
67#define ARC_CONNECT_CMD_DEBUG_MASK_SH 0x08 /* if a self-halt occurs, a global halt is triggered */
68#define ARC_CONNECT_CMD_DEBUG_MASK_BH 0x04 /* if a breakpoint caused halt occurs, a global halt is triggered */
69#define ARC_CONNECT_CMD_DEBUG_MASK_AH 0x02 /* if an actionpoint caused halt occurs, a global halt is triggered */
70#define ARC_CONNECT_CMD_DEBUG_MASK_H 0x01 /* whenever the core is halted, a global halt is triggered */
71
72#define ARC_CONNECT_CMD_GFRC_CLEAR 0x41
73#define ARC_CONNECT_CMD_GFRC_READ_LO 0x42
74#define ARC_CONNECT_CMD_GFRC_READ_HI 0x43
75#define ARC_CONNECT_CMD_GFRC_ENABLE 0x44
76#define ARC_CONNECT_CMD_GFRC_DISABLE 0x45
77#define ARC_CONNECT_CMD_GFRC_READ_DISABLE 0x46
78#define ARC_CONNECT_CMD_GFRC_SET_CORE 0x47
79#define ARC_CONNECT_CMD_GFRC_READ_CORE 0x48
80#define ARC_CONNECT_CMD_GFRC_READ_HALT 0x49
81
82#define ARC_CONNECT_CMD_PDM_SET_PM 0x81
83#define ARC_CONNECT_CMD_PDM_READ_PSTATUS 0x82
84
85#define ARC_CONNECT_CMD_PMU_SET_PUCNT 0x51
86#define ARC_CONNECT_CMD_PMU_READ_PUCNT 0x52
87#define ARC_CONNECT_CMD_PMU_SET_RSTCNT 0x53
88#define ARC_CONNECT_CMD_PMU_READ_RSTCNT 0x54
89#define ARC_CONNECT_CMD_PMU_SET_PDCNT 0x55
90#define ARC_CONNECT_CMD_PMU_READ_PDCNT 0x56
91
92#define ARC_CONNECT_CMD_IDU_ENABLE 0x71
93#define ARC_CONNECT_CMD_IDU_DISABLE 0x72
94#define ARC_CONNECT_CMD_IDU_READ_ENABLE 0x73
95#define ARC_CONNECT_CMD_IDU_SET_MODE 0x74
96#define ARC_CONNECT_CMD_IDU_READ_MODE 0x75
97#define ARC_CONNECT_CMD_IDU_SET_DEST 0x76
98#define ARC_CONNECT_CMD_IDU_READ_DEST 0x77
99#define ARC_CONNECT_CMD_IDU_GEN_CIRQ 0x78
100#define ARC_CONNECT_CMD_IDU_ACK_CIRQ 0x79
101#define ARC_CONNECT_CMD_IDU_CHECK_STATUS 0x7a
102#define ARC_CONNECT_CMD_IDU_CHECK_SOURCE 0x7b
103#define ARC_CONNECT_CMD_IDU_SET_MASK 0x7c
104#define ARC_CONNECT_CMD_IDU_READ_MASK 0x7d
105#define ARC_CONNECT_CMD_IDU_CHECK_FIRST 0x7e
106
107/* the start intno of common interrupt managed by IDU */
108#define ARC_CONNECT_IDU_IRQ_START 24
109
110#define ARC_CONNECT_INTRPT_TRIGGER_LEVEL 0
111#define ARC_CONNECT_INTRPT_TRIGGER_EDGE 1
112
113
114#define ARC_CONNECT_DISTRI_MODE_ROUND_ROBIN 0
115#define ARC_CONNECT_DISTRI_MODE_FIRST_ACK 1
116#define ARC_CONNECT_DISTRI_ALL_DEST 2
117
119 union {
120 struct {
121#ifdef CONFIG_BIG_ENDIAN
122 uint32_t pad:8, param:16, cmd:8;
123#else
125#endif
126 };
128 };
129};
130
132 union {
133 struct {
134#ifdef CONFIG_BIG_ENDIAN
135 uint32_t pad4:6, pw_dom:1, pad3:1,
136 idu:1, pad2:1, num_cores:6,
137 pad:1, gfrc:1, dbg:1, pw:1,
138 msg:1, sem:1, ipi:1, slv:1,
139 ver:8;
140#else
142 slv:1, ipi:1, sem:1, msg:1,
143 pw:1, dbg:1, gfrc:1, pad:1,
145 pad3:1, pw_dom:1, pad4:6;
146#endif
147 };
149 };
150};
151
153 union {
154 struct {
155#ifdef CONFIG_BIG_ENDIAN
156 uint32_t pad:21, cirqnum:3, ver:8;
157#else
159#endif
160 };
162 };
163};
164
165static inline void z_arc_connect_cmd(uint32_t cmd, uint32_t param)
166{
167 struct arc_connect_cmd regval;
168
169 regval.pad = 0;
170 regval.cmd = cmd;
171 regval.param = param;
172
173 z_arc_v2_aux_reg_write(_ARC_V2_CONNECT_CMD, regval.val);
174}
175
176static inline void z_arc_connect_cmd_data(uint32_t cmd, uint32_t param,
178{
179 z_arc_v2_aux_reg_write(_ARC_V2_CONNECT_WDATA, data);
180 z_arc_connect_cmd(cmd, param);
181}
182
183static inline uint32_t z_arc_connect_cmd_readback(void)
184{
185 return z_arc_v2_aux_reg_read(_ARC_V2_CONNECT_READBACK);
186}
187
188
189/* inter-core interrupt related functions */
190extern void z_arc_connect_ici_generate(uint32_t core_id);
191extern void z_arc_connect_ici_ack(uint32_t core_id);
192extern uint32_t z_arc_connect_ici_read_status(uint32_t core_id);
193extern uint32_t z_arc_connect_ici_check_src(void);
194extern void z_arc_connect_ici_clear(void);
195
196/* inter-core debug related functions */
197extern void z_arc_connect_debug_reset(uint32_t core_mask);
198extern void z_arc_connect_debug_halt(uint32_t core_mask);
199extern void z_arc_connect_debug_run(uint32_t core_mask);
200extern void z_arc_connect_debug_mask_set(uint32_t core_mask, uint32_t mask);
201extern uint32_t z_arc_connect_debug_mask_read(uint32_t core_mask);
202extern void z_arc_connect_debug_select_set(uint32_t core_mask);
203extern uint32_t z_arc_connect_debug_select_read(void);
204extern uint32_t z_arc_connect_debug_en_read(void);
205extern uint32_t z_arc_connect_debug_cmd_read(void);
206extern uint32_t z_arc_connect_debug_core_read(void);
207
208/* global free-running counter(gfrc) related functions */
209extern void z_arc_connect_gfrc_clear(void);
210extern uint64_t z_arc_connect_gfrc_read(void);
211extern void z_arc_connect_gfrc_enable(void);
212extern void z_arc_connect_gfrc_disable(void);
213extern void z_arc_connect_gfrc_core_set(uint32_t core_mask);
214extern uint32_t z_arc_connect_gfrc_halt_read(void);
215extern uint32_t z_arc_connect_gfrc_core_read(void);
216
217/* interrupt distribute unit related functions */
218extern void z_arc_connect_idu_enable(void);
219extern void z_arc_connect_idu_disable(void);
220extern uint32_t z_arc_connect_idu_read_enable(void);
221extern void z_arc_connect_idu_set_mode(uint32_t irq_num,
222 uint16_t trigger_mode, uint16_t distri_mode);
223extern uint32_t z_arc_connect_idu_read_mode(uint32_t irq_num);
224extern void z_arc_connect_idu_set_dest(uint32_t irq_num, uint32_t core_mask);
225extern uint32_t z_arc_connect_idu_read_dest(uint32_t irq_num);
226extern void z_arc_connect_idu_gen_cirq(uint32_t irq_num);
227extern void z_arc_connect_idu_ack_cirq(uint32_t irq_num);
228extern uint32_t z_arc_connect_idu_check_status(uint32_t irq_num);
229extern uint32_t z_arc_connect_idu_check_source(uint32_t irq_num);
230extern void z_arc_connect_idu_set_mask(uint32_t irq_num, uint32_t mask);
231extern uint32_t z_arc_connect_idu_read_mask(uint32_t irq_num);
232extern uint32_t z_arc_connect_idu_check_first(uint32_t irq_num);
233
234#ifdef __cplusplus
235}
236#endif
237
238#endif /* _ASMLANGUAGE */
239
240#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_ */
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Definition: arc_connect.h:131
uint32_t pw
Definition: arc_connect.h:143
uint32_t val
Definition: arc_connect.h:148
uint32_t idu
Definition: arc_connect.h:144
uint32_t gfrc
Definition: arc_connect.h:143
uint32_t num_cores
Definition: arc_connect.h:144
uint32_t slv
Definition: arc_connect.h:142
uint32_t ipi
Definition: arc_connect.h:142
uint32_t pw_dom
Definition: arc_connect.h:145
uint32_t pad2
Definition: arc_connect.h:144
uint32_t pad
Definition: arc_connect.h:143
uint32_t msg
Definition: arc_connect.h:142
uint32_t pad4
Definition: arc_connect.h:145
uint32_t pad3
Definition: arc_connect.h:145
uint32_t ver
Definition: arc_connect.h:141
uint32_t sem
Definition: arc_connect.h:142
uint32_t dbg
Definition: arc_connect.h:143
Definition: arc_connect.h:118
uint32_t param
Definition: arc_connect.h:124
uint32_t cmd
Definition: arc_connect.h:124
uint32_t val
Definition: arc_connect.h:127
uint32_t pad
Definition: arc_connect.h:124
Definition: arc_connect.h:152
uint32_t pad
Definition: arc_connect.h:158
uint32_t val
Definition: arc_connect.h:161
uint32_t cirqnum
Definition: arc_connect.h:158
uint32_t ver
Definition: arc_connect.h:158
static fdata_t data[2]
Definition: test_fifo_contexts.c:15