RTEMS 6.1-rc2
Loading...
Searching...
No Matches
grlib.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
9/*
10 * COPYRIGHT (c) 2012
11 * Aeroflex Gaisler
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __GRLIB_H__
36#define __GRLIB_H__
37
38#include <stdbool.h>
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
52/* ESA MEMORY CONTROLLER */
53struct mctrl_regs {
54 unsigned int mcfg1;
55 unsigned int mcfg2;
56 unsigned int mcfg3;
57};
58
59/* APB UART */
61 volatile unsigned int data;
62 volatile unsigned int status;
63 volatile unsigned int ctrl;
64 volatile unsigned int scaler;
65};
66
67/* IRQMP and IRQAMP interrupt controller timestamps */
69 volatile unsigned int counter; /* 0x00 */
70 volatile unsigned int control; /* 0x04 */
71 volatile unsigned int assertion; /* 0x08 */
72 volatile unsigned int ack; /* 0x0c */
73};
74
75static inline bool irqmp_has_timestamp(
76 volatile struct irqmp_timestamp_regs *irqmp_ts
77)
78{
79 return (irqmp_ts->control >> 27) > 0;
80}
81
82/* IRQMP and IRQAMP interrupt controllers */
83struct irqmp_regs {
84 volatile unsigned int ilevel; /* 0x00 */
85 volatile unsigned int ipend; /* 0x04 */
86 volatile unsigned int iforce; /* 0x08 */
87 volatile unsigned int iclear; /* 0x0c */
88 volatile unsigned int mpstat; /* 0x10 */
89 volatile unsigned int bcast; /* 0x14 */
90 volatile unsigned int notused02; /* 0x18 */
91 volatile unsigned int wdgctrl; /* 0x1c */
92 volatile unsigned int ampctrl; /* 0x20 */
93 volatile unsigned int icsel[2]; /* 0x24,0x28 */
94 volatile unsigned int notused13; /* 0x2c */
95 volatile unsigned int notused20; /* 0x30 */
96 volatile unsigned int notused21; /* 0x34 */
97 volatile unsigned int notused22; /* 0x38 */
98 volatile unsigned int notused23; /* 0x3c */
99 volatile unsigned int mask[16]; /* 0x40 */
100 volatile unsigned int force[16]; /* 0x80 */
101 /* Extended IRQ registers */
102 volatile unsigned int intid[16]; /* 0xc0 */
103 volatile struct irqmp_timestamp_regs timestamp[16]; /* 0x100 */
104 volatile unsigned int resetaddr[4]; /* 0x200 */
105 volatile unsigned int resv0[12]; /* 0x210 - 0x23C */
106 volatile unsigned int pboot; /* 0x240 */
107 volatile unsigned int resv1[47]; /* 0x244 - 0x2FC */
108 volatile unsigned int irqmap[8]; /* 0x300 - 0x31C */
109 volatile unsigned int resv2[824]; /* 0x320 - 0x1000 */
110};
111
112/* GPTIMER Timer instance */
114 volatile unsigned int value;
115 volatile unsigned int reload;
116 volatile unsigned int ctrl;
117 volatile unsigned int notused;
118};
119
120#define GPTIMER_TIMER_CTRL_EN 0x00000001U
121#define GPTIMER_TIMER_CTRL_RS 0x00000002U
122#define GPTIMER_TIMER_CTRL_LD 0x00000004U
123#define GPTIMER_TIMER_CTRL_IE 0x00000008U
124#define GPTIMER_TIMER_CTRL_IP 0x00000010U
125#define GPTIMER_TIMER_CTRL_CH 0x00000020U
126#define GPTIMER_TIMER_CTRL_DH 0x00000040U
127
128/* GPTIMER common registers */
130 volatile unsigned int scaler_value; /* common timer registers */
131 volatile unsigned int scaler_reload;
132 volatile unsigned int cfg;
133 volatile unsigned int notused;
134 struct gptimer_timer_regs timer[7];
135};
136
137/* GRGPIO GPIO */
139 volatile unsigned int data; /* 0x00 I/O port data register */
140 volatile unsigned int output; /* 0x04 I/O port output register */
141 volatile unsigned int dir; /* 0x08 I/O port direction register */
142 volatile unsigned int imask; /* 0x0C Interrupt mask register */
143 volatile unsigned int ipol; /* 0x10 Interrupt polarity register */
144 volatile unsigned int iedge; /* 0x14 Interrupt edge register */
145 volatile unsigned int bypass; /* 0x18 Bypass register */
146 volatile unsigned int cap; /* 0x1C Capability register */
147 volatile unsigned int irqmap[4]; /* 0x20 - 0x2C Interrupt map registers */
148 volatile unsigned int res_30; /* 0x30 Reserved */
149 volatile unsigned int res_34; /* 0x34 Reserved */
150 volatile unsigned int res_38; /* 0x38 Reserved */
151 volatile unsigned int res_3C; /* 0x3C Reserved */
152 volatile unsigned int iavail; /* 0x40 Interrupt available register */
153 volatile unsigned int iflag; /* 0x44 Interrupt flag register */
154 volatile unsigned int res_48; /* 0x48 Reserved */
155 volatile unsigned int pulse; /* 0x4C Pulse register */
156 volatile unsigned int res_50; /* 0x50 Reserved */
157 volatile unsigned int output_or; /* 0x54 I/O port output register, logical-OR */
158 volatile unsigned int dir_or; /* 0x58 I/O port direction register, logical-OR */
159 volatile unsigned int imask_or; /* 0x5C Interrupt mask register, logical-OR */
160 volatile unsigned int res_60; /* 0x60 Reserved */
161 volatile unsigned int output_and; /* 0x64 I/O port output register, logical-AND */
162 volatile unsigned int dir_and; /* 0x68 I/O port direction register, logical-AND */
163 volatile unsigned int imask_and; /* 0x6C Interrupt mask register, logical-AND */
164 volatile unsigned int res_70; /* 0x70 Reserved */
165 volatile unsigned int output_xor; /* 0x74 I/O port output register, logical-XOR */
166 volatile unsigned int dir_xor; /* 0x78 I/O port direction register, logical-XOR */
167 volatile unsigned int imask_xor; /* 0x7C Interrupt mask register, logical-XOR */
168};
169
170/* L2C - Level 2 Cache Controller registers */
171struct l2c_regs {
172 volatile unsigned int control; /* 0x00 Control register */
173 volatile unsigned int status; /* 0x04 Status register */
174 volatile unsigned int flush_mem_addr; /* 0x08 Flush (Memory address) */
175 volatile unsigned int flush_set_index; /* 0x0c Flush (set, index) */
176 volatile unsigned int access_counter; /* 0x10 */
177 volatile unsigned int hit_counter; /* 0x14 */
178 volatile unsigned int bus_cycle_counter; /* 0x18 */
179 volatile unsigned int bus_usage_counter; /* 0x1c */
180 volatile unsigned int error_status_control; /* 0x20 Error status/control */
181 volatile unsigned int error_addr; /* 0x24 Error address */
182 volatile unsigned int tag_check_bit; /* 0x28 TAG-check-bit */
183 volatile unsigned int data_check_bit; /* 0x2c Data-check-bit */
184 volatile unsigned int scrub_control_status; /* 0x30 Scrub Control/Status */
185 volatile unsigned int scrub_delay; /* 0x34 Scrub Delay */
186 volatile unsigned int error_injection; /* 0x38 Error injection */
187 volatile unsigned int access_control; /* 0x3c Access control */
188 volatile unsigned int reserved_40[16]; /* 0x40 Reserved */
189 volatile unsigned int mtrr[32]; /* 0x80 - 0xFC MTRR registers */
190 volatile unsigned int reserved_100[131008]; /* 0x100 Reserved */
191 volatile unsigned int diag_iface_tag[16384]; /* 0x80000 - 0x8FFFC Diagnostic interface (Tag) */
192 volatile unsigned int reserved_90000[376832]; /* 0x90000 Reserved */
193 volatile unsigned int diag_iface_data[524288];/* 0x200000 - 0x3FFFFC Diagnostic interface (Data) */
194};
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif
Definition: grlib.h:60
Definition: intercom.c:87
Definition: grlib.h:129
Definition: grlib.h:113
Definition: grlib.h:138
Definition: grlib.h:83
Definition: grlib.h:68
Definition: grlib.h:171
Definition: grlib.h:53