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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [eqspiscope.cpp] - Blame information for rev 10

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

Line No. Rev Author Line
1 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    eqspiscope.cpp
4
//
5
// Project:     XuLA2-LX25 SoC based upon the ZipCPU
6
//
7
// Purpose:     
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Technology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
#include <stdio.h>
39
#include <stdlib.h>
40
#include <unistd.h>
41
#include <strings.h>
42
#include <ctype.h>
43
#include <string.h>
44
#include <signal.h>
45
#include <assert.h>
46
 
47
#include "port.h"
48
#include "regdefs.h"
49
#include "scopecls.h"
50
 
51
#define WBSCOPE         R_QSCOPE
52
#define WBSCOPEDATA     R_QSCOPED
53
 
54
FPGA    *m_fpga;
55
void    closeup(int v) {
56
        m_fpga->kill();
57
        exit(0);
58
}
59
 
60
class   EQSPISCOPE : public SCOPE {
61
public:
62
        EQSPISCOPE(FPGA *fpga, unsigned addr, bool vecread)
63
                : SCOPE(fpga, addr, false, false) {};
64
        ~EQSPISCOPE(void) {}
65
        virtual void    decode(DEVBUS::BUSW val) const {
66
                int     cyc, cstb, dstb, ack, back, accepted, valid, word,
67
                        out, cs, sck, mod, odat, idat;
68
 
69
                cyc      = (val>>31)&1;
70
                cstb     = (val>>30)&1;
71
                dstb     = (val>>29)&1;
72
                ack      = (val>>28)&1;
73
                back     = (val>>27)&1;
74
                accepted = (val>>26)&1;
75
                valid    = (val>>25)&1;
76
                word     = (val>>18)&0x07f;
77
                out      = (val>>12)&0x03f;
78
                cs       = (val>>11)&1;
79
                sck      = (val>>10)&1;
80
                mod      = (val>> 8)&3;
81
                odat     = (val>> 4)&15;
82
                idat     = (val    )&15;
83
 
84
                printf("%s%s%s%s%s%s%s %02x %02x %s%s %d %x->  ->%x",
85
                        (cyc)?"C ":"  ",
86
                        (cstb)?"C":" ",
87
                        (dstb)?"D":" ",
88
                        (ack)?"AK":"  ",
89
                        (back)?"+":" ",
90
                        (accepted)?"ACC":"   ",
91
                        (valid)?"V":" ",
92
                        word<<1, out<<2,
93
                        (cs)?"  ":"CS",
94
                        (sck)?"CK":"  ",
95
                        (mod), odat, idat);
96
 
97
        }
98
};
99
 
100
int main(int argc, char **argv) {
101
        int     skp=0, port = FPGAPORT;
102
        bool    use_usb = false;
103
 
104
        skp=1;
105
        for(int argn=0; argn<argc-skp; argn++) {
106
                if (argv[argn+skp][0] == '-') {
107
                        if (argv[argn+skp][1] == 'u')
108
                                use_usb = true;
109
                        else if (argv[argn+skp][1] == 'p') {
110
                                use_usb = false;
111
                                if (isdigit(argv[argn+skp][2]))
112
                                        port = atoi(&argv[argn+skp][2]);
113
                        }
114
                        skp++; argn--;
115
                } else
116
                        argv[argn] = argv[argn+skp];
117
        } argc -= skp;
118
 
119
        FPGAOPEN(m_fpga);
120
 
121
        signal(SIGSTOP, closeup);
122
        signal(SIGHUP, closeup);
123
 
124
        EQSPISCOPE *scope = new EQSPISCOPE(m_fpga, WBSCOPE, false);
125
        if (!scope->ready()) {
126
                printf("Scope is not yet ready:\n");
127
                scope->decode_control();
128
        } else
129
                scope->read();
130
        delete  m_fpga;
131
}
132
 

powered by: WebSVN 2.1.0

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