now avoids to use read_io* and write_io* (untested)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13525 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -65,7 +65,7 @@ const char ** publish_devices(void);
|
|||||||
device_hooks * find_device(const char *);
|
device_hooks * find_device(const char *);
|
||||||
|
|
||||||
static char pci_name[] = B_PCI_MODULE_NAME;
|
static char pci_name[] = B_PCI_MODULE_NAME;
|
||||||
static pci_module_info *pci;
|
pci_module_info *pci;
|
||||||
static char mpu401_name[] = B_MPU_401_MODULE_NAME;
|
static char mpu401_name[] = B_MPU_401_MODULE_NAME;
|
||||||
generic_mpu401_module * mpu401;
|
generic_mpu401_module * mpu401;
|
||||||
|
|
||||||
|
|||||||
@@ -30,54 +30,46 @@
|
|||||||
*/
|
*/
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <PCI.h>
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "emuxkireg.h"
|
#include "emuxkireg.h"
|
||||||
|
|
||||||
/*
|
extern pci_module_info *pci;
|
||||||
* from BeOS R3 KernelExport.h
|
|
||||||
* should be replaced by PCI bus manager functions
|
|
||||||
*/
|
|
||||||
uint8 read_io_8(int mapped_io_addr);
|
|
||||||
void write_io_8(int mapped_io_addr, uint8 value);
|
|
||||||
uint16 read_io_16(int mapped_io_addr);
|
|
||||||
void write_io_16(int mapped_io_addr, uint16 value);
|
|
||||||
uint32 read_io_32(int mapped_io_addr);
|
|
||||||
void write_io_32(int mapped_io_addr, uint32 value);
|
|
||||||
|
|
||||||
uint8
|
uint8
|
||||||
emuxki_reg_read_8(device_config *config, int regno)
|
emuxki_reg_read_8(device_config *config, int regno)
|
||||||
{
|
{
|
||||||
return read_io_8(config->nabmbar + regno);
|
return pci->read_io_8(config->nabmbar + regno);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16
|
uint16
|
||||||
emuxki_reg_read_16(device_config *config, int regno)
|
emuxki_reg_read_16(device_config *config, int regno)
|
||||||
{
|
{
|
||||||
return read_io_16(config->nabmbar + regno);
|
return pci->read_io_16(config->nabmbar + regno);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
emuxki_reg_read_32(device_config *config, int regno)
|
emuxki_reg_read_32(device_config *config, int regno)
|
||||||
{
|
{
|
||||||
return read_io_32(config->nabmbar + regno);
|
return pci->read_io_32(config->nabmbar + regno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emuxki_reg_write_8(device_config *config, int regno, uint8 value)
|
emuxki_reg_write_8(device_config *config, int regno, uint8 value)
|
||||||
{
|
{
|
||||||
write_io_8(config->nabmbar + regno, value);
|
pci->write_io_8(config->nabmbar + regno, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emuxki_reg_write_16(device_config *config, int regno, uint16 value)
|
emuxki_reg_write_16(device_config *config, int regno, uint16 value)
|
||||||
{
|
{
|
||||||
write_io_16(config->nabmbar + regno, value);
|
pci->write_io_16(config->nabmbar + regno, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emuxki_reg_write_32(device_config *config, int regno, uint32 value)
|
emuxki_reg_write_32(device_config *config, int regno, uint32 value)
|
||||||
{
|
{
|
||||||
write_io_32(config->nabmbar + regno, value);
|
pci->write_io_32(config->nabmbar + regno, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emu10k1 Low level */
|
/* Emu10k1 Low level */
|
||||||
@@ -96,8 +88,8 @@ emuxki_chan_read(device_config *config, uint16 chano, uint32 reg)
|
|||||||
offset = (reg >> 16) & 0x1f;
|
offset = (reg >> 16) & 0x1f;
|
||||||
mask = ((1 << size) - 1) << offset;
|
mask = ((1 << size) - 1) << offset;
|
||||||
}
|
}
|
||||||
write_io_32(config->nabmbar + EMU_PTR, ptr);
|
pci->write_io_32(config->nabmbar + EMU_PTR, ptr);
|
||||||
ptr = (read_io_32(config->nabmbar + EMU_DATA) & mask) >> offset;
|
ptr = (pci->read_io_32(config->nabmbar + EMU_DATA) & mask) >> offset;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +110,8 @@ emuxki_chan_write(device_config *config, uint16 chano,
|
|||||||
data = ((data << offset) & mask) |
|
data = ((data << offset) & mask) |
|
||||||
(emuxki_chan_read(config, chano, reg & 0xFFFF) & ~mask);
|
(emuxki_chan_read(config, chano, reg & 0xFFFF) & ~mask);
|
||||||
}
|
}
|
||||||
write_io_32(config->nabmbar + EMU_PTR, ptr);
|
pci->write_io_32(config->nabmbar + EMU_PTR, ptr);
|
||||||
write_io_32(config->nabmbar + EMU_DATA, data);
|
pci->write_io_32(config->nabmbar + EMU_DATA, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Microcode */
|
/* Microcode */
|
||||||
@@ -208,15 +200,15 @@ emuxki_read_gpr(device_config *config, uint32 pc)
|
|||||||
uint16
|
uint16
|
||||||
emuxki_codec_read(device_config *config, int regno)
|
emuxki_codec_read(device_config *config, int regno)
|
||||||
{
|
{
|
||||||
write_io_8(config->nabmbar + EMU_AC97ADDR, regno);
|
pci->write_io_8(config->nabmbar + EMU_AC97ADDR, regno);
|
||||||
return read_io_16(config->nabmbar + EMU_AC97DATA);
|
return pci->read_io_16(config->nabmbar + EMU_AC97DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emuxki_codec_write(device_config *config, int regno, uint16 value)
|
emuxki_codec_write(device_config *config, int regno, uint16 value)
|
||||||
{
|
{
|
||||||
write_io_8(config->nabmbar + EMU_AC97ADDR, regno);
|
pci->write_io_8(config->nabmbar + EMU_AC97ADDR, regno);
|
||||||
write_io_16(config->nabmbar + EMU_AC97DATA, value);
|
pci->write_io_16(config->nabmbar + EMU_AC97DATA, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inte */
|
/* inte */
|
||||||
|
|||||||
Reference in New Issue
Block a user