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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [host/] [llcomms.cpp] - Diff between revs 11 and 45

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

Rev 11 Rev 45
Line 78... Line 78...
        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 95... Line 97...
        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.