Line 33... |
Line 33... |
//
|
//
|
//
|
//
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
//
|
//
|
|
#include "zipcpu.h"
|
#include "zipsys.h"
|
#include "zipsys.h"
|
#include "artyboard.h"
|
#include "artyboard.h"
|
|
|
void entry(void) {
|
void main(int argc, char **argv) {
|
/*
|
/*
|
// Method one: direct polling
|
// Method one: direct polling
|
while(1) {
|
while(1) {
|
int ch;
|
int ch;
|
ch = sys->io_gps_rx;
|
ch = sys->io_gps_rx;
|
if ((ch&-256)==0)
|
if ((ch&UART_RX_ERR)==0)
|
sys->io_uart_tx = ch;
|
sys->io_uart_tx = ch;
|
}
|
}
|
*/
|
*/
|
|
|
// Method two: Waiting on interrupts
|
// Method two: Waiting on interrupts
|
zip->pic = SYSINT_GPSRX;
|
zip->z_pic = SYSINT_GPSRX;
|
while(1) {
|
while(1) {
|
while((zip->pic & SYSINT_GPSRX)==0)
|
while((zip->z_pic & SYSINT_GPSRX)==0)
|
;
|
;
|
sys->io_uart_tx = sys->io_gps_rx;
|
sys->io_uart_tx = sys->io_gps_rx;
|
zip->pic = SYSINT_GPSRX;
|
zip->z_pic = SYSINT_GPSRX;
|
}
|
}
|
|
|
/*
|
/*
|
// Method three: Use the DMA
|
// Method three: Use the DMA
|
zip->dma.ctrl = DMACLEAR;
|
zip->z_dma.d_ctrl = DMACLEAR;
|
while(1) {
|
while(1) {
|
zip->dma.rd = &sys->io_gps_rx;
|
zip->z_dma.d_rd = (int *)&sys->io_gps_rx;
|
zip->dma.wr = &sys->io_uart_tx;
|
zip->z_dma.d_wr = (int *)&sys->io_uart_tx;
|
zip->dma.len = 0x01000000; // More than we'll ever do ...
|
zip->z_dma.d_len = 0x01000000; // More than we'll ever do ...
|
zip->dma.ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_GPSRX);
|
zip->z_dma.d_ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_ONGPSRX);
|
// zip->dma.ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC);
|
|
|
|
while(zip->dma.ctrl & 0x80000000)
|
while(zip->z_dma.d_ctrl & DMA_BUSY) {
|
if (zip->dma.ctrl & 0x40000000)
|
zip_idle();
|
zip_halt();;
|
if (zip->z_dma.d_ctrl & DMA_ERR)
|
|
zip_halt();
|
|
}
|
}
|
}
|
*/
|
*/
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|