RTEMS: bsps/sparc/include/drvmgr/leon2_amba_bus.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
leon2_amba_bus.h
1/* LEON2 Hardcoded bus driver interface.
2 *
3 * COPYRIGHT (c) 2008.
4 * Cobham Gaisler AB.
5 *
6 * Bus driver for a hardcoded setup. LEON2 systems have some
7 * cores always present, here called "Standard Cores". In
8 * addtion to the standard cores there are often extra cores
9 * that can be defined using the "Custom Cores" mechanism.
10 *
11 * A Core is described by assigning a base register and
12 * IRQ0..IRQ15 using the leon2_core structure.
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef __LEON2_AMBA_BUS_H__
20#define __LEON2_AMBA_BUS_H__
21
22/*** Cores location and IRQs hardcoded ***/
23
24#include <drvmgr/drvmgr.h>
25#include <grlib/ambapp.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* LEON2 AMBA Driver ID generation */
32#define DRIVER_LEON2_AMBA(id) DRIVER_ID(DRVMGR_BUS_TYPE_LEON2_AMBA, id)
33
34/* LEON2 Cores (any unique 48-bit number will do) */
35#define LEON2_AMBA_NONE_ID 0
36#define LEON2_AMBA_TIMER_ID 1
37#define LEON2_AMBA_UART_ID 2
38#define LEON2_AMBA_GPIO_ID 3
39#define LEON2_AMBA_IRQCTRL_ID 4
40
41#define LEON2_AMBA_AT697PCI_ID 100
42#define LEON2_AMBA_AMBAPP_ID 0xfff0
43
44/* LEON2 driver IDs */
45#define DRIVER_LEON2_AMBA_TIMER DRIVER_LEON2_AMBA(LEON2_AMBA_TIMER_ID)
46#define DRIVER_LEON2_AMBA_UART DRIVER_LEON2_AMBA(LEON2_AMBA_UART_ID)
47#define DRIVER_LEON2_AMBA_AT697PCI DRIVER_LEON2_AMBA(LEON2_AMBA_AT697PCI_ID)
48#define DRIVER_LEON2_AMBA_AMBAPP DRIVER_LEON2_AMBA(LEON2_AMBA_AMBAPP_ID)
49
50 struct leon2_amba_dev_id {
51 unsigned short core_id;
52};
53
54#define EMPTY_LEON2_CORE {{LEON2_AMBA_NONE_ID}, NULL, NULL}
55 struct leon2_core {
56 struct leon2_amba_dev_id id; /* Core ID */
57 char *name; /* Name of Core */
58 struct drvmgr_key *keys; /* Core setup (location, IRQs) */
59};
60
61 struct leon2_bus {
62 struct leon2_core *std_cores; /* The LEON2 standard cores */
63 struct leon2_core *custom_cores; /* Custom cores on the same bus */
64 struct drvmgr_map_entry *maps_up; /* Memory map ip-stream */
65 struct drvmgr_map_entry *maps_down; /* Memory map down-stream */
66};
67
68extern struct leon2_core leon2_std_cores[];
69
70/* Data structure drivers can access */
71 struct leon2_amba_dev_info {
72 unsigned short core_id; /* Core ID */
73 unsigned int reg_base; /* Register base */
74 char irqs[16]; /* 16 irqs */
75};
76
77 struct leon2_amba_drv_info {
78 struct drvmgr_drv general; /* General bus info */
79 /* AMBA specific bus information */
80 struct leon2_amba_dev_id *ids; /* Supported hardware */
81};
82
83/* Initialize LEON2 bus with a configuration
84 * bus_config - What cores, their location and irqs
85 * resources - Driver configuration for the cores specified bus_config
86 */
87int leon2_root_register(
88 struct leon2_bus *bus_config,
89 struct drvmgr_bus_res *resources);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif
ambapp.h
drvmgr_bus_res
Definition: drvmgr.h:214
drvmgr_drv
Definition: drvmgr.h:303
drvmgr_key
Definition: drvmgr.h:198
drvmgr_map_entry
Definition: drvmgr.h:225
leon2_amba_dev_id
Definition: leon2_amba_bus.h:50
leon2_amba_dev_info
Definition: leon2_amba_bus.h:71
leon2_amba_drv_info
Definition: leon2_amba_bus.h:77
leon2_bus
Definition: leon2_amba_bus.h:61
leon2_core
Definition: leon2_amba_bus.h:55