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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [cfgscope.cpp] - Diff between revs 5 and 17

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

Rev 5 Rev 17
Line 1... Line 1...
//
////////////////////////////////////////////////////////////////////////////////
//
//
// Filename:    cfgscope.cpp
// Filename:    cfgscope.cpp
//
//
// Project:     FPGA library development (Basys-3 development board)
// Project:     XuLA2 board
//
//
// Purpose:     To read out, and decompose, the results of the wishbone scope
// Purpose:     To read out, and decompose, the results of the wishbone scope
//              as applied to the ICAPE2 interaction.
//              as applied to the ICAPE interaction on a SPARTAN6.
 
//
 
//
 
// Creator:     Dan Gisselquist, Ph.D.
 
//              Gisselquist Technology, LLC
 
//
 
////////////////////////////////////////////////////////////////////////////////
 
//
 
// Copyright (C) 2015, Gisselquist Technology, LLC
 
//
 
// 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
 
// by the Free Software Foundation, either version 3 of the License, or (at
 
// your option) any later version.
 
//
 
// This program is distributed in the hope that it will be useful, but WITHOUT
 
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
 
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
// for more details.
//
//
// Creator:     Dan Gisselquist
// License:     GPL, v3, as defined and found on www.gnu.org,
//              Gisselquist Tecnology, LLC
//              http://www.gnu.org/licenses/gpl.html
 
//
 
//
 
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright:   2015
 
//
//
//
//
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
Line 20... Line 40...
#include <ctype.h>
#include <ctype.h>
#include <string.h>
#include <string.h>
#include <signal.h>
#include <signal.h>
#include <assert.h>
#include <assert.h>
 
 
#include "port.h"
 
#include "llcomms.h"
#include "llcomms.h"
 
#include "usbi.h"
 
#include "port.h"
#include "regdefs.h"
#include "regdefs.h"
 
 
#define WBSCOPE         R_CFGSCOPE
#define WBSCOPE         R_CFGSCOPE
#define WBSCOPEDATA     R_CFGSCOPED
#define WBSCOPEDATA     R_CFGSCOPED
 
 
Line 51... Line 72...
        r |= brev((v>>8)&0x0ff)<<8;
        r |= brev((v>>8)&0x0ff)<<8;
        return r;
        return r;
}
}
 
 
int main(int argc, char **argv) {
int main(int argc, char **argv) {
        FPGAOPEN(m_fpga);
        int     skp=0, port = FPGAPORT;
 
        bool    use_usb = true;
 
 
 
        skp=1;
 
        for(int argn=0; argn<argc-skp; argn++) {
 
                if (argv[argn+skp][0] == '-') {
 
                        if (argv[argn+skp][1] == 'u')
 
                                use_usb = true;
 
                        else if (argv[argn+skp][1] == 'p') {
 
                                use_usb = false;
 
                                if (isdigit(argv[argn+skp][2]))
 
                                        port = atoi(&argv[argn+skp][2]);
 
                        }
 
                        skp++; argn--;
 
                } else
 
                        argv[argn] = argv[argn+skp];
 
        } argc -= skp;
 
 
 
        if (use_usb)
 
                m_fpga = new FPGA(new USBI());
 
        else
 
                m_fpga = new FPGA(new NETCOMMS(FPGAHOST, port));
 
 
        signal(SIGSTOP, closeup);
        signal(SIGSTOP, closeup);
        signal(SIGHUP, closeup);
        signal(SIGHUP, closeup);
 
 
        unsigned        v, lgln, scoplen;
        unsigned        v, lgln, scoplen;
        printf("Attempting to read address %08x\n", WBSCOPE);
 
        v = m_fpga->readio(WBSCOPE);
        v = m_fpga->readio(WBSCOPE);
        if (0x60000000 != (v & 0x60000000)) {
        if (0x60000000 != (v & 0x60000000)) {
                printf("Scope is not yet ready:\n");
                printf("Scope is not yet ready:\n");
                printf("\tRESET:\t\t%s\n", (v&0x80000000)?"Ongoing":"Complete");
                printf("\tRESET:\t\t%s\n", (v&0x80000000)?"Ongoing":"Complete");
                printf("\tSTOPPED:\t%s\n", (v&0x40000000)?"Yes":"No");
                printf("\tSTOPPED:\t%s\n", (v&0x40000000)?"Yes":"No");
Line 78... Line 119...
 
 
        DEVBUS::BUSW    *buf;
        DEVBUS::BUSW    *buf;
        buf = new DEVBUS::BUSW[scoplen];
        buf = new DEVBUS::BUSW[scoplen];
 
 
        if (false) {
        if (false) {
                printf("Attempting vector read\n");
 
                m_fpga->readz(WBSCOPEDATA, scoplen, buf);
                m_fpga->readz(WBSCOPEDATA, scoplen, buf);
 
 
                printf("Vector read complete\n");
 
        } else {
        } else {
                for(unsigned int i=0; i<scoplen; i++)
                for(unsigned int i=0; i<scoplen; i++)
                        buf[i] = m_fpga->readio(WBSCOPEDATA);
                        buf[i] = m_fpga->readio(WBSCOPEDATA);
        }
        }
 
 
Line 115... Line 153...
        }
        }
 
 
        if (m_fpga->poll()) {
        if (m_fpga->poll()) {
                printf("FPGA was interrupted\n");
                printf("FPGA was interrupted\n");
                m_fpga->clear();
                m_fpga->clear();
                m_fpga->writeio(R_ICONTROL, SCOPEN);
 
        }
        }
        delete  m_fpga;
        delete  m_fpga;
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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