RTEMS 7.0-rc1
Loading...
Searching...
No Matches
bsp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * COPYRIGHT (c) 1989-1999.
13 * On-Line Applications Research Corporation (OAR).
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef LIBBSP_NIOS2_NIOS2_ISS_BSP_H
38#define LIBBSP_NIOS2_NIOS2_ISS_BSP_H
39
50#include <stdint.h>
51#include <bspopts.h>
53
54#include <rtems.h>
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60/* ============================================ */
61
62/* SOPC-specific Constants */
63
64#define SYSTEM_BUS_WIDTH 32
65
66#define JTAG_UART_BASE 0x08000000
67#define JTAG_UART_IRQ 2
68
69#define CLOCK_BASE 0x08001000
70#define CLOCK_FREQ 50000000
71#define CLOCK_VECTOR 1
72
73#define TIMER_BASE 0x08002000
74#define TIMER_FREQ 50000000
75#define TIMER_VECTOR 3
76
77/* ============================================ */
78
79#define NIOS2_BYPASS_CACHE ((uint32_t)0x80000000ul)
80#define NIOS2_IO_BASE(x) ( (void*) ((uint32_t)x | NIOS2_BYPASS_CACHE ) )
81#define NIOS2_IENABLE(x) do{ __builtin_wrctl(3,__builtin_rdctl(3)|x);}while(0)
82#define NIOS2_IRQ_ENABLE(x) do {__builtin_wrctl(3,__builtin_rdctl(3)|x);} while(0)
83
84/* ============================================ */
85/* TODO: Put this in an external header file */
86
87#ifndef SYSTEM_BUS_WIDTH
88#error SYSTEM_BUS_WIDTH is undefined
89#endif
90
91#if SYSTEM_BUS_WIDTH != 32
92#error Only SYSTEM_BUS_WIDTH 32 is supported
93#endif
94
95typedef struct
96{
97 volatile uint32_t status;
98 volatile uint32_t control;
99 volatile uint32_t period_lo;
100 volatile uint32_t period_hi;
101 volatile uint32_t snap_lo;
102 volatile uint32_t snap_hi;
103}
105
106#define ALTERA_AVALON_TIMER_STATUS_TO_MSK (0x1)
107#define ALTERA_AVALON_TIMER_STATUS_TO_OFST (0)
108#define ALTERA_AVALON_TIMER_STATUS_RUN_MSK (0x2)
109#define ALTERA_AVALON_TIMER_STATUS_RUN_OFST (1)
110
111#define ALTERA_AVALON_TIMER_CONTROL_ITO_MSK (0x1)
112#define ALTERA_AVALON_TIMER_CONTROL_ITO_OFST (0)
113#define ALTERA_AVALON_TIMER_CONTROL_CONT_MSK (0x2)
114#define ALTERA_AVALON_TIMER_CONTROL_CONT_OFST (1)
115#define ALTERA_AVALON_TIMER_CONTROL_START_MSK (0x4)
116#define ALTERA_AVALON_TIMER_CONTROL_START_OFST (2)
117#define ALTERA_AVALON_TIMER_CONTROL_STOP_MSK (0x8)
118#define ALTERA_AVALON_TIMER_CONTROL_STOP_OFST (3)
119
120typedef struct
121{
122 volatile uint32_t data;
123 volatile uint32_t control;
124}
126
127#define ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK (0x000000FFu)
128#define ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST (0)
129#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK (0x00008000u)
130#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_OFST (15)
131#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_MSK (0xFFFF0000u)
132#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_OFST (16)
133
134#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK (0x00000001u)
135#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_OFST (0)
136#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK (0x00000002u)
137#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_OFST (1)
138#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK (0x00000100u)
139#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_OFST (8)
140#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK (0x00000200u)
141#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_OFST (9)
142#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK (0x00000400u)
143#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_OFST (10)
144#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK (0xFFFF0000u)
145#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST (16)
146
147/* ============================================ */
148
149#ifdef __cplusplus
150}
151#endif
152
155#endif
156/* end of include file */
This header file provides the default definition of BSP_INITIAL_EXTENSION.
This header file defines the RTEMS Classic API.
Definition: bsp.h:121
Definition: bsp.h:96
Definition: intercom.c:87