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

Subversion Repositories s6soc

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

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 45 dgisselq
// #define      S6SN    "SN:210282768825"
56
#define S6SN    ""
57
 
58 11 dgisselq
#include "llcomms.h"
59
 
60
class   DEPPI : public LLCOMMSI { // DEPP Interface
61
private:
62
        HIF     m_dev;
63
        bool    m_int, m_err;
64
        char    m_rbuf[RCV_BUFLEN];
65
        char    m_txbuf[2*PKTLEN], m_rxbuf[2*PKTLEN];
66
        int     m_rbeg, m_rend;
67
 
68
        virtual int     pop_fifo(char *buf, int len);
69
        virtual void    push_fifo(char *buf, int len);
70
        virtual void    raw_read(int len, int timeout_ms);
71
        virtual void    flush_read(void);
72
        void    depperr(void);
73
 
74
public:
75 45 dgisselq
        DEPPI(const char *szSel);
76 11 dgisselq
        ~DEPPI(void);
77
 
78
        virtual void    close(void);
79
        virtual int     read(char *buf, int len);
80
        virtual int     read(char *buf, int len, int timeout_ms);
81
        virtual void    write(char *buf, int len);
82
        virtual bool    poll(unsigned ms);
83
};
84
 
85
#endif // DEPPI_H
86
 

powered by: WebSVN 2.1.0

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