* Count samples, not bytes, stupid :P
* Don't try to bypass semaphore counting, it should just work(tm) * Minor cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21158 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ea69b502e1
commit
7c8482e991
@ -7,7 +7,6 @@ pci_module_info* pci;
|
||||
|
||||
const char** publish_devices(void); /* Just to silence compiler */
|
||||
|
||||
|
||||
status_t
|
||||
init_hardware(void)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef COMPILED_FOR_R5
|
||||
#ifdef COMPILE_FOR_R5
|
||||
#define DEVFS_PATH_FORMAT "audio/multi/hda/%lu"
|
||||
#include <multi_audio.h>
|
||||
#else
|
||||
|
@ -60,10 +60,8 @@ hda_stream_check_intr(hda_controller* ctrlr, hda_stream* s)
|
||||
uint8 sts = OREG8(ctrlr,s->off,STS);
|
||||
if (sts) {
|
||||
cpu_status status;
|
||||
int32 count;
|
||||
|
||||
OREG8(ctrlr,s->off,STS) = sts;
|
||||
|
||||
status = disable_interrupts();
|
||||
acquire_spinlock(&s->lock);
|
||||
|
||||
@ -74,8 +72,6 @@ hda_stream_check_intr(hda_controller* ctrlr, hda_stream* s)
|
||||
release_spinlock(&s->lock);
|
||||
restore_interrupts(status);
|
||||
|
||||
get_sem_count(s->buffer_ready_sem, &count);
|
||||
if (count <= 0)
|
||||
release_sem_etc(s->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
}
|
||||
@ -176,7 +172,7 @@ hda_stream_setup_buffers(hda_codec* codec, hda_stream* s, const char* desc)
|
||||
/* Setup BDL entries */
|
||||
for (idx=0; idx < s->num_buffers; idx++, bdl++) {
|
||||
bdl->address = buffer_pa + (idx*buffer_size);
|
||||
bdl->length = buffer_size;
|
||||
bdl->length = s->sample_size * s->num_channels * s->buffer_length;
|
||||
bdl->ioc = 1;
|
||||
}
|
||||
|
||||
@ -208,7 +204,7 @@ hda_stream_setup_buffers(hda_codec* codec, hda_stream* s, const char* desc)
|
||||
OREG32(codec->ctrlr,s->off,BDPL) = s->bdl_pa;
|
||||
OREG32(codec->ctrlr,s->off,BDPU) = 0;
|
||||
OREG16(codec->ctrlr,s->off,LVI) = s->num_buffers -1;
|
||||
OREG32(codec->ctrlr,s->off,CBL) = s->num_channels * s->num_buffers * s->sample_size;
|
||||
OREG32(codec->ctrlr,s->off,CBL) = s->num_channels * s->num_buffers;
|
||||
OREG8(codec->ctrlr,s->off,CTL0) = CTL0_IOCE | CTL0_FEIE | CTL0_DEIE;
|
||||
OREG8(codec->ctrlr,s->off,CTL2) = s->id << 4;
|
||||
|
||||
|
@ -216,9 +216,10 @@ buffer_exchange(hda_codec* codec, multi_buffer_info* data)
|
||||
hda_stream_start(codec->ctrlr, codec->playback_stream);
|
||||
|
||||
/* do playback */
|
||||
rc=acquire_sem_etc(codec->playback_stream->buffer_ready_sem, 1, B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000);
|
||||
rc=acquire_sem(codec->playback_stream->buffer_ready_sem);
|
||||
if (rc != B_OK) {
|
||||
dprintf("%s: Timeout waiting for playback buffer to finish!\n", __func__);
|
||||
dprintf("%s: Error waiting for playback buffer to finish (%s)!\n", __func__,
|
||||
strerror(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user