1 |
8 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: deppbus.h
|
4 |
|
|
//
|
5 |
|
|
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
|
6 |
|
|
//
|
7 |
|
|
// Purpose: An instantiation of a generic interface to a wishbone on a
|
8 |
|
|
// device. This particular instantiation uses a simplified
|
9 |
|
|
// interface over a Digilent Adept Asynchronous Parallel Port Interface
|
10 |
|
|
// (DEPP)--useful for working with the CMod-S6.
|
11 |
|
|
//
|
12 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
13 |
|
|
// Gisselquist Technology, LLC
|
14 |
|
|
//
|
15 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
16 |
|
|
//
|
17 |
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
18 |
|
|
//
|
19 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
20 |
|
|
// modify it under the terms of the GNU General Public License as published
|
21 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
22 |
|
|
// your option) any later version.
|
23 |
|
|
//
|
24 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
25 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
26 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
27 |
|
|
// for more details.
|
28 |
|
|
//
|
29 |
|
|
// You should have received a copy of the GNU General Public License along
|
30 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
31 |
|
|
// target there if the PDF file isn't present.) If not, see
|
32 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
33 |
|
|
//
|
34 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
35 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
36 |
|
|
//
|
37 |
|
|
//
|
38 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
//
|
40 |
|
|
//
|
41 |
|
|
#ifndef DEPPBUS_H
|
42 |
|
|
#define DEPPBUS_H
|
43 |
|
|
|
44 |
|
|
#include "dpcdecl.h"
|
45 |
|
|
#include "dmgr.h"
|
46 |
|
|
#include "devbus.h"
|
47 |
|
|
|
48 |
|
|
class DEPPBUS : public DEVBUS {
|
49 |
|
|
HIF m_dev;
|
50 |
|
|
bool m_int, m_err;
|
51 |
|
|
|
52 |
|
|
void depperr(void);
|
53 |
|
|
|
54 |
|
|
public:
|
55 |
|
|
typedef DEVBUS::BUSW BUSW;
|
56 |
|
|
|
57 |
|
|
DEPPBUS(char *szSel);
|
58 |
|
|
~DEPPBUS(void);
|
59 |
|
|
|
60 |
|
|
void kill(void);
|
61 |
|
|
void close(void);
|
62 |
|
|
|
63 |
|
|
void writeio(const BUSW a, const BUSW v);
|
64 |
|
|
BUSW readio(const BUSW a);
|
65 |
|
|
|
66 |
|
|
void readi(const BUSW a, const int len, BUSW *buf);
|
67 |
|
|
void readz(const BUSW a, const int len, BUSW *buf);
|
68 |
|
|
|
69 |
|
|
void writei(const BUSW a, const int len, const BUSW *buf);
|
70 |
|
|
void writez(const BUSW a, const int len, const BUSW *buf);
|
71 |
|
|
bool poll(void);
|
72 |
|
|
void usleep(unsigned msec);
|
73 |
|
|
void wait(void);
|
74 |
|
|
bool bus_err(void) const;
|
75 |
|
|
void reset_err(void);
|
76 |
|
|
void clear(void);
|
77 |
|
|
};
|
78 |
|
|
|
79 |
|
|
#endif
|