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