RTEMS 6.1-rc7
Loading...
Searching...
No Matches
altera_avalon_timer_regs.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 *
5 * Copyright (C) 2024 Kevin Kirspel
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/******************************************************************************
30* *
31* License Agreement *
32* *
33* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
34* All rights reserved. *
35* *
36* Permission is hereby granted, free of charge, to any person obtaining a *
37* copy of this software and associated documentation files (the "Software"), *
38* to deal in the Software without restriction, including without limitation *
39* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
40* and/or sell copies of the Software, and to permit persons to whom the *
41* Software is furnished to do so, subject to the following conditions: *
42* *
43* The above copyright notice and this permission notice shall be included in *
44* all copies or substantial portions of the Software. *
45* *
46* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
47* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
48* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
49* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
50* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
51* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
52* DEALINGS IN THE SOFTWARE. *
53* *
54* This agreement shall be governed in all respects by the laws of the State *
55* of California and by the laws of the United States of America. *
56* *
57******************************************************************************/
58
59#ifndef __ALTERA_AVALON_TIMER_REGS_H__
60#define __ALTERA_AVALON_TIMER_REGS_H__
61
62#include <bsp_system.h>
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68#define ALTERA_AVALON_TIMER_STATUS_TO_MSK (0x1)
69#define ALTERA_AVALON_TIMER_STATUS_TO_OFST (0)
70#define ALTERA_AVALON_TIMER_STATUS_RUN_MSK (0x2)
71#define ALTERA_AVALON_TIMER_STATUS_RUN_OFST (1)
72
73#define ALTERA_AVALON_TIMER_CONTROL_ITO_MSK (0x1)
74#define ALTERA_AVALON_TIMER_CONTROL_ITO_OFST (0)
75#define ALTERA_AVALON_TIMER_CONTROL_CONT_MSK (0x2)
76#define ALTERA_AVALON_TIMER_CONTROL_CONT_OFST (1)
77#define ALTERA_AVALON_TIMER_CONTROL_START_MSK (0x4)
78#define ALTERA_AVALON_TIMER_CONTROL_START_OFST (2)
79#define ALTERA_AVALON_TIMER_CONTROL_STOP_MSK (0x8)
80#define ALTERA_AVALON_TIMER_CONTROL_STOP_OFST (3)
81
82#define ALTERA_AVALON_TIMER_PERIODL_MSK (0xFFFF)
83#define ALTERA_AVALON_TIMER_PERIODL_OFST (0)
84
85#define ALTERA_AVALON_TIMER_PERIODH_MSK (0xFFFF)
86#define ALTERA_AVALON_TIMER_PERIODH_OFST (0)
87
88#define ALTERA_AVALON_TIMER_SNAPL_MSK (0xFFFF)
89#define ALTERA_AVALON_TIMER_SNAPL_OFST (0)
90
91#define ALTERA_AVALON_TIMER_SNAPH_MSK (0xFFFF)
92#define ALTERA_AVALON_TIMER_SNAPH_OFST (0)
93
94#define ALTERA_AVALON_TIMER_PERIOD_0_MSK (0xFFFF)
95#define ALTERA_AVALON_TIMER_PERIOD_0_OFST (0)
96
97#define ALTERA_AVALON_TIMER_PERIOD_1_MSK (0xFFFF)
98#define ALTERA_AVALON_TIMER_PERIOD_1_OFST (0)
99
100#define ALTERA_AVALON_TIMER_PERIOD_2_MSK (0xFFFF)
101#define ALTERA_AVALON_TIMER_PERIOD_2_OFST (0)
102
103#define ALTERA_AVALON_TIMER_PERIOD_3_MSK (0xFFFF)
104#define ALTERA_AVALON_TIMER_PERIOD_3_OFST (0)
105
106#define ALTERA_AVALON_TIMER_SNAP_0_MSK (0xFFFF)
107#define ALTERA_AVALON_TIMER_SNAP_0_OFST (0)
108
109#define ALTERA_AVALON_TIMER_SNAP_1_MSK (0xFFFF)
110#define ALTERA_AVALON_TIMER_SNAP_1_OFST (0)
111
112#define ALTERA_AVALON_TIMER_SNAP_2_MSK (0xFFFF)
113#define ALTERA_AVALON_TIMER_SNAP_2_OFST (0)
114
115#define ALTERA_AVALON_TIMER_SNAP_3_MSK (0xFFFF)
116#define ALTERA_AVALON_TIMER_SNAP_3_OFST (0)
117
118#define MTIMECMP_MAX_VALUE 0xFFFFFFFFFFFFFFFF
119
120typedef struct
121{
122 volatile uint32_t status;
123 volatile uint32_t control;
124 volatile uint32_t period_lo;
125 volatile uint32_t period_hi;
126 volatile uint32_t snap_lo;
127 volatile uint32_t snap_hi;
129
130typedef struct
131{
132 volatile uint32_t status;
133 volatile uint32_t control;
134 volatile uint32_t period_0;
135 volatile uint32_t period_1;
136 volatile uint32_t period_2;
137 volatile uint32_t period_3;
138 volatile uint32_t snap_0;
139 volatile uint32_t snap_1;
140 volatile uint32_t snap_2;
141 volatile uint32_t snap_3;
143
144typedef struct
145{
146 volatile uint32_t status;
147 volatile uint32_t control;
148 volatile uint32_t period;
149 volatile uint32_t snap;
150 volatile uint32_t prescalar;
152
153typedef struct
154{
155 volatile uint32_t mtimecmp_lo;
156 volatile uint32_t mtimecmp_hi;
157 volatile uint32_t mtime_lo;
158 volatile uint32_t mtime_hi;
160
161#define CLOCK_REGS \
162 ((volatile altera_niosv_timer_regs* )ALT_CPU_MTIME_OFFSET)
163#define CLOCK_FREQ ALT_CPU_FREQ
164#define CLOCK_VECTOR NIOSV_INTERRUPT_VECTOR_TIMER
165
166#define TIMER_REGS \
167 ((volatile altera_avalon_timer_precale_regs* )BENCHMARK_TIMER_BASE)
168#define TIMER_FREQ BENCHMARK_TIMER_FREQ
169#define TIMER_VECTOR BENCHMARK_TIMER_IRQ
170
171#define WATCHDOG_REGS \
172 ((volatile altera_avalon_timer_regs_32* )WATCHDOG_TIMER_BASE)
173#define WATCHDOG_FREQ WATCHDOG_TIMER_FREQ
174#define WATCHDOG_VECTOR WATCHDOG_TIMER_IRQ
175
176#ifdef __cplusplus
177}
178#endif
179
180#endif /* __ALTERA_AVALON_TIMER_REGS_H__ */
Definition: altera_avalon_timer_regs.h:145
Definition: altera_avalon_timer_regs.h:121
Definition: altera_avalon_timer_regs.h:131
Definition: altera_avalon_timer_regs.h:154
Definition: intercom.c:87