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