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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [board/] [gpsdump.c] - Blame information for rev 52

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    gpsdump.c
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     To dump the GPS UART to the auxiliary UART.
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 52 dgisselq
#include "artyboard.h"
39 49 dgisselq
#include "zipcpu.h"
40 36 dgisselq
#include "zipsys.h"
41 34 dgisselq
 
42 52 dgisselq
#define sys     _sys
43
 
44 49 dgisselq
void main(int argc, char **argv) {
45
        /*
46 36 dgisselq
        // Method one: direct polling
47 34 dgisselq
        while(1) {
48
                int     ch;
49
                ch = sys->io_gps_rx;
50 49 dgisselq
                if ((ch&UART_RX_ERR)==0)
51 34 dgisselq
                        sys->io_uart_tx = ch;
52
        }
53 49 dgisselq
        */
54
 
55 36 dgisselq
        // Method two: Waiting on interrupts
56 52 dgisselq
        int     lglen = (1<<((sys->io_gpsu.u_fifo >> 12)&0x0f))-1;
57
        zip->z_pic = SYSINT_GPSRXF;
58 36 dgisselq
        while(1) {
59 52 dgisselq
                while((zip->z_pic & SYSINT_GPSRXF)==0)
60 36 dgisselq
                        ;
61 52 dgisselq
                for(int i=0; i<lglen/2; i++)
62
                        sys->io_uart.u_tx = sys->io_gpsu.u_rx & 0x0ff;
63
                zip->z_pic = SYSINT_GPSRXF;
64 36 dgisselq
        }
65 49 dgisselq
 
66 36 dgisselq
        /*
67
        // Method three: Use the DMA
68 49 dgisselq
        zip->z_dma.d_ctrl = DMACLEAR;
69 36 dgisselq
        while(1) {
70 49 dgisselq
                zip->z_dma.d_rd = (int *)&sys->io_gps_rx;
71
                zip->z_dma.d_wr = (int *)&sys->io_uart_tx;
72
                zip->z_dma.d_len = 0x01000000; // More than we'll ever do ...
73
                zip->z_dma.d_ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_ONGPSRX);
74 36 dgisselq
 
75 49 dgisselq
                while(zip->z_dma.d_ctrl & DMA_BUSY) {
76
                        zip_idle();
77
                        if (zip->z_dma.d_ctrl & DMA_ERR)
78
                                zip_halt();
79
                }
80 36 dgisselq
        }
81
        */
82 34 dgisselq
}

powered by: WebSVN 2.1.0

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