2007-11-23 12:40:33 +01:00
|
|
|
/* best viewed with tabsize 4 */
|
|
|
|
|
2010-03-22 22:25:22 +01:00
|
|
|
#include <minix/drivers.h>
|
2007-11-23 12:40:33 +01:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "pci_helper.h"
|
|
|
|
|
|
|
|
#include "es1370.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* helper functions for I/O *
|
|
|
|
*===========================================================================*/
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC unsigned pci_inb(u16_t port) {
|
2007-11-23 12:40:33 +01:00
|
|
|
u32_t value;
|
|
|
|
int s;
|
|
|
|
if ((s=sys_inb(port, &value)) !=OK)
|
|
|
|
printf("%s: warning, sys_inb failed: %d\n", DRIVER_NAME, s);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC unsigned pci_inw(u16_t port) {
|
2007-11-23 12:40:33 +01:00
|
|
|
u32_t value;
|
|
|
|
int s;
|
|
|
|
if ((s=sys_inw(port, &value)) !=OK)
|
|
|
|
printf("%s: warning, sys_inw failed: %d\n", DRIVER_NAME, s);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC unsigned pci_inl(u16_t port) {
|
2007-11-23 12:40:33 +01:00
|
|
|
U32_t value;
|
|
|
|
int s;
|
|
|
|
if ((s=sys_inl(port, &value)) !=OK)
|
|
|
|
printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC void pci_outb(u16_t port, u8_t value) {
|
2007-11-23 12:40:33 +01:00
|
|
|
int s;
|
|
|
|
if ((s=sys_outb(port, value)) !=OK)
|
|
|
|
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC void pci_outw(u16_t port, u16_t value) {
|
2007-11-23 12:40:33 +01:00
|
|
|
int s;
|
|
|
|
if ((s=sys_outw(port, value)) !=OK)
|
|
|
|
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-07 15:35:56 +02:00
|
|
|
PUBLIC void pci_outl(u16_t port, u32_t value) {
|
2007-11-23 12:40:33 +01:00
|
|
|
int s;
|
|
|
|
if ((s=sys_outl(port, value)) !=OK)
|
|
|
|
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
|
|
|
|
}
|
|
|
|
|