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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [llcomms.cpp] - Diff between revs 5 and 91

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 5 Rev 91
Line 14... Line 14...
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright (C) 2015, Gisselquist Technology, LLC
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
//
//
// This program is free software (firmware): you can redistribute it and/or
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of  the GNU General Public License as published
// modify it under the terms of  the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
// your option) any later version.
Line 76... Line 76...
        m_total_nread += nr;
        m_total_nread += nr;
        return nr;
        return nr;
}
}
 
 
void    LLCOMMSI::close(void) {
void    LLCOMMSI::close(void) {
        if(m_fdw>=0) ::close(m_fdw);
        if(m_fdw>=0)
        if((m_fdr>=0)&&(m_fdr != m_fdw)) ::close(m_fdr);
                ::close(m_fdw);
 
        if((m_fdr>=0)&&(m_fdr != m_fdw))
 
                ::close(m_fdr);
        m_fdw = m_fdr = -1;
        m_fdw = m_fdr = -1;
}
}
 
 
bool    LLCOMMSI::poll(unsigned ms) {
bool    LLCOMMSI::poll(unsigned ms) {
        struct  pollfd  fds;
        struct  pollfd  fds;
Line 93... Line 95...
        if (fds.revents & POLLIN) {
        if (fds.revents & POLLIN) {
                return true;
                return true;
        } else return false;
        } else return false;
}
}
 
 
 
int     LLCOMMSI::available(void) {
 
        return poll(0)?1:0;
 
}
 
 
TTYCOMMS::TTYCOMMS(const char *dev) {
TTYCOMMS::TTYCOMMS(const char *dev) {
        m_fdr = ::open(dev, O_RDWR | O_NONBLOCK);
        m_fdr = ::open(dev, O_RDWR | O_NONBLOCK);
        if (m_fdr < 0) {
        if (m_fdr < 0) {
                printf("\n Error : Could not open %s\n", dev);
                printf("\n Error : Could not open %s\n", dev);
                perror("O/S Err:");
                perror("O/S Err:");

powered by: WebSVN 2.1.0

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