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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zipdbg/] [devbus.h] - Blame information for rev 117

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

Line No. Rev Author Line
1 19 dgisselq
///////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    devbus.h
4
//
5
// Project:     UART to WISHBONE FPGA library
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
10
//              describes only an interface, and not how that interface is
11
//              to be accomplished.
12
//
13
// Creator:     Dan Gisselquist
14 69 dgisselq
//              Gisselquist Technology, LLC
15 19 dgisselq
//
16
///////////////////////////////////////////////////////////////////////////////
17
//
18
// Copyright (C) 2015, 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
// License:     GPL, v3, as defined and found on www.gnu.org,
31
//              http://www.gnu.org/licenses/gpl.html
32
//
33
//
34
///////////////////////////////////////////////////////////////////////////////
35
//
36
//
37
#ifndef DEVBUS_H
38
#define DEVBUS_H
39
 
40
#include <unistd.h>
41
 
42
typedef unsigned int    uint32;
43
 
44
class   BUSERR {
45
public:
46
        uint32 addr;
47
        BUSERR(const uint32 a) : addr(a) {};
48
};
49
 
50
class   DEVBUS {
51
public:
52
        typedef uint32  BUSW;
53
 
54
        virtual void    kill(void) = 0;
55
        virtual void    close(void) = 0;
56
 
57
        // Write a single value to a single address
58
        virtual void    writeio(const BUSW a, const BUSW v) = 0;
59
 
60
        // Read a single value to a single address
61
        virtual BUSW    readio(const BUSW a) = 0;
62
 
63
        // Read a series of values from values from a block of memory
64
        virtual void    readi(const BUSW a, const int len, BUSW *buf) = 0;
65
 
66
        // Read a series of values from the same address in memory
67
        virtual void    readz(const BUSW a, const int len, BUSW *buf) = 0;
68
 
69
        virtual void    writei(const BUSW a, const int len, const BUSW *buf) = 0;
70
        virtual void    writez(const BUSW a, const int len, const BUSW *buf) = 0;
71
 
72
        // Query whether or not an interrupt has taken place
73
        virtual bool    poll(void) = 0;
74
 
75
        // Sleep until interrupt, but sleep no longer than msec milliseconds
76
        virtual void    usleep(unsigned msec) = 0;
77
 
78
        // Sleep until an interrupt, no matter how long it takes for that
79
        // interrupt to take place
80
        virtual void    wait(void) = 0;
81
 
82
        // Query whether or not a bus error has taken place.  This is somewhat
83
        // of a misnomer, as my current bus error detection code exits any
84
        // interface, but ... it is what it is.
85
        virtual bool    bus_err(void) const = 0;
86
 
87
        // Clear any bus error condition.
88
        virtual void    reset_err(void) = 0;
89
 
90
        // Clear any interrupt condition that has already been noticed by
91
        // the interface, does not check for further interrupt
92
        virtual void    clear(void) = 0;
93
};
94
 
95
#endif

powered by: WebSVN 2.1.0

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