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] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
#define GRGPIOADR 0x80000500;
2
 
3
 
4
int gpio_test(int addr)
5
{
6
volatile int *pio = (int *) addr;
7
        /*
8
         * pio[0] = din
9
         * pio[1] = dout
10
         * pio[2] = dir
11
         * pio[3] = imask
12
         */
13
 
14
        int mask;
15
        int width;
16
 
17
        report_device(0x0101a000);
18
        pio[3] = 0;
19
        pio[2] = 0;
20
        pio[1] = 0;
21
 
22
        pio[2] = 0xFFFFFFFF;
23
 
24
        /* determine port width and mask */
25
        mask = 0;
26
        width = 0;
27
 
28
        while( ((pio[2] >> width) & 1) && (width <= 32)) {
29
                mask = mask | (1 << width);
30
                width++;
31
        }
32
 
33
        pio[2] = mask;
34
        if( (pio[0] & mask) != 0) fail(1);
35
        pio[1] = 0x89ABCDEF;
36
        if( (pio[0] & mask) != (0x89ABCDEF & mask)) fail(2);
37
        pio[2] = 0;
38
}

powered by: WebSVN 2.1.0

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