source: rtems/c/src/lib/libbsp/sparc/shared/include/drvmgr/ambapp_bus.h @ 4a7d1026

4.115
Last change on this file since 4a7d1026 was 4a7d1026, checked in by Daniel Hellstrom <daniel@…>, on 04/13/15 at 08:25:52

sparc bsps: updated license to rtems.org

  • Property mode set to 100644
File size: 5.8 KB
Line 
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_GRPCI_ID          DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCIFBRG)
45#define DRIVER_AMBAPP_GAISLER_GRPWM_ID          DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRPWM)
46#define DRIVER_AMBAPP_GAISLER_GRPWRX_ID         DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PW2APB)
47#define DRIVER_AMBAPP_GAISLER_GRSPW_ID          DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW)
48#define DRIVER_AMBAPP_GAISLER_GRSPW2_ID         DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW2)
49#define DRIVER_AMBAPP_GAISLER_GRTC_ID           DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRTC)
50#define DRIVER_AMBAPP_GAISLER_GRTM_ID           DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_GRTM)
51#define DRIVER_AMBAPP_GAISLER_I2CMST_ID         DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_I2CMST)
52#define DRIVER_AMBAPP_GAISLER_OCCAN_ID          DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_CANAHB)
53#define DRIVER_AMBAPP_GAISLER_PCIF_ID           DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCIF)
54#define DRIVER_AMBAPP_GAISLER_PCITRACE_ID       DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_PCITRACE)
55#define DRIVER_AMBAPP_GAISLER_SPICTRL_ID        DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPICTRL)
56#define DRIVER_AMBAPP_GAISLER_SPWCUC_ID         DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPWCUC)
57#define DRIVER_AMBAPP_GAISLER_SPW_ROUTER_ID     DRIVER_AMBAPP_ID(VENDOR_GAISLER, GAISLER_SPW_ROUTER)
58
59/*** ESA Hardware Device Driver IDs ***/
60#define DRIVER_AMBAPP_ESA_MCTRL_ID              DRIVER_AMBAPP_ID(VENDOR_ESA, ESA_MCTRL)
61#define DRIVER_AMBAPP_MCTRL_ID                  DRIVER_AMBAPP_ESA_MCTRL_ID
62
63struct amba_dev_id {
64        unsigned short          vendor;
65        unsigned short          device;
66        /* Version ? */
67};
68
69struct amba_drv_info {
70        struct drvmgr_drv       general;        /* General bus info */
71        /* AMBA specific bus information */
72        struct amba_dev_id              *ids;           /* Supported hardware */
73};
74
75struct amba_dev_info {
76        struct amba_dev_id      id;
77        struct ambapp_core      info;
78};
79
80struct ambapp_ops {
81        int     (*int_register)
82                (struct drvmgr_dev *dev, int index, const char *info, drvmgr_isr isr, void *arg);
83        int     (*int_unregister)
84                (struct drvmgr_dev *dev, int index, drvmgr_isr isr, void *arg);
85        int     (*int_clear)(struct drvmgr_dev *dev, int index);
86        int     (*int_mask)(struct drvmgr_dev *dev, int index);
87        int     (*int_unmask)(struct drvmgr_dev *dev, int index);
88        int     (*get_params)
89                (struct drvmgr_dev *, struct drvmgr_bus_params *);
90};
91
92struct ambapp_config {
93        struct ambapp_bus               *abus;          /* Prescanned AMBA PnP bus */
94        struct ambapp_ops               *ops;           /* AMBA bus operations */
95        struct drvmgr_map_entry         *maps_up;       /* Bus memory map up-stream towards CPU */
96        struct drvmgr_map_entry         *maps_down;     /* Bus memory map down-stream towards HW */
97        struct drvmgr_bus_res           *resources;     /* Driver Resources */
98        int                             bus_type;       /* Set DRVMGR_BUS_TYPE_AMBAPP_DIST if distributed AMBA Bus */
99        struct drvmgr_func              *funcs;         /* Custom functions */
100};
101
102/*** Bus operations with READ/WRITE access operations ***
103 *
104 * The functions are implemented using the standard drvmgr RW interface
105 */
106#define AMBAPP_R8        DRVMGR_RWFUNC(RW_SIZE_1|RW_READ|RW_REG)
107#define AMBAPP_R16       DRVMGR_RWFUNC(RW_SIZE_2|RW_READ|RW_REG)
108#define AMBAPP_R32       DRVMGR_RWFUNC(RW_SIZE_4|RW_READ|RW_REG)
109#define AMBAPP_R64       DRVMGR_RWFUNC(RW_SIZE_8|RW_READ|RW_REG)
110#define AMBAPP_W8        DRVMGR_RWFUNC(RW_SIZE_1|RW_WRITE|RW_REG)
111#define AMBAPP_W16       DRVMGR_RWFUNC(RW_SIZE_2|RW_WRITE|RW_REG)
112#define AMBAPP_W32       DRVMGR_RWFUNC(RW_SIZE_4|RW_WRITE|RW_REG)
113#define AMBAPP_W64       DRVMGR_RWFUNC(RW_SIZE_8|RW_WRITE|RW_REG)
114#define AMBAPP_RMEM      DRVMGR_RWFUNC(RW_SIZE_ANY|RW_READ|RW_MEM)
115#define AMBAPP_WMEM      DRVMGR_RWFUNC(RW_SIZE_ANY|RW_WRITE|RW_MEM)
116#define AMBAPP_MEMSET    DRVMGR_RWFUNC(RW_SIZE_ANY|RW_SET|RW_MEM)
117#define AMBAPP_RW_ARG    DRVMGR_RWFUNC(RW_ARG)
118
119/* Register an ambapp bus on-top of a device */
120extern int ambapp_bus_register(
121        struct drvmgr_dev *dev,
122        struct ambapp_config *config
123        );
124
125extern void ambapp_bus_freq_register(
126        struct drvmgr_dev *dev,
127        int amba_interface,
128        unsigned int freq_hz);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif
Note: See TracBrowser for help on using the repository browser.