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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [sparc/] [prom/] [devops.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/* $Id: devops.c,v 1.1 2005-12-20 09:49:32 jcastillo Exp $
2
 * devops.c:  Device operations using the PROM.
3
 *
4
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5
 */
6
 
7
#include <asm/openprom.h>
8
#include <asm/oplib.h>
9
 
10
/* Open the device described by the string 'dstr'.  Returns the handle
11
 * to that device used for subsequent operations on that device.
12
 * Returns -1 on failure.
13
 */
14
int
15
prom_devopen(char *dstr)
16
{
17
        int handle;
18
        switch(prom_vers) {
19
        case PROM_V0:
20
                handle = (*(romvec->pv_v0devops.v0_devopen))(dstr);
21
                if(handle == 0) return -1;
22
                return handle;
23
                break;
24
        case PROM_V2:
25
        case PROM_V3:
26
        case PROM_P1275:
27
                handle = (*(romvec->pv_v2devops.v2_dev_open))(dstr);
28
                return handle;
29
                break;
30
        case PROM_AP1000:
31
                break;
32
        };
33
 
34
        return -1;
35
}
36
 
37
/* Close the device described by device handle 'dhandle'. */
38
void
39
prom_close(int dhandle)
40
{
41
        switch(prom_vers) {
42
        case PROM_V0:
43
                (*(romvec->pv_v0devops.v0_devclose))(dhandle);
44
                return;
45
        case PROM_V2:
46
        case PROM_V3:
47
        case PROM_P1275:
48
                (*(romvec->pv_v2devops.v2_dev_close))(dhandle);
49
                return;
50
        case PROM_AP1000:
51
                return;
52
        };
53
        return;
54
}
55
 
56
/* Seek to specified location described by 'seekhi' and 'seeklo'
57
 * for device 'dhandle'.
58
 */
59
void
60
prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo)
61
{
62
        switch(prom_vers) {
63
        case PROM_V0:
64
                (*(romvec->pv_v0devops.v0_seekdev))(dhandle, seekhi, seeklo);
65
                break;
66
        case PROM_V2:
67
        case PROM_V3:
68
        case PROM_P1275:
69
                (*(romvec->pv_v2devops.v2_dev_seek))(dhandle, seekhi, seeklo);
70
                break;
71
        case PROM_AP1000:
72
                break;
73
        };
74
 
75
        return;
76
}

powered by: WebSVN 2.1.0

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