2 ** File: devio.c Jun. 11, 2005
4 ** Author: Giovanni Falzoni <gfalzoni@inwind.it>
6 ** This file contains the routines for readind/writing
7 ** from/to the device registers.
10 #include <minix/drivers.h>
11 #include <net/gen/ether.h>
12 #include <net/gen/eth_io.h>
17 static void warning(const char *type
, int err
)
20 printf("Warning: eth#0 sys_%s failed (%d)\n", type
, err
);
25 ** Name: unsigned int inb(unsigned short int port);
26 ** Function: Reads a byte from specified i/o port.
28 unsigned int inb(unsigned short port
)
33 if ((rc
= sys_inb(port
, &value
)) != OK
) warning("inb", rc
);
38 ** Name: unsigned int inw(unsigned short int port);
39 ** Function: Reads a word from specified i/o port.
41 unsigned int inw(unsigned short port
)
46 if ((rc
= sys_inw(port
, &value
)) != OK
) warning("inw", rc
);
51 ** Name: unsigned int insb(unsigned short int port, int proc_nr, void *buffer, int count);
52 ** Function: Reads a sequence of bytes from specified i/o port to user space buffer.
54 void insb(unsigned short int port
, endpoint_t proc_nr
,
55 void *buffer
, int count
)
59 if ((rc
= sys_insb(port
, proc_nr
, buffer
, count
)) != OK
)
66 ** Name: void outb(unsigned short int port, unsigned long value);
67 ** Function: Writes a byte to specified i/o port.
69 void outb(unsigned short port
, unsigned long value
)
73 if ((rc
= sys_outb(port
, value
)) != OK
) warning("outb", rc
);
78 ** Name: void outw(unsigned short int port, unsigned long value);
79 ** Function: Writes a word to specified i/o port.
81 void outw(unsigned short port
, unsigned long value
)
85 if ((rc
= sys_outw(port
, value
)) != OK
) warning("outw", rc
);
90 ** Name: void outsb(unsigned short int port, int proc_nr, void *buffer, int count);
91 ** Function: Writes a sequence of bytes from user space to specified i/o port.
93 void outsb(unsigned short port
, endpoint_t proc_nr
, void *buffer
, int count
)
97 if ((rc
= sys_outsb(port
, proc_nr
, buffer
, count
)) != OK
)
103 #error To be implemented
104 #endif /* USE_IOPL */