hdsp patch, version II
A message that is not in the archive (sent off-list or not yet received): E18qYvo-0004Cp-00@dardilly
Quoted 9 lines · Paul Davis
Quoted 1 line
in short, i am confused :) :(
but ... help is at hand. i checked my mail archives:
Quoted 2 lines
The fifo status counts the number of words waiting in the FIFO. A value of 128 means that the fifo is full. 0 means the fifo is empty.
OK, so this means that
Quoted 9 lines
hdsp_fifo_wait (hdsp, 0, some_count);is waiting till the FIFO is empty. by contrast,
hdsp_fifo_wait (hdsp, 127, some_count);waits till there is 1 word available in the FIFO, meaning that we can write to it.
How is that we can write to it if it is full ?
In the case the above question is stupid, and the fifo being full meaning we can write to it, we have the following code in snd_hdsp_initialize_firmware anyway:
for (i = 0; i < 24413; ++i) {
hdsp_write(hdsp, HDSP_fifoData, firmware_ptr[i]);
if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) {
snd_printk ("timeout during firmware loading\n");
return -EIO;
}
}Here it seems we write before checking if we can. The bad news is I've just tested the other way round and it works no better.
Quoted 2 lines
this doesn't help explain why we sometimes fail to see this condition being met. any insights?
Is it really that the condition is not being met ?
It should gracefully fail. That's what timeouts are for. If the condition fails, then the driver should fail to instantiate, and the boot process should go on. The problem is that we have a freeze.
Thomas, searching in all directions...
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 4 lines
Quoted 4 lines
OK, so this means that
hdsp_fifo_wait (hdsp, 0, some_count);
Quoted 8 lines
Quoted 7 lines
is waiting till the FIFO is empty. by contrast,
hdsp_fifo_wait (hdsp, 127, some_count);waits till there is 1 word available in the FIFO, meaning that we can write to it.
How is that we can write to it if it is full ?
we never test for it being full. the tests are either for <= 0 (EMPTY) or <= 127 (at least 1 word available).
Quoted 11 lines
In the case the above question is stupid, and the fifo being full meaning we can write to it, we have the following code in
snd_hdsp_initialize_firmwareanyway:for (i = 0; i < 24413; ++i) { hdsp_write(hdsp, HDSP_fifoData, firmware_ptr[i]); if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { snd_printk ("timeout during firmware loading\n"); return -EIO; } }
yes, but before we enter that loop we checked to make sure that the FIFO was empty. so the loop is really writing a word, then waiting for a word to be available.
Quoted 7 lines
Quoted 2 lines
this doesn't help explain why we sometimes fail to see this condition being met. any insights?
Is it really that the condition is not being met ?
It should gracefully fail. That's what timeouts are for. If the condition fails, then the driver should fail to instantiate, and the boot process should go on. The problem is that we have a freeze.
i agree. i can't see why it doesn't, unless the LONG_WAIT delays us for so long that it looks like a freeze ...
--p
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
Quoted 2 lines · Paul Davis
i agree. i can't see why it doesn't, unless the
LONG_WAITdelays us for so long that it looks like a freeze ...
It doesn't, as after hitting the magic sysrq sigterm sequence I can see the hdsp_fifo_wait's snd_printks appear on a regular basis (looks like 120 bpm). This is not surprising as HDSP_LONG_WAIT is supposed to last 500ms. In fact the timeout should occur 24413/2/60 = circa 186 minutes later. The code is :
for (i = 0; i < 24413; ++i) {
hdsp_write(hdsp, HDSP_fifoData, firmware_ptr[i]);
if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) {
snd_printk ("timeout during firmware loading\n");
return -EIO;
}
}If hdsp_fifo_wait fails and returns -1 we go through the whole loop, thus effectively waiting almost 3 hours.
Thomas
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
Quoted 19 lines · Paul Davis
Quoted 3 lines
i agree. i can't see why it doesn't, unless the
LONG_WAITdelays us for so long that it looks like a freeze ...It doesn't, as after hitting the magic sysrq sigterm sequence I can see the hdsp_fifo_wait's
snd_printksappear on a regular basis (looks like 120 bpm). This is not surprising asHDSP_LONG_WAITis supposed to last 500ms. In fact the timeout should occur 24413/2/60 = circa 186 minutes later. The code is :for (i = 0; i < 24413; ++i) { hdsp_write(hdsp, HDSP_fifoData, firmware_ptr[i]); if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { snd_printk ("timeout during firmware loading\n"); return -EIO; } }
Quoted 2 lines
If
hdsp_fifo_waitfails and returns -1 we go through the whole loop, thus effectively waiting almost 3 hours.
eh? if it returns any non-zero value, we return from hdsp_initialize_firmware() with -EIO, surely?
--p
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
Quoted 3 lines · Paul Davis
eh? if it returns any non-zero value, we return from
hdsp_initialize_firmware()with-EIO, surely?
You're perfectly right, sorry, I've been mixing things up... :) I guess a reason for it was that getting all those snd_printks from hdsp_fifo_wait sounded like having hdsp_fifo_wait being called from a loop.
Do you have any clue I could work on ?
Thomas
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com