removed warnigs, spelling errors, added prototypes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <OS.h>
|
||||
#include <MediaDefs.h>
|
||||
#include "multi_audio.h"
|
||||
#include "ac97_multi.h"
|
||||
|
||||
//#define DEBUG 1
|
||||
|
||||
@@ -43,10 +44,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static status_t get_control(multi_mix_control * control)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
static status_t list_mix_controls(multi_mix_control_info *data);
|
||||
static status_t list_mix_connections(multi_mix_connection_info *data);
|
||||
static status_t list_mix_channels(multi_mix_channel_info *data);
|
||||
static status_t get_description(multi_description *data);
|
||||
static status_t get_enabled_channels(multi_channel_enable *data);
|
||||
static status_t get_global_format(multi_format_info *data);
|
||||
static status_t get_buffers(multi_buffer_list *data);
|
||||
static status_t buffer_exchange(multi_buffer_info *data);
|
||||
static status_t buffer_force_stop();
|
||||
|
||||
static status_t list_mix_controls(multi_mix_control_info * data)
|
||||
{
|
||||
@@ -74,7 +80,7 @@ multi_channel_info chans[] = {
|
||||
{ 7, B_MULTI_INPUT_BUS, B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS, B_CHANNEL_MINI_JACK_STEREO },
|
||||
};
|
||||
|
||||
status_t get_description(multi_description *data)
|
||||
static status_t get_description(multi_description *data)
|
||||
{
|
||||
data->interface_version = B_CURRENT_INTERFACE_VERSION;
|
||||
data->interface_minimum = B_CURRENT_INTERFACE_VERSION;
|
||||
@@ -116,7 +122,7 @@ status_t get_description(multi_description *data)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t get_enabled_channels(multi_channel_enable *data)
|
||||
static status_t get_enabled_channels(multi_channel_enable *data)
|
||||
{
|
||||
B_SET_CHANNEL(data->enable_bits, 0, true);
|
||||
B_SET_CHANNEL(data->enable_bits, 1, true);
|
||||
@@ -132,7 +138,7 @@ status_t get_enabled_channels(multi_channel_enable *data)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t get_global_format(multi_format_info *data)
|
||||
static status_t get_global_format(multi_format_info *data)
|
||||
{
|
||||
data->output_latency = 0;
|
||||
data->input_latency = 0;
|
||||
@@ -146,7 +152,7 @@ status_t get_global_format(multi_format_info *data)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t get_buffers(multi_buffer_list *data)
|
||||
static status_t get_buffers(multi_buffer_list *data)
|
||||
{
|
||||
TRACE(("flags = %#x\n",data->flags));
|
||||
TRACE(("request_playback_buffers = %#x\n",data->request_playback_buffers));
|
||||
@@ -193,19 +199,19 @@ status_t get_buffers(multi_buffer_list *data)
|
||||
data->record_buffers[0][0].base = chan_pi->userbuffer[0]; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[0][0].stride = 4; /* offset to next sample */
|
||||
/* buffer 0, right channel */
|
||||
data->record_buffers[0][1].base = chan_pi->userbuffer[0] + 2; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[0][1].base = ((char*)chan_pi->userbuffer[0]) + 2; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[0][1].stride = 4; /* offset to next sample */
|
||||
/* buffer 1, left channel */
|
||||
data->record_buffers[1][0].base = chan_pi->userbuffer[1]; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[1][0].stride = 4; /* offset to next sample */
|
||||
/* buffer 1, right channel */
|
||||
data->record_buffers[1][1].base = chan_pi->userbuffer[1] + 2; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[1][1].base = ((char*)chan_pi->userbuffer[1]) + 2; /* pointer to first sample for channel for buffer */
|
||||
data->record_buffers[1][1].stride = 4; /* offset to next sample */
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t buffer_exchange(multi_buffer_info *data)
|
||||
static status_t buffer_exchange(multi_buffer_info *data)
|
||||
{
|
||||
cpu_status status;
|
||||
void *backbuffer;
|
||||
@@ -283,7 +289,7 @@ status_t buffer_exchange(multi_buffer_info *data)
|
||||
*/
|
||||
}
|
||||
|
||||
status_t buffer_force_stop()
|
||||
static status_t buffer_force_stop()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@
|
||||
#define _AC97_MULTI_H_
|
||||
|
||||
status_t multi_control(void *cookie, uint32 op, void *data, size_t length);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <config_manager.h>
|
||||
#include <PCI.h>
|
||||
#include <OS.h>
|
||||
#include <malloc.h>
|
||||
|
||||
//#define DEBUG 2
|
||||
|
||||
@@ -46,7 +47,7 @@ status_t find_pci_pin_irq(uint8 pin, uint8 *irq);
|
||||
* XXX multiple controllers not supported
|
||||
*/
|
||||
|
||||
status_t probe_device()
|
||||
status_t probe_device(void)
|
||||
{
|
||||
pci_module_info *pcimodule;
|
||||
config_manager_for_driver_module_info *configmodule;
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct
|
||||
|
||||
extern device_config *config;
|
||||
|
||||
status_t probe_device();
|
||||
status_t probe_device(void);
|
||||
|
||||
#define TYPE_ICH4 0x01
|
||||
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#include <KernelExport.h>
|
||||
#include <stdio.h>
|
||||
#include <OS.h>
|
||||
#include "debug.h"
|
||||
#include "ich.h"
|
||||
|
||||
void debug_printf(const char *text,...);
|
||||
|
||||
void debug_printf(const char *text,...)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
@@ -49,12 +49,15 @@ ich_chan * chan_pi = 0;
|
||||
ich_chan * chan_po = 0;
|
||||
ich_chan * chan_mc = 0;
|
||||
|
||||
int32 ihc_int(void *data);
|
||||
int32 ihc_test_int(void *check);
|
||||
bool interrupt_test();
|
||||
int32 ich_int(void *data);
|
||||
int32 ich_test_int(void *check);
|
||||
bool interrupt_test(void);
|
||||
void init_chan(ich_chan *chan);
|
||||
void start_chan(ich_chan *chan);
|
||||
void reset_chan(ich_chan *chan);
|
||||
void chan_free_resources(void);
|
||||
status_t map_io_memory(void);
|
||||
status_t unmap_io_memory(void);
|
||||
int32 int_thread(void *data);
|
||||
|
||||
#if DEBUG > 2
|
||||
void dump_chan(ich_chan *chan)
|
||||
@@ -155,7 +158,7 @@ void reset_chan(ich_chan *chan)
|
||||
TRACE(("channel reset failed after 10ms\n"));
|
||||
}
|
||||
|
||||
bool interrupt_test()
|
||||
bool interrupt_test(void)
|
||||
{
|
||||
bool *testresult;
|
||||
bool result;
|
||||
@@ -169,7 +172,7 @@ bool interrupt_test()
|
||||
testresult = malloc(sizeof(bool));
|
||||
*testresult = false; // assume it's not working
|
||||
|
||||
install_io_interrupt_handler(config->irq, ihc_test_int, testresult, 0);
|
||||
install_io_interrupt_handler(config->irq, ich_test_int, testresult, 0);
|
||||
|
||||
// clear status bits
|
||||
ich_reg_write_16(chan_po->regbase + ICH_REG_X_SR, SR_FIFOE | SR_BCIS | SR_LVBCI);
|
||||
@@ -193,7 +196,7 @@ bool interrupt_test()
|
||||
|
||||
snooze(25000);
|
||||
|
||||
remove_io_interrupt_handler(config->irq, ihc_test_int, testresult);
|
||||
remove_io_interrupt_handler(config->irq, ich_test_int, testresult);
|
||||
result = *testresult;
|
||||
free(testresult);
|
||||
|
||||
@@ -207,7 +210,7 @@ bool interrupt_test()
|
||||
return result;
|
||||
}
|
||||
|
||||
void chan_free_resources()
|
||||
void chan_free_resources(void)
|
||||
{
|
||||
if (chan_po) {
|
||||
if (chan_po->buffer_ready_sem > B_OK)
|
||||
@@ -244,7 +247,7 @@ void chan_free_resources()
|
||||
}
|
||||
}
|
||||
|
||||
status_t map_io_memory()
|
||||
status_t map_io_memory(void)
|
||||
{
|
||||
if ((config->type & TYPE_ICH4) == 0)
|
||||
return B_OK;
|
||||
@@ -268,7 +271,7 @@ status_t map_io_memory()
|
||||
}
|
||||
}
|
||||
|
||||
status_t unmap_io_memory()
|
||||
status_t unmap_io_memory(void)
|
||||
{
|
||||
status_t rv;
|
||||
if ((config->type & TYPE_ICH4) == 0)
|
||||
@@ -283,7 +286,7 @@ int32 int_thread(void *data)
|
||||
cpu_status status;
|
||||
while (!int_thread_exit) {
|
||||
status = disable_interrupts();
|
||||
ihc_int(data);
|
||||
ich_int(data);
|
||||
restore_interrupts(status);
|
||||
snooze(1500);
|
||||
}
|
||||
@@ -319,7 +322,7 @@ init_driver(void)
|
||||
}
|
||||
|
||||
dprintf("ich-ac97: " VERSION "\n");
|
||||
dprintf("ich-ac97: found %s, IRQ = %d, NAMBAR = %#X, NABMBAR = %#X, MMBAR = %#X, MBBAR = %#X\n",config->name,config->irq,config->nambar,config->nabmbar,config->mmbar,config->mbbar);
|
||||
dprintf("ich-ac97: found %s, IRQ = %ld, NAMBAR = %#lX, NABMBAR = %#lX, MMBAR = %#lX, MBBAR = %#lX\n",config->name,config->irq,config->nambar,config->nabmbar,config->mmbar,config->mbbar);
|
||||
|
||||
/* before doing anything else, map the IO memory */
|
||||
rv = map_io_memory();
|
||||
@@ -367,7 +370,7 @@ init_driver(void)
|
||||
} else {
|
||||
TRACE(("secondary codec not ready after %Ld us\n",(system_time() - start)));
|
||||
}
|
||||
if ((rv & STA_PCR | STA_SCR) == 0) {
|
||||
if ((rv & (STA_PCR | STA_SCR)) == 0) {
|
||||
dprintf("ich-ac97: compatible chipset found, but no codec ready!\n");
|
||||
unmap_io_memory();
|
||||
return B_ERROR;
|
||||
@@ -454,7 +457,7 @@ init_driver(void)
|
||||
|
||||
/* install interrupt or polling thread */
|
||||
if (config->irq != 0) {
|
||||
install_io_interrupt_handler(config->irq,ihc_int,0,0);
|
||||
install_io_interrupt_handler(config->irq,ich_int,0,0);
|
||||
} else {
|
||||
int_thread_id = spawn_kernel_thread(int_thread, "ich_ac97 interrupt poller", B_REAL_TIME_PRIORITY, 0);
|
||||
resume_thread(int_thread_id);
|
||||
@@ -508,7 +511,7 @@ uninit_driver(void)
|
||||
|
||||
/* remove the interrupt handler or thread */
|
||||
if (config->irq != 0) {
|
||||
remove_io_interrupt_handler(config->irq,ihc_int,0);
|
||||
remove_io_interrupt_handler(config->irq,ich_int,0);
|
||||
} else if (int_thread_id != -1) {
|
||||
status_t exit_value;
|
||||
int_thread_exit = true;
|
||||
@@ -529,7 +532,7 @@ uninit_driver(void)
|
||||
TRACE(("uninit_driver() finished\n"));
|
||||
}
|
||||
|
||||
int32 ihc_test_int(void *check)
|
||||
int32 ich_test_int(void *check)
|
||||
{
|
||||
/*
|
||||
* This interrupt handler is used once to test if interrupt handling is working.
|
||||
@@ -551,7 +554,7 @@ int32 ihc_test_int(void *check)
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
int32 ihc_int(void *unused)
|
||||
int32 ich_int(void *unused)
|
||||
{
|
||||
uint32 sta;
|
||||
sta = ich_reg_read_32(ICH_REG_GLOB_STA);
|
||||
@@ -583,7 +586,7 @@ int32 ihc_int(void *unused)
|
||||
count = civ - chan_po->lastindex;
|
||||
|
||||
if (count != 1)
|
||||
dprintf(DRIVER_NAME ": lost %d po interrupts\n",count - 1);
|
||||
dprintf(DRIVER_NAME ": lost %ld po interrupts\n",count - 1);
|
||||
|
||||
acquire_spinlock(&slock);
|
||||
chan_po->played_real_time = system_time();
|
||||
@@ -619,7 +622,7 @@ int32 ihc_int(void *unused)
|
||||
count = civ - chan_pi->lastindex;
|
||||
|
||||
if (count != 1)
|
||||
dprintf(DRIVER_NAME ": lost %d pi interrupts\n",count - 1);
|
||||
dprintf(DRIVER_NAME ": lost %ld pi interrupts\n",count - 1);
|
||||
|
||||
acquire_spinlock(&slock);
|
||||
chan_pi->played_real_time = system_time();
|
||||
@@ -648,40 +651,40 @@ int32 ihc_int(void *unused)
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_open(const char *name, uint32 flags, void** cookie)
|
||||
ich_open(const char *name, uint32 flags, void** cookie)
|
||||
{
|
||||
TRACE(("open()\n"));
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_close(void* cookie)
|
||||
ich_close(void* cookie)
|
||||
{
|
||||
TRACE(("close()\n"));
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_free(void* cookie)
|
||||
ich_free(void* cookie)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_control(void* cookie, uint32 op, void* arg, size_t len)
|
||||
ich_control(void* cookie, uint32 op, void* arg, size_t len)
|
||||
{
|
||||
return multi_control(cookie,op,arg,len);
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
||||
ich_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
||||
{
|
||||
*num_bytes = 0; /* tell caller nothing was read */
|
||||
return B_IO_ERROR;
|
||||
}
|
||||
|
||||
static status_t
|
||||
ihc_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
||||
ich_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
||||
{
|
||||
*num_bytes = 0; /* tell caller nothing was written */
|
||||
return B_IO_ERROR;
|
||||
@@ -692,7 +695,7 @@ ihc_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
||||
null-terminated array of device names supported by this driver
|
||||
----- */
|
||||
|
||||
static const char *ihc_name[] = {
|
||||
static const char *ich_name[] = {
|
||||
"audio/multi/ich_ac97/1",
|
||||
NULL
|
||||
};
|
||||
@@ -701,13 +704,13 @@ static const char *ihc_name[] = {
|
||||
function pointers for the device hooks entry points
|
||||
----- */
|
||||
|
||||
device_hooks ihc_hooks = {
|
||||
ihc_open, /* -> open entry point */
|
||||
ihc_close, /* -> close entry point */
|
||||
ihc_free, /* -> free cookie */
|
||||
ihc_control, /* -> control entry point */
|
||||
ihc_read, /* -> read entry point */
|
||||
ihc_write, /* -> write entry point */
|
||||
device_hooks ich_hooks = {
|
||||
ich_open, /* -> open entry point */
|
||||
ich_close, /* -> close entry point */
|
||||
ich_free, /* -> free cookie */
|
||||
ich_control, /* -> control entry point */
|
||||
ich_read, /* -> read entry point */
|
||||
ich_write, /* -> write entry point */
|
||||
NULL, /* start select */
|
||||
NULL, /* stop select */
|
||||
NULL, /* scatter-gather read from the device */
|
||||
@@ -722,7 +725,7 @@ device_hooks ihc_hooks = {
|
||||
const char**
|
||||
publish_devices()
|
||||
{
|
||||
return ihc_name;
|
||||
return ich_name;
|
||||
}
|
||||
|
||||
/* ----------
|
||||
@@ -733,5 +736,5 @@ publish_devices()
|
||||
device_hooks*
|
||||
find_device(const char* name)
|
||||
{
|
||||
return &ihc_hooks;
|
||||
return &ich_hooks;
|
||||
}
|
||||
|
||||
@@ -69,4 +69,6 @@ extern ich_chan * chan_pi;
|
||||
extern ich_chan * chan_po;
|
||||
extern ich_chan * chan_mc;
|
||||
|
||||
void start_chan(ich_chan *chan);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,19 @@
|
||||
#include "ich.h"
|
||||
#include "config.h"
|
||||
|
||||
status_t ich_codec_wait();
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
status_t ich_codec_wait(void);
|
||||
|
||||
uint8
|
||||
ich_reg_read_8(int regno)
|
||||
@@ -101,7 +113,7 @@ ich_reg_write_32(int regno, uint32 value)
|
||||
}
|
||||
|
||||
status_t
|
||||
ich_codec_wait()
|
||||
ich_codec_wait(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 1100; i++) {
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
|
||||
spinlock slock = 0;
|
||||
|
||||
cpu_status lock()
|
||||
uint32 round_to_pagesize(uint32 size);
|
||||
|
||||
cpu_status lock(void)
|
||||
{
|
||||
cpu_status status = disable_interrupts();
|
||||
acquire_spinlock(&slock);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
area_id alloc_mem(void **phy, void **log, size_t size, const char *name);
|
||||
|
||||
cpu_status lock();
|
||||
cpu_status lock(void);
|
||||
void unlock(cpu_status status);
|
||||
|
||||
extern spinlock slock;
|
||||
|
||||
Reference in New Issue
Block a user