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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [board/] [exmulti.c] - Diff between revs 36 and 49

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

Rev 36 Rev 49
Line 35... Line 35...
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
#include "artyboard.h"
#include "zipcpu.h"
#include "zipsys.h"
#include "zipsys.h"
 
#include "artyboard.h"
 
 
void    idle_task(void) {
void    idle_task(void) {
        while(1)
        while(1)
                zip_idle();
                zip_idle();
}
}
 
 
void    wait_on_interrupt(int mask) {
void    wait_on_interrupt(int mask) {
        zip->pic = DALLPIC|mask;
        zip->z_pic = DALLPIC|mask;
        zip->pic = EINT(mask);
        zip->z_pic = EINT(mask);
        zip_rtu();
        zip_rtu();
}
}
 
 
int     user_stack[256];
int     user_stack[256];
void    user_task(void) {
void    user_task(void) {
Line 109... Line 110...
                return v + 'A' - 10;
                return v + 'A' - 10;
}
}
 
 
int     errstring[128];
int     errstring[128];
 
 
void    entry(void) {
void    main(int argc, char **argv) {
        const unsigned red = 0x0ff0000, green = 0x0ff00, blue = 0x0ff,
        const unsigned red = 0x0ff0000, green = 0x0ff00, blue = 0x0ff,
                white = 0x070707, black = 0, dimgreen = 0x1f00,
                white = 0x070707, black = 0, dimgreen = 0x1f00,
                second = 81250000;
                second = CLOCKFREQHZ;
        int     i, sw;
        int     i, sw;
 
 
        // Start the GPS converging ...
        // Start the GPS converging ...
        sys->io_gps.g_alpha = 2;
        sys->io_gps.g_alpha = 2;
        sys->io_gps.g_beta  = 0x14bda12f;
        sys->io_gps.g_beta  = 0x14bda12f;
Line 134... Line 135...
 
 
        // Clear the PIC
        // Clear the PIC
        //
        //
        //      Acknowledge all interrupts, turn off all interrupts
        //      Acknowledge all interrupts, turn off all interrupts
        //
        //
        zip->pic = 0x7fff7fff;
        zip->z_pic = CLEARPIC;
        while(sys->io_pwrcount < (second >> 4))
        while(sys->io_pwrcount < (second >> 4))
                ;
                ;
 
 
        // Repeating timer, every 250ms
        // Repeating timer, every 250ms
        zip->tma = (second/4) | 0x80000000;
        zip->z_tma = TMR_INTERVAL | (second/4);
        wait_on_interrupt(SYSINT_TMA);
        wait_on_interrupt(SYSINT_TMA);
 
 
        sys->io_clrled[0] = green;
        sys->io_clrled[0] = green;
        sys->io_ledctrl = 0x010;
        sys->io_ledctrl = 0x010;
 
 
        wait_on_interrupt(SYSINT_TMA);
        wait_on_interrupt(SYSINT_TMA);
 
 
        sys->io_clrled[0] = dimgreen;
        sys->io_clrled[0] = dimgreen;
        sys->io_clrled[1] = green;
        sys->io_clrled[1] = green;
        sys->io_scope[0].s_ctrl = 32 | 0x80000000; // SCOPE_TRIGGER;
        sys->io_scope[0].s_ctrl = SCOPE_NO_RESET | 32;
        sys->io_ledctrl = 0x020;
        sys->io_ledctrl = 0x020;
 
 
        wait_on_interrupt(SYSINT_TMA);
        wait_on_interrupt(SYSINT_TMA);
 
 
        sys->io_clrled[1] = dimgreen;
        sys->io_clrled[1] = dimgreen;
Line 197... Line 198...
        user_context[15] = (int)&user_task;
        user_context[15] = (int)&user_task;
        zip_restore_context(user_context);
        zip_restore_context(user_context);
 
 
        do {
        do {
                wait_on_interrupt(SYSINT_PPS|SYSINT_TMA);
                wait_on_interrupt(SYSINT_PPS|SYSINT_TMA);
        } while((zip->pic & SYSINT_PPS)==0);
        } while((zip->z_pic & SYSINT_PPS)==0);
 
 
        while(1) {
        while(1) {
                int     *s = errstring;
                int     *s = errstring;
 
 
                zip->wdt = CLOCKFREQ_HZ*4;
                zip->z_wdt = CLOCKFREQ_HZ*4;
                sys->io_ledctrl = 0x088;
                sys->io_ledctrl = 0x088;
 
 
                // 1. Read and report the GPS tracking err
                // 1. Read and report the GPS tracking err
 
 
                // Get the upper 32-bits of the error;
                // Get the upper 32-bits of the error;
Line 319... Line 320...
                *s++ = '\r';
                *s++ = '\r';
                *s++ = '\n';
                *s++ = '\n';
                *s++ = '\0';
                *s++ = '\0';
 
 
                /*
                /*
                zip->dma.ctrl = DMACLEAR;
                zip->z_dma.d_ctrl = DMACLEAR;
                zip->dma.rd = errstring;
                zip->z_dma.d_rd = errstring;
                zip->dma.wr = &sys->io_uart_tx;
                zip->z_dma.d_wr = &sys->io_uart_tx;
                zip->dma.len = s - errstring-1;
                zip->z_dma.d_len = s - errstring-1;
                zip->dma.ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_GPSRX);
                zip->z_dma.d_ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_GPSRX);
                wait_on_interrupt(SYSINT_DMAC);
                wait_on_interrupt(SYSINT_DMAC);
                */
                */
 
 
                for(int i=0; errstring[i]; i++) {
                for(int i=0; errstring[i]; i++) {
                        wait_on_interrupt(SYSINT_UARTTX);
                        wait_on_interrupt(SYSINT_UARTTX);
                        sys->io_uart_tx = errstring[i];
                        sys->io_uart_tx = errstring[i];
                        zip->pic = SYSINT_UARTTX;
                        zip->z_pic = SYSINT_UARTTX;
                }
                }
 
 
                sys->io_ledctrl = 0x080;
                sys->io_ledctrl = 0x080;
 
 
                /*
                /*
                zip->dma.rd = &sys->io_gps_rx;
                zip->z_dma.d_rd = &sys->io_gps_rx;
                zip->dma.wr = &sys->io_uart_tx;
                zip->z_dma.d_wr = &sys->io_uart_tx;
                zip->dma.len = 0x01000000;
                zip->z_dma.d_len = 0x01000000;
                zip->dma.ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_GPSRX);
                zip->z_dma.d_ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_ONGPSRX);
                wait_on_interrupt(SYSINT_PPS);
                wait_on_interrupt(SYSINT_PPS);
                */
                */
 
 
                /*
                /*
                if (zip_ucc() & CC_FAULT) {
                if (zip_ucc() & CC_FAULT) {
Line 352... Line 353...
                        user_context[15] = (int)&idle_task;
                        user_context[15] = (int)&idle_task;
                        zip_restore_context(user_context);
                        zip_restore_context(user_context);
                }
                }
                */
                */
 
 
                zip->pic = SYSINT_GPSRX | SYSINT_PPS;
                zip->z_pic = SYSINT_GPSRX | SYSINT_PPS;
                do {
                do {
                        wait_on_interrupt(SYSINT_PPS|SYSINT_GPSRX);
                        wait_on_interrupt(SYSINT_PPS|SYSINT_GPSRX);
                        if (zip->pic & SYSINT_GPSRX) {
                        if (zip->z_pic & SYSINT_GPSRX) {
                                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;
                        }
                        }
                } while((zip->pic & SYSINT_PPS)==0);
                } while((zip->z_pic & SYSINT_PPS)==0);
 
 
                // wait_on_interrupt(SYSINT_PPS);
                // wait_on_interrupt(SYSINT_PPS);
                // zip->dma.ctrl= DMACLEAR;
                // zip->z_dma.d_ctrl= DMACLEAR;
        }
        }
 
 
        zip_halt();
        zip_halt();
}
}
 
 

powered by: WebSVN 2.1.0

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