1 |
2 |
feddischso |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// PLB2WB-Bridge ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the PLB-to-WB-Bridge project ////
|
6 |
|
|
//// http://opencores.org/project,plb2wbbridge ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// Implementation of a PLB-to-WB-Bridge according to ////
|
10 |
|
|
//// PLB-to-WB Bridge specification document. ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// To Do: ////
|
13 |
|
|
//// Nothing ////
|
14 |
|
|
//// ////
|
15 |
|
|
//// Author(s): ////
|
16 |
|
|
//// - Christian Haettich ////
|
17 |
|
|
//// feddischson@opencores.org ////
|
18 |
|
|
//// ////
|
19 |
|
|
//////////////////////////////////////////////////////////////////////
|
20 |
|
|
//// ////
|
21 |
|
|
//// Copyright (C) 2010 Authors ////
|
22 |
|
|
//// ////
|
23 |
|
|
//// This source file may be used and distributed without ////
|
24 |
|
|
//// restriction provided that this copyright statement is not ////
|
25 |
|
|
//// removed from the file and that any derivative work contains ////
|
26 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
27 |
|
|
//// ////
|
28 |
|
|
//// This source file is free software; you can redistribute it ////
|
29 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
30 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
31 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
32 |
|
|
//// later version. ////
|
33 |
|
|
//// ////
|
34 |
|
|
//// This source is distributed in the hope that it will be ////
|
35 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
36 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
37 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
38 |
|
|
//// details. ////
|
39 |
|
|
//// ////
|
40 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
41 |
|
|
//// Public License along with this source; if not, download it ////
|
42 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
43 |
|
|
//// ////
|
44 |
|
|
//////////////////////////////////////////////////////////////////////
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
#ifndef PLB2WB_BRIDGE_H
|
48 |
|
|
#define PLB2WB_BRIDGE_H
|
49 |
|
|
|
50 |
|
|
#include "xparameters.h"
|
51 |
|
|
#include "xbasic_types.h"
|
52 |
|
|
#include "xintc.h"
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
//
|
56 |
|
|
// PLB2WB-Bridge registers and irq-id
|
57 |
|
|
//
|
58 |
|
|
#define PLB2WB_STATUS 0x00
|
59 |
|
|
#define PLB2WB_STATUS_DAT 0x04
|
60 |
|
|
#define PLB2WB_STATUS_ADR 0x08
|
61 |
|
|
#define PLB2WB_STATUS_IRQ 0x0c
|
62 |
|
|
#define PLB2WB_STATUS_CON 0x04
|
63 |
|
|
#define PLB2WB_STATUS_ABO 0x08
|
64 |
|
|
#define PLB2WB_STATUS_RST 0x0c
|
65 |
|
|
|
66 |
|
|
#define PLB2WB_STATUS_WERR 0x20000000
|
67 |
|
|
#define PLB2WB_STATUS_WBRST 0x40000000
|
68 |
|
|
#define PLB2WB_STATUS_WBIRQ 0x80000000
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
typedef struct {
|
73 |
|
|
XInterruptHandler Handler;
|
74 |
|
|
void *CallBackRef;
|
75 |
|
|
} PLB2WB_Bridge_VectorTableEntry;
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
typedef struct{
|
79 |
|
|
|
80 |
|
|
u32 BaseAddress;
|
81 |
|
|
u32 StatusBaseAddress;
|
82 |
|
|
u16 DeviceId;
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
} PLB2WB_Bridge_Config;
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
typedef struct{
|
90 |
|
|
|
91 |
|
|
u32 BaseAddress;
|
92 |
|
|
u32 StatusBaseAddress;
|
93 |
|
|
u32 IsReady;
|
94 |
|
|
u32 UnhandledInterrupts;
|
95 |
|
|
PLB2WB_Bridge_Config *CfgPtr;
|
96 |
|
|
u8 irqID;
|
97 |
|
|
XIntc* xintcInstancePtr;
|
98 |
|
|
|
99 |
|
|
PLB2WB_Bridge_VectorTableEntry HandlerTable[ XPAR_PLB2WB_BRIDGE_0_WB_PIC_INTS ]; // wishbone peripheral irqs
|
100 |
|
|
PLB2WB_Bridge_VectorTableEntry WBWrErrorHandler; // wishbone write error handler
|
101 |
|
|
PLB2WB_Bridge_VectorTableEntry WBRstHandler; // wishbone reset handler
|
102 |
|
|
|
103 |
|
|
}PLB2WB_Bridge;
|
104 |
|
|
|
105 |
|
|
extern PLB2WB_Bridge_Config PLB2WB_Bridge_ConfigTable[];
|
106 |
|
|
|
107 |
|
|
int PLB2WB_Bridge_Initialize ( PLB2WB_Bridge* InstancePtr, u16 DeviceId,
|
108 |
|
|
XIntc* xintcInstancePtr, u8 irqID );
|
109 |
|
|
int PLB2WB_Bridge_Connect ( PLB2WB_Bridge*, u8, XInterruptHandler, void* );
|
110 |
|
|
void PLB2WB_Bridge_Disconnect ( PLB2WB_Bridge * InstancePtr, u8 Id );
|
111 |
|
|
void PLB2WB_Bridge_DeviceInterruptHandler( void* ptr );
|
112 |
|
|
|
113 |
|
|
int PLB2WB_Bridge_Connect_WBWrErrHandler( PLB2WB_Bridge* InstancePtr, XInterruptHandler Handler, void* CallBackRef );
|
114 |
|
|
int PLB2WB_Bridge_Connect_WBRstHandler ( PLB2WB_Bridge* InstancePtr, XInterruptHandler Handler, void* CallBackRef );
|
115 |
|
|
|
116 |
|
|
void PLB2WB_Bridge_WBContinue ( PLB2WB_Bridge* InstancePtr );
|
117 |
|
|
void PLB2WB_Bridge_WBAbort ( PLB2WB_Bridge* InstancePtr );
|
118 |
|
|
void PLB2WB_Bridge_SoftReset ( PLB2WB_Bridge* InstancePtr );
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
#endif
|