1 |
28 |
ultra_embe |
//-----------------------------------------------------------------
|
2 |
|
|
// AltOR32
|
3 |
|
|
// Alternative Lightweight OpenRisc
|
4 |
|
|
// V2.0
|
5 |
|
|
// Ultra-Embedded.com
|
6 |
|
|
// Copyright 2011 - 2013
|
7 |
|
|
//
|
8 |
|
|
// Email: admin@ultra-embedded.com
|
9 |
|
|
//
|
10 |
|
|
// License: LGPL
|
11 |
|
|
//-----------------------------------------------------------------
|
12 |
|
|
//
|
13 |
|
|
// Copyright (C) 2011 - 2013 Ultra-Embedded.com
|
14 |
|
|
//
|
15 |
|
|
// This source file may be used and distributed without
|
16 |
|
|
// restriction provided that this copyright statement is not
|
17 |
|
|
// removed from the file and that any derivative work contains
|
18 |
|
|
// the original copyright notice and the associated disclaimer.
|
19 |
|
|
//
|
20 |
|
|
// This source file is free software; you can redistribute it
|
21 |
|
|
// and/or modify it under the terms of the GNU Lesser General
|
22 |
|
|
// Public License as published by the Free Software Foundation;
|
23 |
|
|
// either version 2.1 of the License, or (at your option) any
|
24 |
|
|
// later version.
|
25 |
|
|
//
|
26 |
|
|
// This source is distributed in the hope that it will be
|
27 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
28 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
29 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more
|
30 |
|
|
// details.
|
31 |
|
|
//
|
32 |
|
|
// You should have received a copy of the GNU Lesser General
|
33 |
|
|
// Public License along with this source; if not, write to the
|
34 |
|
|
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
35 |
|
|
// Boston, MA 02111-1307 USA
|
36 |
|
|
//-----------------------------------------------------------------
|
37 |
|
|
#ifndef __PERIPHERAL_H__
|
38 |
|
|
#define __PERIPHERAL_H__
|
39 |
|
|
|
40 |
|
|
//--------------------------------------------------------------------
|
41 |
|
|
// Class
|
42 |
|
|
//--------------------------------------------------------------------
|
43 |
|
|
class Peripheral
|
44 |
|
|
{
|
45 |
|
|
public:
|
46 |
|
|
// Peripheral access
|
47 |
|
|
virtual void Reset(void) = 0;
|
48 |
|
|
virtual void Clock(void) = 0;
|
49 |
|
|
virtual TRegister Access(TAddress addr, TRegister data_in, TRegister wr, TRegister rd) = 0;
|
50 |
|
|
virtual bool Interrupt(void) = 0;
|
51 |
|
|
virtual TAddress GetStartAddress() = 0;
|
52 |
|
|
virtual TAddress GetStopAddress() = 0;
|
53 |
|
|
};
|
54 |
|
|
|
55 |
|
|
//--------------------------------------------------------------------
|
56 |
|
|
// Class
|
57 |
|
|
//--------------------------------------------------------------------
|
58 |
|
|
class PeripheralInstance
|
59 |
|
|
{
|
60 |
|
|
public:
|
61 |
|
|
PeripheralInstance() { instance = NULL; start_address = end_address = 0; }
|
62 |
|
|
|
63 |
|
|
public:
|
64 |
|
|
Peripheral * instance;
|
65 |
|
|
TRegister start_address;
|
66 |
|
|
TRegister end_address;
|
67 |
|
|
};
|
68 |
|
|
|
69 |
|
|
#endif
|