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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [board/] [oledtest.c] - Diff between revs 35 and 36

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

Rev 35 Rev 36
Line 38... Line 38...
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
 
 
#include "artyboard.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();
}
}
Line 87... Line 87...
                zip_rtu();
                zip_rtu();
                zip->pic = CLEARPIC;
                zip->pic = CLEARPIC;
        } // else anything less has likely already passed
        } // else anything less has likely already passed
}
}
 
 
 
void    wait_on_interrupt(int mask) {
 
        // Clear our interrupt only, but disable all others
 
        zip->pic = DALLPIC|mask;
 
        zip->pic = EINT(mask);
 
        zip_rtu();
 
        zip->pic = DINT(mask)|mask;
 
}
 
 
void oled_clear(void);
void oled_clear(void);
 
 
/*
/*
 * The following outlines a series of commands to send to the OLEDrgb as part
 * The following outlines a series of commands to send to the OLEDrgb as part
Line 258... Line 265...
        // is clear again.
        // is clear again.
        while(sys->io_oled.o_ctrl & OLED_BUSY)
        while(sys->io_oled.o_ctrl & OLED_BUSY)
                ;
                ;
}
}
 
 
 
void    oled_show_image(int *img) {
 
#define USE_DMA
 
#ifdef  USE_DMA
 
                zip->dma.ctrl = DMACLEAR;
 
                zip->dma.rd = img;
 
                zip->dma.wr = &sys->io_oled.o_data;
 
                zip->dma.len= 6144;
 
                zip->dma.ctrl = DMAONEATATIME|DMA_CONSTDST|DMA_OLED;
 
                // timer_delay(256);
 
                // zip_halt();
 
#else
 
                for(int i=0; i<6144; i++) {
 
                        while(sys->io_oled.o_ctrl & OLED_BUSY)
 
                                ;
 
                        sys->io_oled.o_data = img[i];
 
                }
 
#endif
 
}
 
 
/*
/*
 * entry()
 * entry()
 *
 *
 * In all (current) ZipCPU programs, the programs start with an entry()
 * In all (current) ZipCPU programs, the programs start with an entry()
 * function that takes no arguments.  The actual bootup entry can be found
 * function that takes no arguments.  The actual bootup entry can be found
 * in the bootstram directory, but that calls us here.
 * in the bootstrap.c file, but that calls us here.
 *
 *
 */
 */
void    entry(void) {
void    entry(void) {
 
 
        // Since we'll be returning to userspace via zip_rtu() in order to
        // Since we'll be returning to userspace via zip_rtu() in order to
Line 373... Line 398...
                while(sys->io_oled.o_ctrl & OLED_BUSY)
                while(sys->io_oled.o_ctrl & OLED_BUSY)
                        ;
                        ;
                sys->io_oled.o_ctrl = 0x2075003f; // Sets row min/max address
                sys->io_oled.o_ctrl = 0x2075003f; // Sets row min/max address
 
 
                // Now ... finally ... we can send our image.
                // Now ... finally ... we can send our image.
                for(int i=0; i<6144; i++) {
                oled_show_image(splash);
                        while(sys->io_oled.o_ctrl & OLED_BUSY)
                wait_on_interrupt(SYSINT_DMAC);
                                ;
 
                        sys->io_oled.o_data = splash[i];
 
                }
 
 
 
                // Wait 25 seconds.  The LEDs are for a fun effect.
                // Wait 25 seconds.  The LEDs are for a fun effect.
                sys->io_ledctrl = 0x0f1;
                sys->io_ledctrl = 0x0f1;
                timer_delay(CLOCKFREQ_HZ*5);
                timer_delay(CLOCKFREQ_HZ*5);
                sys->io_ledctrl = 0x0f3;
                sys->io_ledctrl = 0x0f3;
Line 394... Line 416...
                timer_delay(CLOCKFREQ_HZ*5);
                timer_delay(CLOCKFREQ_HZ*5);
 
 
 
 
                // Display a second image.
                // Display a second image.
                sys->io_ledctrl = 0x0fc;
                sys->io_ledctrl = 0x0fc;
                for(int i=0; i<6144; i++) {
                oled_show_image(mug);
                        while(sys->io_oled.o_ctrl & OLED_BUSY)
                wait_on_interrupt(SYSINT_DMAC);
                                ;
 
                        sys->io_oled.o_data = mug[i];
 
                }
 
 
 
                // Leave this one in effect for 5 seconds only.
                // Leave this one in effect for 5 seconds only.
                sys->io_ledctrl = 0x0f8;
                sys->io_ledctrl = 0x0f8;
                timer_delay(CLOCKFREQ_HZ*5);
                timer_delay(CLOCKFREQ_HZ*5);
        }
        }

powered by: WebSVN 2.1.0

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