kernel: vm kernel call can't suspend
[minix.git] / drivers / dpeth / devio.c
blobba8a545c214fa677f49b792bffde8f008adf433c
1 /*
2 ** File: devio.c Jun. 11, 2005
3 **
4 ** Author: Giovanni Falzoni <gfalzoni@inwind.it>
5 **
6 ** This file contains the routines for readind/writing
7 ** from/to the device registers.
8 */
10 #include <minix/drivers.h>
11 #include <net/gen/ether.h>
12 #include <net/gen/eth_io.h>
13 #include "dp.h"
15 #if (USE_IOPL == 0)
17 static void warning(const char *type, int err)
20 printf("Warning: eth#0 sys_%s failed (%d)\n", type, err);
21 return;
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)
30 u32_t value;
31 int rc;
33 if ((rc = sys_inb(port, &value)) != OK) warning("inb", rc);
34 return value;
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)
43 u32_t value;
44 int rc;
46 if ((rc = sys_inw(port, &value)) != OK) warning("inw", rc);
47 return value;
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)
57 int rc;
59 if ((rc = sys_insb(port, proc_nr, buffer, count)) != OK)
60 warning("insb", rc);
61 return;
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)
71 int rc;
73 if ((rc = sys_outb(port, value)) != OK) warning("outb", rc);
74 return;
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)
83 int rc;
85 if ((rc = sys_outw(port, value)) != OK) warning("outw", rc);
86 return;
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)
95 int rc;
97 if ((rc = sys_outsb(port, proc_nr, buffer, count)) != OK)
98 warning("outsb", rc);
99 return;
102 #else
103 #error To be implemented
104 #endif /* USE_IOPL */
105 /** devio.c **/