xref: /minix3/minix/drivers/audio/es1370/pci_helper.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1 /* best viewed with tabsize 4 */
2 
3 #include <minix/drivers.h>
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <errno.h>
8 
9 
10 #include "pci_helper.h"
11 
12 #include "es1370.h"
13 
14 /*===========================================================================*
15  *			helper functions for I/O										 *
16  *===========================================================================*/
pci_inb(u16_t port)17 u32_t pci_inb(u16_t port) {
18 	u32_t value;
19 	int s;
20 	if ((s=sys_inb(port, &value)) !=OK)
21 		printf("%s: warning, sys_inb failed: %d\n", DRIVER_NAME, s);
22 	return value;
23 }
24 
25 
pci_inw(u16_t port)26 u32_t pci_inw(u16_t port) {
27 	u32_t value;
28 	int s;
29 	if ((s=sys_inw(port, &value)) !=OK)
30 		printf("%s: warning, sys_inw failed: %d\n", DRIVER_NAME, s);
31 	return value;
32 }
33 
34 
pci_inl(u16_t port)35 u32_t pci_inl(u16_t port) {
36 	u32_t value;
37 	int s;
38 	if ((s=sys_inl(port, &value)) !=OK)
39 		printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);
40 	return value;
41 }
42 
43 
pci_outb(u16_t port,u8_t value)44 void pci_outb(u16_t port, u8_t value) {
45 	int s;
46 	if ((s=sys_outb(port, value)) !=OK)
47 		printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
48 }
49 
50 
pci_outw(u16_t port,u16_t value)51 void pci_outw(u16_t port, u16_t value) {
52 	int s;
53 	if ((s=sys_outw(port, value)) !=OK)
54 		printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
55 }
56 
57 
pci_outl(u16_t port,u32_t value)58 void pci_outl(u16_t port, u32_t value) {
59 	int s;
60 	if ((s=sys_outl(port, value)) !=OK)
61 		printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
62 }
63 
64