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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [host/] [deppi.h] - Blame information for rev 22

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

Line No. Rev Author Line
1 11 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    deppi.h
4
//
5
// Project:     CMod S6 System on a Chip, ZipCPU demonstration project
6
//
7
// Purpose:     This package attempts to convet a DEPP over USB based
8
//              communication system into something similar to a serial port
9
//      based communication system.  Some differences include the fact that,
10
//      if the DEPP port isn't polled, nothing comes out of the port.  Hence,
11
//      on connecting (or polling for the first time) ... there might be a 
12
//      bunch of stuff to (initially) ignore.
13
//
14
// Creator:     Dan Gisselquist, Ph.D.
15
//              Gisselquist Technology, LLC
16
//
17
////////////////////////////////////////////////////////////////////////////////
18
//
19
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
20
//
21
// This program is free software (firmware): you can redistribute it and/or
22
// modify it under the terms of  the GNU General Public License as published
23
// by the Free Software Foundation, either version 3 of the License, or (at
24
// your option) any later version.
25
//
26
// This program is distributed in the hope that it will be useful, but WITHOUT
27
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
29
// for more details.
30
//
31
// You should have received a copy of the GNU General Public License along
32
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
33
// target there if the PDF file isn't present.)  If not, see
34
// <http://www.gnu.org/licenses/> for a copy.
35
//
36
// License:     GPL, v3, as defined and found on www.gnu.org,
37
//              http://www.gnu.org/licenses/gpl.html
38
//
39
//
40
////////////////////////////////////////////////////////////////////////////////
41
//
42
//
43
#ifndef DEPPI_H
44
#define DEPPI_H
45
 
46
#include "dpcdecl.h"
47
#include "dmgr.h"
48
// #include "devbus.h"
49
 
50
//
51
#define PKTLEN  32
52
#define RCV_BUFLEN      512
53
#define RCV_BUFMASK     (RCV_BUFLEN-1)
54
 
55
#include "llcomms.h"
56
 
57
class   DEPPI : public LLCOMMSI { // DEPP Interface
58
private:
59
        HIF     m_dev;
60
        bool    m_int, m_err;
61
        char    m_rbuf[RCV_BUFLEN];
62
        char    m_txbuf[2*PKTLEN], m_rxbuf[2*PKTLEN];
63
        int     m_rbeg, m_rend;
64
 
65
        virtual int     pop_fifo(char *buf, int len);
66
        virtual void    push_fifo(char *buf, int len);
67
        virtual void    raw_read(int len, int timeout_ms);
68
        virtual void    flush_read(void);
69
        void    depperr(void);
70
 
71
public:
72
        DEPPI(char *szSel);
73
        ~DEPPI(void);
74
 
75
        virtual void    close(void);
76
        virtual int     read(char *buf, int len);
77
        virtual int     read(char *buf, int len, int timeout_ms);
78
        virtual void    write(char *buf, int len);
79
        virtual bool    poll(unsigned ms);
80
};
81
 
82
#endif // DEPPI_H
83
 

powered by: WebSVN 2.1.0

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