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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [ttybus.cpp] - Diff between revs 11 and 13

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

Rev 11 Rev 13
Line 66... Line 66...
#define TTYC_ERR        '5'
#define TTYC_ERR        '5'
 
 
const   unsigned TTYBUS::MAXRDLEN = 1024;
const   unsigned TTYBUS::MAXRDLEN = 1024;
const   unsigned TTYBUS::MAXWRLEN = 32;
const   unsigned TTYBUS::MAXWRLEN = 32;
 
 
// #define      DBGPRINTF       null
#define DBGPRINTF       null
// #define      DBGPRINTF       printf
// #define      DBGPRINTF       printf
// void null(...) {}
// #define      DBGPRINTF       filedump
#define DBGPRINTF       filedump
 
 
 
 
void    null(...) {}
#include <stdarg.h>
#include <stdarg.h>
// #include <varargs.h>
// #include <varargs.h>
void    filedump(const char *fmt, ...) {
static void     filedump(const char *fmt, ...) {
        static  FILE *dbgfp = NULL;
        static  FILE *dbgfp = NULL;
        va_list args;
        va_list args;
 
 
        if (!dbgfp)
        if (!dbgfp)
                dbgfp = fopen("debug.txt", "w");
                dbgfp = fopen("debug.txt", "w");
Line 299... Line 299...
 
 
char    *TTYBUS::encode_address(const TTYBUS::BUSW a) {
char    *TTYBUS::encode_address(const TTYBUS::BUSW a) {
        TTYBUS::BUSW    addr = a;
        TTYBUS::BUSW    addr = a;
        char    *ptr = m_buf;
        char    *ptr = m_buf;
 
 
 
// #warning DEBUG_APPROACH
 
        // encode(0, addr, ptr);
 
        // return ptr+6;
 
 
        if ((m_addr_set)&&(a == m_lastaddr))
        if ((m_addr_set)&&(a == m_lastaddr))
                return ptr;
                return ptr;
 
 
        if (m_addr_set) {
        if (m_addr_set) {
                // Encode a difference address
                // Encode a difference address
Line 360... Line 364...
                        *ptr++ = charenc((addr>>18) & 0x03f);
                        *ptr++ = charenc((addr>>18) & 0x03f);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                } else if (ptr == m_buf) { // Send our address prior to any read
                } else if (ptr == m_buf) { // Send our address prior to any read
                        ptr = m_buf;
                        // ptr = m_buf;
                        encode(0, addr, ptr);
                        encode(0, addr, ptr);
                        ptr+=6;
                        ptr+=6;
                }
                }
        }
        }
 
 

powered by: WebSVN 2.1.0

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