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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [llcomms.h] - Blame information for rev 30

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

Line No. Rev Author Line
1 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    llcomms.cpp
4
//
5 30 dgisselq
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6 4 dgisselq
//
7
// Purpose:     This is the C++ program on the command side that will interact
8
//              with a UART on an FPGA, both sending and receiving characters.
9
//              Any bus interaction will call routines from this lower level
10
//              library to accomplish the actual connection to and
11
//              transmission to/from the board.
12
//
13 30 dgisselq
// Creator:     Dan Gisselquist, Ph.D.
14
//              Gisselquist Technology, LLC
15 4 dgisselq
//
16 30 dgisselq
////////////////////////////////////////////////////////////////////////////////
17 4 dgisselq
//
18 30 dgisselq
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
19 4 dgisselq
//
20 30 dgisselq
// 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
// You should have received a copy of the GNU General Public License along
31
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
32
// target there if the PDF file isn't present.)  If not, see
33
// <http://www.gnu.org/licenses/> for a copy.
34
//
35
// License:     GPL, v3, as defined and found on www.gnu.org,
36
//              http://www.gnu.org/licenses/gpl.html
37
//
38
//
39
////////////////////////////////////////////////////////////////////////////////
40
//
41
//
42 4 dgisselq
#ifndef LLCOMMS_H
43
#define LLCOMMS_H
44
 
45
class   LLCOMMSI {
46
protected:
47
        int     m_fdw, m_fdr;
48
        LLCOMMSI(void);
49
public:
50
        unsigned long   m_total_nread, m_total_nwrit;
51
 
52
        virtual ~LLCOMMSI(void) { close(); }
53
        virtual void    kill(void)  { this->close(); };
54
        virtual void    close(void);
55
        virtual void    write(char *buf, int len);
56
        virtual int     read(char *buf, int len);
57
        virtual bool    poll(unsigned ms);
58
 
59
        // Tests whether or not bytes are available to be read, returns a 
60
        // count of the bytes that may be immediately read
61
        virtual int     available(void); // { return 0; };
62
};
63
 
64
class   TTYCOMMS : public LLCOMMSI {
65
public:
66
        TTYCOMMS(const char *dev);
67
};
68
 
69
class   NETCOMMS : public LLCOMMSI {
70
public:
71
        NETCOMMS(const char *dev, const int port);
72
};
73
 
74
#endif

powered by: WebSVN 2.1.0

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