2 #include <ddekit/panic.h>
3 #include <ddekit/resources.h>
4 #include <ddekit/pgtab.h>
8 #ifdef DDEBUG_LEVEL_RESOURCE
10 #define DDEBUG DDEBUG_LEVEL_RESOURCE
16 /****************************************************************************/
17 /* ddekit_release_dma */
18 /****************************************************************************/
19 int ddekit_request_dma(int nr
) {
21 /* do we stil use isa dma ? imho no.*/
25 /****************************************************************************/
26 /* ddekit_request_dma */
27 /****************************************************************************/
28 int ddekit_release_dma(int nr
) {
30 /* do we stil use isa dma ? imho no.*/
35 * In minix we don't need to explicitly request IO-ports, ...
37 /****************************************************************************/
38 /* ddekit_release/request_io */
39 /****************************************************************************/
40 int ddekit_request_io (ddekit_addr_t start
, ddekit_addr_t count
) {
43 int ddekit_release_io (ddekit_addr_t start
, ddekit_addr_t count
) {
47 /****************************************************************************/
48 /* ddekit_request_mem */
49 /****************************************************************************/
50 int ddekit_request_mem
51 (ddekit_addr_t start
, ddekit_addr_t size
, ddekit_addr_t
*vaddr
) {
53 *vaddr
= (ddekit_addr_t
) vm_map_phys(SELF
, (void *)start
, size
);
55 DDEBUG_MSG_VERBOSE("start: %x, size: %d, virt: %x", start
, size
, *vaddr
);
57 if( *vaddr
== (ddekit_addr_t
) NULL
) {
58 ddekit_panic("unable to map IO memory from %p of size %d",
64 /****************************************************************************/
65 /* ddekit_release_mem */
66 /****************************************************************************/
67 int ddekit_release_mem(ddekit_addr_t start
, ddekit_addr_t size
)
69 return vm_unmap_phys(SELF
,(void *) start
, size
);
72 /****************************************************************************/
74 /****************************************************************************/
75 unsigned char ddekit_inb(ddekit_addr_t port
) {
77 if (sys_inb(port
, &ret
)) {
78 ddekit_panic("sys_inb failed.");
80 DDEBUG_MSG_VERBOSE("read port %x: %x", port
, ret
);
84 /****************************************************************************/
86 /****************************************************************************/
87 unsigned short ddekit_inw(ddekit_addr_t port
) {
89 if (sys_inw(port
, &ret
)) {
90 ddekit_panic("sys_inw failed.");
92 DDEBUG_MSG_VERBOSE("read port %x: %x", port
, ret
);
96 /****************************************************************************/
98 /****************************************************************************/
99 unsigned long ddekit_inl(ddekit_addr_t port
){
101 if (sys_inl(port
, &ret
)) {
102 ddekit_panic("sys_outl failed.");
104 DDEBUG_MSG_VERBOSE("read port %x: %x", port
, ret
);
108 /****************************************************************************/
110 /****************************************************************************/
111 void ddekit_outb(ddekit_addr_t port
, unsigned char val
) {
112 if (sys_outb(port
,val
)) {
113 ddekit_panic("sys_outb failed.");
115 DDEBUG_MSG_VERBOSE("write port %x: %x", port
, val
);
118 /****************************************************************************/
120 /****************************************************************************/
121 void ddekit_outw(ddekit_addr_t port
, unsigned short val
) {
122 if (sys_outw(port
,val
)) {
123 ddekit_panic("sys_outw failed.");
125 DDEBUG_MSG_VERBOSE("write port %x: %x", port
, val
);
128 /****************************************************************************/
130 /****************************************************************************/
131 void ddekit_outl(ddekit_addr_t port
, unsigned long val
) {
132 if (sys_outl(port
,val
)) {
133 ddekit_panic("sys_outl failed.");
135 DDEBUG_MSG_VERBOSE("write port %x: %x", port
, val
);