root / lab4 / .minix-src / include / ddekit / resources.h @ 13
History | View | Annotate | Download (1.56 KB)
1 | 13 | up20180614 | #ifndef _DDEKIT_RESOURCES_H
|
---|---|---|---|
2 | #define _DDEKIT_RESOURCES_H
|
||
3 | |||
4 | #include <ddekit/ddekit.h> |
||
5 | #include <ddekit/types.h> |
||
6 | |||
7 | |||
8 | /*
|
||
9 | * request/release an isa DMA-channel
|
||
10 | */
|
||
11 | |||
12 | int ddekit_request_dma(int nr); |
||
13 | int ddekit_release_dma(int nr); |
||
14 | |||
15 | /*
|
||
16 | * request/release an io-port range starting at addr start, lenght of count
|
||
17 | */
|
||
18 | int ddekit_request_io(ddekit_addr_t start, ddekit_addr_t count);
|
||
19 | int ddekit_release_io(ddekit_addr_t start, ddekit_addr_t count);
|
||
20 | |||
21 | /*
|
||
22 | * request an IO-Memory mapping from address start to vaddr of the length count
|
||
23 | */
|
||
24 | int ddekit_request_mem(ddekit_addr_t start, ddekit_addr_t count,
|
||
25 | ddekit_addr_t *vaddr); |
||
26 | int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t count);
|
||
27 | |||
28 | /**
|
||
29 | * Read I/O port (byte)
|
||
30 | *
|
||
31 | * \param port port to read
|
||
32 | *
|
||
33 | * \return value read from port
|
||
34 | */
|
||
35 | unsigned char ddekit_inb(ddekit_addr_t port); |
||
36 | |||
37 | /**
|
||
38 | * Read I/O port (2-byte)
|
||
39 | *
|
||
40 | * \param port port to read
|
||
41 | *
|
||
42 | * \return value read from port
|
||
43 | */
|
||
44 | unsigned short ddekit_inw(ddekit_addr_t port); |
||
45 | |||
46 | /**
|
||
47 | * Read I/O port (4-byte)
|
||
48 | *
|
||
49 | * \param port port to read
|
||
50 | *
|
||
51 | * \return value read from port
|
||
52 | */
|
||
53 | unsigned long ddekit_inl(ddekit_addr_t port); |
||
54 | |||
55 | /**
|
||
56 | * Write I/O port (byte)
|
||
57 | *
|
||
58 | * \param port port to write
|
||
59 | * \param val value to write
|
||
60 | */
|
||
61 | void ddekit_outb(ddekit_addr_t port, unsigned char val); |
||
62 | |||
63 | /**
|
||
64 | * Write I/O port (2-byte)
|
||
65 | *
|
||
66 | * \param port port to write
|
||
67 | * \param val value to write
|
||
68 | */
|
||
69 | void ddekit_outw(ddekit_addr_t port, unsigned short val); |
||
70 | |||
71 | /**
|
||
72 | * Write I/O port (4-byte)
|
||
73 | *
|
||
74 | * \param port port to write
|
||
75 | * \param val value to write
|
||
76 | */
|
||
77 | void ddekit_outl(ddekit_addr_t port, unsigned long val); |
||
78 | |||
79 | |||
80 | #endif |