OpenCores
URL https://opencores.org/ocsvn/wbscope/wbscope/trunk

Subversion Repositories wbscope

[/] [wbscope/] [trunk/] [sw/] [devbus.h] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    devbus.h
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     The purpose of this file is to document an interface which
8
//              any devic with a bus, whether it be implemented over a UART,
9
//      an ethernet, or a PCI express bus, must implement.  This describes only
10
//      an interface, and not how that interface is to be accomplished.
11
//
12
//
13
// Creator:     Dan Gisselquist, Ph.D.
14
//              Gisselquist Technology, LLC
15
//
16
////////////////////////////////////////////////////////////////////////////////
17
//
18
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
19
//
20
// This program is free software (firmware): you can redistribute it and/or
21
// modify it under the terms of  the GNU General Public License as published
22
// by the Free Software Foundation, either version 3 of the License, or (at
23
// your option) any later version.
24
//
25
// This program is distributed in the hope that it will be useful, but WITHOUT
26
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28
// for more details.
29
//
30
// You should have received a copy of the GNU General Public License along
31
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
32
// target there if the PDF file isn't present.)  If not, see
33
// <http://www.gnu.org/licenses/> for a copy.
34
//
35
// License:     GPL, v3, as defined and found on www.gnu.org,
36
//              http://www.gnu.org/licenses/gpl.html
37
//
38
//
39
////////////////////////////////////////////////////////////////////////////////
40
//
41
//
42
#ifndef DEVBUS_H
43
#define DEVBUS_H
44
 
45
#include <stdio.h>
46
#include <unistd.h>
47
 
48
typedef unsigned int    uint32;
49
 
50
class   BUSERR {
51
public:
52
        uint32 addr;
53
        BUSERR(const uint32 a) : addr(a) {};
54
};
55
 
56
class   DEVBUS {
57
public:
58
        typedef uint32  BUSW;
59
 
60
        virtual void    kill(void) = 0;
61
        virtual void    close(void) = 0;
62
 
63
        // Write a single value to a single address
64
        virtual void    writeio(const BUSW a, const BUSW v) = 0;
65
 
66
        // Read a single value to a single address
67
        virtual BUSW    readio(const BUSW a) = 0;
68
 
69
        // Read a series of values from values from a block of memory
70
        virtual void    readi(const BUSW a, const int len, BUSW *buf) = 0;
71
 
72
        // Read a series of values from the same address in memory
73
        virtual void    readz(const BUSW a, const int len, BUSW *buf) = 0;
74
 
75
        virtual void    writei(const BUSW a, const int len, const BUSW *buf) = 0;
76
        virtual void    writez(const BUSW a, const int len, const BUSW *buf) = 0;
77
 
78
        // Query whether or not an interrupt has taken place
79
        virtual bool    poll(void) = 0;
80
 
81
        // Sleep until interrupt, but sleep no longer than msec milliseconds
82
        virtual void    usleep(unsigned msec) = 0;
83
 
84
        // Sleep until an interrupt, no matter how long it takes for that
85
        // interrupt to take place
86
        virtual void    wait(void) = 0;
87
 
88
        // Query whether or not a bus error has taken place.  This is somewhat
89
        // of a misnomer, as my current bus error detection code exits any
90
        // interface, but ... it is what it is.
91
        virtual bool    bus_err(void) const = 0;
92
 
93
        // Clear any bus error condition.
94
        virtual void    reset_err(void) = 0;
95
 
96
        // Clear any interrupt condition that has already been noticed by
97
        // the interface, does not check for further interrupt
98
        virtual void    clear(void) = 0;
99
 
100
        virtual ~DEVBUS(void) { };
101
};
102
 
103
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.