RTEMS: bsps/include/grlib/ambapp_bus.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
ambapp_bus.h
1/* General part of a AMBA Plug & Play bus driver.
2 *
3 * COPYRIGHT (c) 2008.
4 * Cobham Gaisler AB.
5 *
6 * This is the general part of the different AMBA Plug & Play
7 * drivers. The drivers are wrappers around this driver, making
8 * the code size smaller for systems with multiple AMBA Plug &
9 * Play buses.
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef __AMBAPP_BUS_H__
17#define __AMBAPP_BUS_H__
18
19#include <drvmgr/drvmgr.h>
20#include "ambapp.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/* GRLIB AMBA Plug&Play Driver ID generation */
27#define DRIVER_AMBAPP_ID(vendor, device) \
28 DRIVER_ID(DRVMGR_BUS_TYPE_AMBAPP, ((((vendor) & 0xff) << 16) | ((device) & 0xfff)))
29
30/*** Gaisler Hardware Device Driver IDs ***/
31#define DRIVER_AMBAPP_GAISLER_AHBSTAT_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_AHBSTAT)
32#define DRIVER_AMBAPP_GAISLER_APBUART_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_APBUART)
33#define DRIVER_AMBAPP_GAISLER_B1553BRM_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_B1553BRM)
34#define DRIVER_AMBAPP_GAISLER_B1553RT_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_B1553RT)
35#define DRIVER_AMBAPP_GAISLER_GPTIMER_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GPTIMER)
36#define DRIVER_AMBAPP_GAISLER_GR1553B_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GR1553B)
37#define DRIVER_AMBAPP_GAISLER_GRADCDAC_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRADCDAC)
38#define DRIVER_AMBAPP_GAISLER_GRAES_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRAESDMA)
39#define DRIVER_AMBAPP_GAISLER_GRCAN_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRCAN)
40#define DRIVER_AMBAPP_GAISLER_GRCTM_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRCTM)
41#define DRIVER_AMBAPP_GAISLER_GRETH_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_ETHMAC)
42#define DRIVER_AMBAPP_GAISLER_GRGPIO_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GPIO)
43#define DRIVER_AMBAPP_GAISLER_GRPCI2_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRPCI2)
44#define DRIVER_AMBAPP_GAISLER_GRIOMMU_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRIOMMU)
45#define DRIVER_AMBAPP_GAISLER_GRPCI_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCIFBRG)
46#define DRIVER_AMBAPP_GAISLER_GRPWM_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRPWM)
47#define DRIVER_AMBAPP_GAISLER_GRPWRX_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PW2APB)
48#define DRIVER_AMBAPP_GAISLER_GRSPW_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW)
49#define DRIVER_AMBAPP_GAISLER_GRSPW2_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW2)
50#define DRIVER_AMBAPP_GAISLER_GRTC_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRTC)
51#define DRIVER_AMBAPP_GAISLER_GRTM_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRTM)
52#define DRIVER_AMBAPP_GAISLER_I2CMST_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_I2CMST)
53#define DRIVER_AMBAPP_GAISLER_OCCAN_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_CANAHB)
54#define DRIVER_AMBAPP_GAISLER_PCIF_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCIF)
55#define DRIVER_AMBAPP_GAISLER_PCITRACE_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCITRACE)
56#define DRIVER_AMBAPP_GAISLER_SPICTRL_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPICTRL)
57#define DRIVER_AMBAPP_GAISLER_SPWCUC_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPWCUC)
58#define DRIVER_AMBAPP_GAISLER_SPW_ROUTER_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW_ROUTER)
59#define DRIVER_AMBAPP_GAISLER_L2CACHE_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_L2CACHE)
60#define DRIVER_AMBAPP_GAISLER_MEMSCRUB_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_MEMSCRUB)
61#define DRIVER_AMBAPP_GAISLER_L4STAT_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_L4STAT)
62#define DRIVER_AMBAPP_GAISLER_SPWTDP_ID DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPWTDP)
63
64/*** ESA Hardware Device Driver IDs ***/
65#define DRIVER_AMBAPP_ESA_MCTRL_ID DRIVER_AMBAPP_ID(VENDOR_ESA, ESA_MCTRL)
66#define DRIVER_AMBAPP_MCTRL_ID DRIVER_AMBAPP_ESA_MCTRL_ID
67
68 struct amba_dev_id {
69 unsigned short vendor;
70 unsigned short device;
71 /* Version ? */
72};
73
74 struct amba_drv_info {
75 struct drvmgr_drv general; /* General bus info */
76 /* AMBA specific bus information */
77 struct amba_dev_id *ids; /* Supported hardware */
78};
79
80 struct amba_dev_info {
81 struct amba_dev_id id;
82 struct ambapp_core info;
83};
84
85 struct ambapp_ops {
86 int (*int_register)
87 (struct drvmgr_dev *dev, int index, const char *info, drvmgr_isr isr, void *arg);
88 int (*int_unregister)
89 (struct drvmgr_dev *dev, int index, drvmgr_isr isr, void *arg);
90 int (*int_clear)(struct drvmgr_dev *dev, int index);
91 int (*int_mask)(struct drvmgr_dev *dev, int index);
92 int (*int_unmask)(struct drvmgr_dev *dev, int index);
93#ifdef RTEMS_SMP
94 int (*int_set_affinity)(struct drvmgr_dev *dev, int index,
95 const Processor_mask *cpus);
96#endif
97 int (*get_params)
98 (struct drvmgr_dev *, struct drvmgr_bus_params *);
99};
100
101 struct ambapp_config {
102 struct ambapp_bus *abus; /* Prescanned AMBA PnP bus */
103 struct ambapp_ops *ops; /* AMBA bus operations */
104 struct drvmgr_map_entry *maps_up; /* Bus memory map up-stream towards CPU */
105 struct drvmgr_map_entry *maps_down; /* Bus memory map down-stream towards HW */
106 struct drvmgr_bus_res *resources; /* Driver Resources */
107 int bus_type; /* Set DRVMGR_BUS_TYPE_AMBAPP_DIST if distributed AMBA Bus */
108 struct drvmgr_func *funcs; /* Custom functions */
109};
110
111/*** Bus operations with READ/WRITE access operations ***
112 *
113 * The functions are implemented using the standard drvmgr RW interface
114 */
115#define AMBAPP_R8 DRVMGR_RWFUNC(RW_SIZE_1|RW_READ|RW_REG)
116#define AMBAPP_R16 DRVMGR_RWFUNC(RW_SIZE_2|RW_READ|RW_REG)
117#define AMBAPP_R32 DRVMGR_RWFUNC(RW_SIZE_4|RW_READ|RW_REG)
118#define AMBAPP_R64 DRVMGR_RWFUNC(RW_SIZE_8|RW_READ|RW_REG)
119#define AMBAPP_W8 DRVMGR_RWFUNC(RW_SIZE_1|RW_WRITE|RW_REG)
120#define AMBAPP_W16 DRVMGR_RWFUNC(RW_SIZE_2|RW_WRITE|RW_REG)
121#define AMBAPP_W32 DRVMGR_RWFUNC(RW_SIZE_4|RW_WRITE|RW_REG)
122#define AMBAPP_W64 DRVMGR_RWFUNC(RW_SIZE_8|RW_WRITE|RW_REG)
123#define AMBAPP_RMEM DRVMGR_RWFUNC(RW_SIZE_ANY|RW_READ|RW_MEM)
124#define AMBAPP_WMEM DRVMGR_RWFUNC(RW_SIZE_ANY|RW_WRITE|RW_MEM)
125#define AMBAPP_MEMSET DRVMGR_RWFUNC(RW_SIZE_ANY|RW_SET|RW_MEM)
126#define AMBAPP_RW_ARG DRVMGR_RWFUNC(RW_ARG)
127
128/* Register an ambapp bus on-top of a device */
129extern int ambapp_bus_register(
130 struct drvmgr_dev *dev,
131 struct ambapp_config *config
132 );
133
134extern void ambapp_bus_freq_register(
135 struct drvmgr_dev *dev,
136 int amba_interface,
137 unsigned int freq_hz);
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif
ambapp.h
amba_dev_id
Definition: ambapp_bus.h:68
amba_dev_info
Definition: ambapp_bus.h:80
amba_drv_info
Definition: ambapp_bus.h:74
ambapp_bus
Definition: ambapp.h:126
ambapp_config
Definition: ambapp_bus.h:101
ambapp_core
Definition: ambapp.h:102
ambapp_ops
Definition: ambapp_bus.h:85
config_s
Definition: deflate.c:115
device
Definition: rtemscompat1.h:15
drvmgr_bus_params
Definition: drvmgr.h:121
drvmgr_bus_res
Definition: drvmgr.h:214
drvmgr_dev
Definition: drvmgr.h:273
drvmgr_drv
Definition: drvmgr.h:303
drvmgr_func
Definition: drvmgr.h:158
drvmgr_map_entry
Definition: drvmgr.h:225