RTEMS 6.1-rc1
leon2_amba_bus.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 2008.
14 * Cobham Gaisler AB.
15 *
16 * Bus driver for a hardcoded setup. LEON2 systems have some
17 * cores always present, here called "Standard Cores". In
18 * addtion to the standard cores there are often extra cores
19 * that can be defined using the "Custom Cores" mechanism.
20 *
21 * A Core is described by assigning a base register and
22 * IRQ0..IRQ15 using the leon2_core structure.
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 * 1. Redistributions of source code must retain the above copyright
28 * notice, this list of conditions and the following disclaimer.
29 * 2. Redistributions in binary form must reproduce the above copyright
30 * notice, this list of conditions and the following disclaimer in the
31 * documentation and/or other materials provided with the distribution.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
37 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGE.
44 */
45
46#ifndef __LEON2_AMBA_BUS_H__
47#define __LEON2_AMBA_BUS_H__
48
49/*** Cores location and IRQs hardcoded ***/
50
51#include <drvmgr/drvmgr.h>
52#include <grlib/ambapp.h>
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/* LEON2 AMBA Driver ID generation */
59#define DRIVER_LEON2_AMBA(id) DRIVER_ID(DRVMGR_BUS_TYPE_LEON2_AMBA, id)
60
61/* LEON2 Cores (any unique 48-bit number will do) */
62#define LEON2_AMBA_NONE_ID 0
63#define LEON2_AMBA_TIMER_ID 1
64#define LEON2_AMBA_UART_ID 2
65#define LEON2_AMBA_GPIO_ID 3
66#define LEON2_AMBA_IRQCTRL_ID 4
67
68#define LEON2_AMBA_AT697PCI_ID 100
69#define LEON2_AMBA_AMBAPP_ID 0xfff0
70
71/* LEON2 driver IDs */
72#define DRIVER_LEON2_AMBA_TIMER DRIVER_LEON2_AMBA(LEON2_AMBA_TIMER_ID)
73#define DRIVER_LEON2_AMBA_UART DRIVER_LEON2_AMBA(LEON2_AMBA_UART_ID)
74#define DRIVER_LEON2_AMBA_AT697PCI DRIVER_LEON2_AMBA(LEON2_AMBA_AT697PCI_ID)
75#define DRIVER_LEON2_AMBA_AMBAPP DRIVER_LEON2_AMBA(LEON2_AMBA_AMBAPP_ID)
76
78 unsigned short core_id;
79};
80
81#define EMPTY_LEON2_CORE {{LEON2_AMBA_NONE_ID}, NULL, NULL}
82struct leon2_core {
83 struct leon2_amba_dev_id id; /* Core ID */
84 char *name; /* Name of Core */
85 struct drvmgr_key *keys; /* Core setup (location, IRQs) */
86};
87
88struct leon2_bus {
89 struct leon2_core *std_cores; /* The LEON2 standard cores */
90 struct leon2_core *custom_cores; /* Custom cores on the same bus */
91 struct drvmgr_map_entry *maps_up; /* Memory map ip-stream */
92 struct drvmgr_map_entry *maps_down; /* Memory map down-stream */
93};
94
95extern struct leon2_core leon2_std_cores[];
96
97/* Data structure drivers can access */
99 unsigned short core_id; /* Core ID */
100 unsigned int reg_base; /* Register base */
101 char irqs[16]; /* 16 irqs */
102};
103
105 struct drvmgr_drv general; /* General bus info */
106 /* AMBA specific bus information */
107 struct leon2_amba_dev_id *ids; /* Supported hardware */
108};
109
110/* Initialize LEON2 bus with a configuration
111 * bus_config - What cores, their location and irqs
112 * resources - Driver configuration for the cores specified bus_config
113 */
114int leon2_root_register(
115 struct leon2_bus *bus_config,
116 struct drvmgr_bus_res *resources);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
Driver Manager Interface.
Definition: drvmgr.h:238
Definition: drvmgr.h:327
Definition: drvmgr.h:222
Definition: drvmgr.h:249
Definition: leon2_amba_bus.h:77
Definition: leon2_amba_bus.h:98
Definition: leon2_amba_bus.h:104
Definition: leon2_amba_bus.h:88
Definition: leon2_amba_bus.h:82