fixes warnings

now avoids to use read_io* and write_io* (untested)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13524 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2005-07-07 12:15:52 +00:00
parent 372aa42698
commit df41cb2540
2 changed files with 21 additions and 28 deletions

View File

@ -56,7 +56,7 @@ const char ** publish_devices(void);
device_hooks * find_device(const char *);
static char pci_name[] = B_PCI_MODULE_NAME;
static pci_module_info *pci;
pci_module_info *pci;
int32 num_cards;
auvia_dev cards[NUM_CARDS];
@ -358,7 +358,8 @@ auvia_stream_delete(auvia_stream *stream)
/* Auvia interrupt */
int32 auvia_int(void *arg)
static int32
auvia_int(void *arg)
{
auvia_dev *card = arg;
bool gotone = false;
@ -447,14 +448,14 @@ auvia_init(auvia_dev * card)
uint32 pr;
pr = (*pci->read_pci_config)(card->info.bus, card->info.device, card->info.function, AUVIA_PCICONF_JUNK, 4);
PRINT(("AUVIA_PCICONF_JUNK before: %x\n", pr));
PRINT(("AUVIA_PCICONF_JUNK before: %lx\n", pr));
pr &= ~AUVIA_PCICONF_ENABLES;
pr |= AUVIA_PCICONF_ACLINKENAB | AUVIA_PCICONF_ACNOTRST | AUVIA_PCICONF_ACVSR | AUVIA_PCICONF_ACSGD;
pr &= ~(AUVIA_PCICONF_ACFM | AUVIA_PCICONF_ACSB);
(*pci->write_pci_config)(card->info.bus, card->info.device, card->info.function, AUVIA_PCICONF_JUNK, 4, pr );
snooze(100);
pr = (*pci->read_pci_config)(card->info.bus, card->info.device, card->info.function, AUVIA_PCICONF_JUNK, 4);
PRINT(("AUVIA_PCICONF_JUNK after: %x\n", pr));
PRINT(("AUVIA_PCICONF_JUNK after: %lx\n", pr));
if(IS_8233(&card->config)) {
card->interrupt_mask =
@ -497,7 +498,7 @@ auvia_setup(auvia_dev * card)
if(card->info.device_id == VIATECH_8233_AC97_DEVICE_ID)
card->config.type |= TYPE_8233;
PRINT(("%s deviceid = %#04x chiprev = %x model = %x enhanced at %x\n", card->name, card->info.device_id,
PRINT(("%s deviceid = %#04x chiprev = %x model = %x enhanced at %lx\n", card->name, card->info.device_id,
card->info.revision, card->info.u.h0.subsystem_id, card->config.nabmbar));
cmd = (*pci->read_pci_config)(card->info.bus, card->info.device, card->info.function, PCI_command, 2);
@ -514,11 +515,11 @@ auvia_setup(auvia_dev * card)
ac97_init(&card->config);
ac97_amp_enable(&card->config, true);
PRINT(("codec vendor id = %#08x\n",ac97_get_vendor_id(&card->config)));
PRINT(("codec vendor id = %#08lx\n",ac97_get_vendor_id(&card->config)));
PRINT(("codec description = %s\n",ac97_get_vendor_id_description(&card->config)));
PRINT(("codec 3d enhancement = %s\n",ac97_get_3d_stereo_enhancement(&card->config)));
PRINT(("installing interrupt : %x\n", card->config.irq));
PRINT(("installing interrupt : %lx\n", card->config.irq));
install_io_interrupt_handler(card->config.irq, auvia_int, card, 0);
/*PRINT(("codec master output = %#04x\n",auvia_codec_read(&card->config, 0x02)));

View File

@ -33,52 +33,44 @@
#include "io.h"
#include "auviareg.h"
#include "debug.h"
#include <PCI.h>
/*
* 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);
extern pci_module_info *pci;
uint8
auvia_reg_read_8(device_config *config, int regno)
{
return read_io_8(config->nabmbar + regno);
return pci->read_io_8(config->nabmbar + regno);
}
uint16
auvia_reg_read_16(device_config *config, int regno)
{
return read_io_16(config->nabmbar + regno);
return pci->read_io_16(config->nabmbar + regno);
}
uint32
auvia_reg_read_32(device_config *config, int regno)
{
return read_io_32(config->nabmbar + regno);
return pci->read_io_32(config->nabmbar + regno);
}
void
auvia_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
auvia_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
auvia_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);
}
/* codec */
@ -91,7 +83,7 @@ auvia_codec_waitready(device_config *config)
int i;
/* poll until codec not busy */
for(i=0; (i<AUVIA_TIMEOUT) && (read_io_32(config->nabmbar
for(i=0; (i<AUVIA_TIMEOUT) && (pci->read_io_32(config->nabmbar
+ AUVIA_CODEC_CTL) & AUVIA_CODEC_BUSY) ; i++)
snooze(1);
if(i>=AUVIA_TIMEOUT) {
@ -107,7 +99,7 @@ auvia_codec_waitvalid(device_config *config)
int i;
/* poll until codec valid */
for(i=0; (i<AUVIA_TIMEOUT) && !(read_io_32(config->nabmbar
for(i=0; (i<AUVIA_TIMEOUT) && !(pci->read_io_32(config->nabmbar
+ AUVIA_CODEC_CTL) & AUVIA_CODEC_PRIVALID) ; i++)
snooze(1);
if(i>=AUVIA_TIMEOUT) {
@ -124,7 +116,7 @@ auvia_codec_read(device_config *config, int regno)
PRINT(("codec busy (1)\n"));
return -1;
}
write_io_32(config->nabmbar + AUVIA_CODEC_CTL,
pci->write_io_32(config->nabmbar + AUVIA_CODEC_CTL,
AUVIA_CODEC_PRIVALID | AUVIA_CODEC_READ | AUVIA_CODEC_INDEX(regno));
if(auvia_codec_waitready(config)!=B_OK) {
@ -136,7 +128,7 @@ auvia_codec_read(device_config *config, int regno)
return -1;
}
return read_io_16(config->nabmbar + AUVIA_CODEC_CTL);
return pci->read_io_16(config->nabmbar + AUVIA_CODEC_CTL);
}
void
@ -146,6 +138,6 @@ auvia_codec_write(device_config *config, int regno, uint16 value)
PRINT(("codec busy (4)\n"));
return;
}
write_io_32(config->nabmbar + AUVIA_CODEC_CTL,
pci->write_io_32(config->nabmbar + AUVIA_CODEC_CTL,
AUVIA_CODEC_PRIVALID | AUVIA_CODEC_INDEX(regno) | value);
}