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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [devbus.h] - Blame information for rev 4

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

Line No. Rev Author Line
1 4 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
//              Gisselquist Tecnology, LLC
15
//
16
// Copyright:   2015
17
//
18
//
19
#ifndef DEVBUS_H
20
#define DEVBUS_H
21
 
22
#include <stdio.h>
23
#include <unistd.h>
24
 
25
typedef unsigned int    uint32;
26
 
27
class   BUSERR {
28
public:
29
        uint32 addr;
30
        BUSERR(const uint32 a) : addr(a) {};
31
};
32
 
33
class   DEVBUS {
34
public:
35
        typedef uint32  BUSW;
36
 
37
        virtual void    kill(void) = 0;
38
        virtual void    close(void) = 0;
39
 
40
        // Write a single value to a single address
41
        virtual void    writeio(const BUSW a, const BUSW v) = 0;
42
 
43
        // Read a single value to a single address
44
        virtual BUSW    readio(const BUSW a) = 0;
45
 
46
        // Read a series of values from values from a block of memory
47
        virtual void    readi(const BUSW a, const int len, BUSW *buf) = 0;
48
 
49
        // Read a series of values from the same address in memory
50
        virtual void    readz(const BUSW a, const int len, BUSW *buf) = 0;
51
 
52
        virtual void    writei(const BUSW a, const int len, const BUSW *buf) = 0;
53
        virtual void    writez(const BUSW a, const int len, const BUSW *buf) = 0;
54
 
55
        // Query whether or not an interrupt has taken place
56
        virtual bool    poll(void) = 0;
57
 
58
        // Sleep until interrupt, but sleep no longer than msec milliseconds
59
        virtual void    usleep(unsigned msec) = 0;
60
 
61
        // Sleep until an interrupt, no matter how long it takes for that
62
        // interrupt to take place
63
        virtual void    wait(void) = 0;
64
 
65
        // Query whether or not a bus error has taken place.  This is somewhat
66
        // of a misnomer, as my current bus error detection code exits any
67
        // interface, but ... it is what it is.
68
        virtual bool    bus_err(void) const = 0;
69
 
70
        // Clear any bus error condition.
71
        virtual void    reset_err(void) = 0;
72
 
73
        // Clear any interrupt condition that has already been noticed by
74
        // the interface, does not check for further interrupt
75
        virtual void    clear(void) = 0;
76
 
77
        virtual ~DEVBUS(void) { };
78
};
79
 
80
#endif

powered by: WebSVN 2.1.0

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