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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [software/] [leon3/] [gpio.c] - Rev 2

Compare with Previous | Blame | View Log

#define GRGPIOADR 0x80000500;
 
 
int gpio_test(int addr) 
{
volatile int *pio = (int *) addr; 
        /*
         * pio[0] = din
         * pio[1] = dout
         * pio[2] = dir
         * pio[3] = imask
         */
 
        int mask;
        int width;
 
	report_device(0x0101a000);
        pio[3] = 0; 
        pio[2] = 0;
        pio[1] = 0;  
 
        pio[2] = 0xFFFFFFFF;
 
        /* determine port width and mask */
        mask = 0;
        width = 0;
 
        while( ((pio[2] >> width) & 1) && (width <= 32)) {
                mask = mask | (1 << width);
                width++;
        }
 
        pio[2] = mask;
        if( (pio[0] & mask) != 0) fail(1);  
        pio[1] = 0x89ABCDEF;
        if( (pio[0] & mask) != (0x89ABCDEF & mask)) fail(2);
        pio[2] = 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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