| 1 | /*
|
|---|
| 2 | * Copyright (c) 2010 Lenka Trochtova
|
|---|
| 3 | * Copyright (c) 2011 Jiri Svoboda
|
|---|
| 4 | * Copyright (c) 2013 Jakub Klama
|
|---|
| 5 | * All rights reserved.
|
|---|
| 6 | *
|
|---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 8 | * modification, are permitted provided that the following conditions
|
|---|
| 9 | * are met:
|
|---|
| 10 | *
|
|---|
| 11 | * - Redistributions of source code must retain the above copyright
|
|---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 13 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 14 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 15 | * documentation and/or other materials provided with the distribution.
|
|---|
| 16 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 17 | * derived from this software without specific prior written permission.
|
|---|
| 18 | *
|
|---|
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 | /** @addtogroup amba
|
|---|
| 32 | * @{
|
|---|
| 33 | */
|
|---|
| 34 | /** @file
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | #ifndef AMBAPP_H_
|
|---|
| 38 | #define AMBAPP_H_
|
|---|
| 39 |
|
|---|
| 40 | #include <ddf/driver.h>
|
|---|
| 41 |
|
|---|
| 42 | #define AMBAPP_MAX_DEVICES 64
|
|---|
| 43 | #define AMBAPP_AHBMASTER_AREA 0xfffff000
|
|---|
| 44 | #define AMBAPP_AHBSLAVE_AREA 0xfffff800
|
|---|
| 45 | #define AMBAPP_CONF_AREA 0xff000
|
|---|
| 46 |
|
|---|
| 47 | #define AMBA_MAX_HW_RES (4 + 1)
|
|---|
| 48 |
|
|---|
| 49 | typedef enum {
|
|---|
| 50 | GAISLER = 1,
|
|---|
| 51 | ESA = 4
|
|---|
| 52 | } amba_vendor_id_t;
|
|---|
| 53 |
|
|---|
| 54 | typedef enum {
|
|---|
| 55 | GAISLER_LEON3 = 0x003,
|
|---|
| 56 | GAISLER_LEON3DSU = 0x004,
|
|---|
| 57 | GAISLER_ETHAHB = 0x005,
|
|---|
| 58 | GAISLER_APBMST = 0x006,
|
|---|
| 59 | GAISLER_AHBUART = 0x007,
|
|---|
| 60 | GAISLER_SRCTRL = 0x008,
|
|---|
| 61 | GAISLER_SDCTRL = 0x009,
|
|---|
| 62 | GAISLER_APBUART = 0x00c,
|
|---|
| 63 | GAISLER_IRQMP = 0x00d,
|
|---|
| 64 | GAISLER_AHBRAM = 0x00e,
|
|---|
| 65 | GAISLER_GPTIMER = 0x011,
|
|---|
| 66 | GAISLER_PCITRG = 0x012,
|
|---|
| 67 | GAISLER_PCISBRG = 0x013,
|
|---|
| 68 | GAISLER_PCIFBRG = 0x014,
|
|---|
| 69 | GAISLER_PCITRACE = 0x015,
|
|---|
| 70 | GAISLER_PCIDMA = 0x016,
|
|---|
| 71 | GAISLER_AHBTRACE = 0x017,
|
|---|
| 72 | GAISLER_ETHDSU = 0x018,
|
|---|
| 73 | GAISLER_PIOPORT = 0x01a,
|
|---|
| 74 | GAISLER_AHBJTAG = 0x01c,
|
|---|
| 75 | GAISLER_SPW = 0x01f,
|
|---|
| 76 | GAISLER_ATACTRL = 0x024,
|
|---|
| 77 | GAISLER_VGA = 0x061,
|
|---|
| 78 | GAISLER_KBD = 0x060,
|
|---|
| 79 | GAISLER_ETHMAC = 0x01d,
|
|---|
| 80 | GAISLER_DDRSPA = 0x025,
|
|---|
| 81 | GAISLER_EHCI = 0x026,
|
|---|
| 82 | GAISLER_UHCI = 0x027,
|
|---|
| 83 | GAISLER_SPW2 = 0x029,
|
|---|
| 84 | GAISLER_DDR2SPA = 0x02e,
|
|---|
| 85 | GAISLER_AHBSTAT = 0x052,
|
|---|
| 86 | GAISLER_FTMCTRL = 0x054,
|
|---|
| 87 | ESA_MCTRL = 0x00f
|
|---|
| 88 | } amba_device_id_t;
|
|---|
| 89 |
|
|---|
| 90 | typedef struct {
|
|---|
| 91 | unsigned int addr : 12;
|
|---|
| 92 | unsigned int reserved : 2;
|
|---|
| 93 | unsigned int prefetchable : 1;
|
|---|
| 94 | unsigned int cacheable : 1;
|
|---|
| 95 | unsigned int mask : 12;
|
|---|
| 96 | unsigned int type : 4;
|
|---|
| 97 | } __attribute__((packed)) ambapp_bar_t;
|
|---|
| 98 |
|
|---|
| 99 | typedef struct {
|
|---|
| 100 | unsigned int vendor_id : 8;
|
|---|
| 101 | unsigned int device_id : 24;
|
|---|
| 102 | unsigned int reserved : 2;
|
|---|
| 103 | unsigned int version : 5;
|
|---|
| 104 | unsigned int irq : 5;
|
|---|
| 105 | uint32_t user_defined[3];
|
|---|
| 106 | ambapp_bar_t bar[4];
|
|---|
| 107 | } __attribute__((packed)) ambapp_entry_t;
|
|---|
| 108 |
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | /**
|
|---|
| 112 | * @}
|
|---|
| 113 | */
|
|---|