MIDI on ice1724 - preliminary findings and questions
Hi,
I am trying to fix the ancient MIDI problem with ice1724 cards. I applied Takashi's patch from http://mailman.alsa-project.org/pipermail/alsa-devel/2007-April/000641.html and made some minor changes (MPU401_INFO_INPUT | MPU401_INFO_OUTPUT to mpu401_uart info_flags, added a few debugs for testing).
I can test only MIDI input using my MIDI keyboard, I have no MIDI output device available. The input works fine now, the output most probably too since the method snd_vt1724_mpu401_write gets called when transmitting some data with amidi.
But here is the problem I do not understand:
When no MIDI input/output is used, the interrupt handler snd_vt1724_interrupt gets called with interrupt status 0x10 which correctly refers to the audio data interrupt (VT1724_IRQ_MTPCM).
However, when MIDI input or output is used (opened) even for a short time after the module is loaded, any subsequent audio playback generates interrupt status of 0x30 which refers to VT1724_IRQ_MTPCM AND VT1724_IRQ_MPU_TX. I have no idea why VT1724_IRQ_MPU_TX gets generated.
The first run of the snd_vt1724_interrupt loop tries to handle the MPU TX status, calling uart_interrupt_tx in mpu401_uart.c:
if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) &&
test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) {
spin_lock_irqsave(&mpu->output_lock, flags);
snd_mpu401_uart_output_write(mpu);
spin_unlock_irqrestore(&mpu->output_lock, flags);
}However, since the MPU output is not open at this time (no MIDI is being transmitted), the call to snd_mpu401_uart_output_write is skipped. Even though I think the interrupt status should get cleared by
outb(status, ICEREG1724(ice, IRQSTAT))
the loop repeats with the MPU TX interrupt status enabled until the timeout check breaks the while loop, returning to the interrupt handler the next moment again.
Apr 19 22:20:47 nahore kernel: [ 2402.938245] uart interrupt: status 0x30 Apr 19 22:20:47 nahore kernel: [ 2402.938260] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938267] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938274] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938281] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938288] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938295] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938302] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938309] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938316] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938323] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938326] ice1724: Too long irq loop, status = 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961247] uart interrupt: status 0x30 Apr 19 22:20:47 nahore kernel: [ 2402.961278] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961285] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961292] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961299] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961306] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961313] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961320] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961327] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961334] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961341] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961344] ice1724: Too long irq loop, status = 0x20
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at 0xa0), the interrupt gets generated.
I am enclosing the testing patch producing the above given results.
Thanks a lot for any suggestion or help.
Regards,
Pavel.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 22 Apr 2008 22:23:55 +0200,
Quoted 8 lines · Pavel Hofman
Hi,
I am trying to fix the ancient MIDI problem with ice1724 cards. I applied Takashi's patch from
http://mailman.alsa-project.org/pipermail/alsa-devel/2007-April/000641.html
and made some minor changes (MPU401_INFO_INPUT|MPU401_INFO_OUTPUTtompu401_uartinfo_flags, added a few debugs for testing).
Thanks for tracking this bug!
Quoted 66 lines
I can test only MIDI input using my MIDI keyboard, I have no MIDI output device available. The input works fine now, the output most probably too since the method
snd_vt1724_mpu401_writegets called when transmitting some data with amidi.But here is the problem I do not understand:
When no MIDI input/output is used, the interrupt handler
snd_vt1724_interruptgets called with interrupt status0x10which correctly refers to the audio data interrupt (VT1724_IRQ_MTPCM).However, when MIDI input or output is used (opened) even for a short time after the module is loaded, any subsequent audio playback generates interrupt status of
0x30which refers toVT1724_IRQ_MTPCMANDVT1724_IRQ_MPU_TX. I have no idea whyVT1724_IRQ_MPU_TXgets generated.The first run of the
snd_vt1724_interruptloop tries to handle the MPU TX status, callinguart_interrupt_txinmpu401_uart.c:if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) && test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) { spin_lock_irqsave(&mpu->output_lock, flags); snd_mpu401_uart_output_write(mpu); spin_unlock_irqrestore(&mpu->output_lock, flags); }However, since the MPU output is not open at this time (no MIDI is being transmitted), the call to
snd_mpu401_uart_output_writeis skipped. Even though I think the interrupt status should get cleared by
outb(status, ICEREG1724(ice, IRQSTAT))the loop repeats with the MPU TX interrupt status enabled until the timeout check breaks the while loop, returning to the interrupt handler the next moment again.
Apr 19 22:20:47 nahore kernel: [ 2402.938245] uart interrupt: status 0x30 Apr 19 22:20:47 nahore kernel: [ 2402.938260] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938267] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938274] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938281] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938288] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938295] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938302] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938309] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938316] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938323] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.938326] ice1724: Too long irq loop, status = 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961247] uart interrupt: status 0x30 Apr 19 22:20:47 nahore kernel: [ 2402.961278] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961285] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961292] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961299] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961306] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961313] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961320] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961327] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961334] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961341] uart interrupt: status 0x20 Apr 19 22:20:47 nahore kernel: [ 2402.961344] ice1724: Too long irqloop, status =
0x20After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
Quoted 6 lines
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.
OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
thanks,
Takashi
---
drivers/mpu401/mpu401_uart.c +4 -6
@@ -49,12 +49,10 @@*/ -#define snd_mpu401_input_avail (mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x80)) -#define snd_mpu401_output_ready (mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x40)) - -#define MPU401_RESET 0xff -#define MPU401_ENTER_UART 0x3f -#define MPU401_ACK 0xfe +#define snd_mpu401_input_avail (mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_RX_EMPTY)) +#define snd_mpu401_output_ready (mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_TX_FULL))/* Build in lowlevel io */ static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data,
include/mpu401.h +15 -0
@@ -103,6 +103,21 @@#define MPU401D (mpu) (mpu)->port/* +* control register bits +*/ +/* read MPU401C() */ +#define MPU401_RX_EMPTY 0x80 +#define MPU401_TX_FULL 0x40 + +/* write MPU401C() */ +#define MPU401_RESET 0xff +#define MPU401_ENTER_UART 0x3f + +/* read MPU401D() */ +#define MPU401_ACK 0xfe + + +/* */
pci/ice1712/ice1724.c +81 -14
135 lines not on this page · raw message
pci/ice1712/prodigy192.c +0 -4
@@ -812,10 +812,6 @@ .build_controls = prodigy192_add_controls, .eeprom_size = sizeof(prodigy71_eeprom), .eeprom_data = prodigy71_eeprom, - /* the current MPU401 code loops infinitely - * when opening midi device - */ - .no_mpu401 = 1, }, { }/* terminator */ };
Quoted 4 lines · Takashi Iwai
At Tue, 22 Apr 2008 22:23:55 +0200,
Quoted 2 lines · Pavel Hofman
Hi,
...........
Quoted 7 lines
Quoted 7 lines
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Quoted 8 lines
Quoted 3 lines
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
Takashi, thanks for the hack idea. The overhead is just one more loop which is nothing. I will test it and post details of further problems (there is a bunch of them :) )
Pavel.
Re: MIDI on ice1724 - long delays
Quoted 10 lines · Pavel Hofman
Quoted 4 lines · Takashi Iwai
At Tue, 22 Apr 2008 22:23:55 +0200,
Quoted 2 lines · Pavel Hofman
Hi,
...........
Quoted 4 lines
Quoted 4 lines
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
Takashi, thanks for the hack idea. The overhead is just one more loop which is nothing. I will test it and post details of further problems (there is a bunch of them :) )
Hi,
The hack works fine, I am finally getting no CPU burning during playback and MIDI input/output.
Now the next problem are delays. amidi through ice1724 prints the rawmidi data a fraction of a second later compared to USB midi input. I guess there is not much we could do about it. The format is a bit different which probably does not matter:
pavel@nahore:~$ amidi -l Dir Device Name IO hw:0,0 Audiotrak Prodigy 192 MIDI IO hw:1,0,0 Keystation Pro 88 MIDI 1 I hw:1,0,1 Keystation Pro 88 MIDI 2
ice1724 midi:
pavel@nahore:~$ amidi -p hw:0 -d
90 2D 5E
2D 00
90 30 79
30 00
USB midi:
pavel@nahore:~$ amidi -p hw:1 -d
90 2D 4C
90 2D 00
90 30 5E
90 30 00
However, what makes a huge delay difference is the next step - aseqdump. Here USB still outputs data immediately:
pavel@nahore:~$ aseqdump -p 20:0 Waiting for data. Press Ctrl+C to end. Source_ Event_________________ Ch _Data__ 20:0 Note on 0 41 94 20:0 Note on 0 41 0 20:0 Note on 0 45 80 20:0 Note on 0 45 0
Whereas through ice1724 midi it takes several seconds for the same notes to appear in aseqdump:
pavel@nahore:~$ aseqdump -p 16:0 Waiting for data. Press Ctrl+C to end. Source_ Event_________________ Ch _Data__ 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Note on 0 43 86 16:0 Note on 0 43 0 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Note on 0 47 100 16:0 Note on 0 47 0 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing
Google told me the "Active Sensing" messages are OK. Still, the whole pack of lines appears at once, but with a huge delay.
When hooking Qsynth to the inputs, notes through USB sound immediately, Notes through ice1724 get delayed by several seconds, but mostly they produce no sound at all. Surprisingly, the few notes which actually make it through sound long (just like the piano sustain pedal). USB notes do not have this effect.
Please make respective fixes to the enclosed patch as it involves some changes that make the MPU401 actually work.
Thanks a lot for advice and suggestions.
Pavel.
drivers/mpu401/mpu401_uart.c +8 -10
@@ -49,12 +49,10 @@ static void snd_mpu401_uart_output_write*/ -#define snd_mpu401_input_avail (mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x80)) -#define snd_mpu401_output_ready (mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x40)) - -#define MPU401_RESET 0xff -#define MPU401_ENTER_UART 0x3f -#define MPU401_ACK 0xfe +#define snd_mpu401_input_avail (mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_RX_EMPTY)) +#define snd_mpu401_output_ready (mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_TX_FULL))/* Build in lowlevel io */ static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data,
@@ -245,7 +243,7 @@ static int snd_mpu401_uart_cmd(struct sn#endif } mpu->write (mpu, cmd,MPU401C (mpu)); -if (ack) { +if (ack && !(mpu->info_flags &MPU401_INFO_NO_ACK )) { ok =0 ; timeout =10000 ;while (!ok && timeout-- >0 ) {
@@ -427,15 +425,15 @@ static void snd_mpu401_uart_output_writeunsigned char byte;int max =256 ; - do { + do { if (snd_rawmidi_transmit_peek(mpu->substream_output, - &byte, 1) == 1) { + &byte, 1) == 1) { /* * Try twice because there is hardware that insists on * setting the output busy bit after each write. */ if (!snd_mpu401_output_ready(mpu) && - !snd_mpu401_output_ready(mpu)) + !snd_mpu401_output_ready(mpu)) break; /* Tx FIFO full - try again later */ mpu->write(mpu, byte, MPU401D(mpu)); snd_rawmidi_transmit_ack(mpu->substream_output, 1);
include/mpu401.h +16 -0
@@ -50,6 +50,7 @@#define MPU401_INFO_INTEGRATED (1 << 2)/* integrated h/w port */ #define MPU401_INFO_MMIO (1 << 3)/* MMIO access */ #define MPU401_INFO_TX_IRQ (1 << 4)/* independent TX irq */ +#define MPU401_INFO_NO_ACK (1 << 6)/* No ACK cmd needed */ #define MPU401_MODE_BIT_INPUT 0#define MPU401_MODE_BIT_OUTPUT 1
@@ -103,6 +104,21 @@ struct snd_mpu401 {#define MPU401D (mpu) (mpu)->port/* +* control register bits +*/ +/* read MPU401C() */ +#define MPU401_RX_EMPTY 0x80 +#define MPU401_TX_FULL 0x40 + +/* write MPU401C() */ +#define MPU401_RESET 0xff +#define MPU401_ENTER_UART 0x3f + +/* read MPU401D() */ +#define MPU401_ACK 0xfe + + +/* */
pci/ice1712/ice1724.c +88 -15
144 lines not on this page · raw message
pci/ice1712/prodigy192.c +1 -1
@@ -815,7 +815,7 @@ struct snd_ice1712_card_info snd_vt1724_/* the current MPU401 code loops infinitely * when opening midi device */ - .no_mpu401 = 1, + .no_mpu401 = 0, }, { }/* terminator */ };
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: MIDI on ice1724 - long delays
At Wed, 23 Apr 2008 22:19:04 +0200,
Quoted 27 lines · Pavel Hofman
Quoted 15 lines · Pavel Hofman
Quoted 4 lines · Takashi Iwai
At Tue, 22 Apr 2008 22:23:55 +0200,
Quoted 2 lines · Pavel Hofman
Hi,
...........
Quoted 9 lines
Quoted 9 lines
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.Quoted 9 lines
Quoted 4 lines
OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
Takashi, thanks for the hack idea. The overhead is just one more loop which is nothing. I will test it and post details of further problems (there is a bunch of them :) )
Quoted 4 lines
Hi,
The hack works fine, I am finally getting no CPU burning during playback and MIDI input/output.
Thanks for checking. The fixed patches are on HG tree now. Please sync your tree.
Quoted 73 lines
Now the next problem are delays. amidi through ice1724 prints the rawmidi data a fraction of a second later compared to USB midi input. I guess there is not much we could do about it. The format is a bit different which probably does not matter:
pavel@nahore:~$ amidi -l Dir Device Name IO hw:0,0 Audiotrak Prodigy 192 MIDI IO hw:1,0,0 Keystation Pro 88 MIDI 1 I hw:1,0,1 Keystation Pro 88 MIDI 2ice1724 midi:
pavel@nahore:~$ amidi -p hw:0 -d90 2D 5E
2D 00 90 30 79 30 00USB midi:
pavel@nahore:~$ amidi -p hw:1 -d90 2D 4C
90 2D 00
90 30 5E
90 30 00However, what makes a huge delay difference is the next step - aseqdump. Here USB still outputs data immediately:
pavel@nahore:~$ aseqdump -p 20:0 Waiting for data. Press Ctrl+C to end. Source_ Event_________________ Ch _Data__ 20:0 Note on 0 41 94 20:0 Note on 0 41 0 20:0 Note on 0 45 80 20:0 Note on 0 45 0Whereas through ice1724 midi it takes several seconds for the same notes to appear in aseqdump:
pavel@nahore:~$ aseqdump -p 16:0 Waiting for data. Press Ctrl+C to end. Source_ Event_________________ Ch _Data__ 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Note on 0 43 86 16:0 Note on 0 43 0 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Note on 0 47 100 16:0 Note on 0 47 0 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing 16:0 Active Sensing
Quoted 8 lines
Google told me the "Active Sensing" messages are OK. Still, the whole pack of lines appears at once, but with a huge delay.
When hooking Qsynth to the inputs, notes through USB sound immediately, Notes through ice1724 get delayed by several seconds, but mostly they produce no sound at all. Surprisingly, the few notes which actually make it through sound long (just like the piano sustain pedal). USB notes do not have this effect.
So, now it's a problem of MIDI "input", if I understand correctly? What we need to check at first is whether the MPU_RX irq is issued at the correct timing. If not, check whether MPU watermarks (MPU_FIFO_WM, CCS0E). According to the datasheet, the values are 0 for both RX and TX.
Takashi
Re: MIDI on ice1724 - long delays
Quoted 26 lines · Takashi Iwai
Quoted 25 lines · Pavel Hofman
Quoted 24 lines · Pavel Hofman
Quoted 3 lines · Takashi Iwai
Quoted 2 lines · Pavel Hofman
Hi,
...........
Quoted 8 lines
Quoted 8 lines
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Quoted 7 lines
Quoted 3 lines
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
Takashi, thanks for the hack idea. The overhead is just one more loop which is nothing. I will test it and post details of further problems (there is a bunch of them :) )
Quoted 7 lines
Quoted 4 lines
Hi,
The hack works fine, I am finally getting no CPU burning during playback and MIDI input/output.
Thanks for checking. The fixed patches are on HG tree now. Please sync your tree.
Takashi, the patch you put into HG was not the one I sent you, but sort of the original one that I said did not work.
pavel@nahore:~$ amidi -p hw:0 -d ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0 failed: Input/output error cannot open port "hw:0": Input/output error
amidi -p hw:0 -S
F0411042110C000000000074FF0411042110C000000000074F7F0411042110C000000000\
074F7F0411042110C0F0411042110C000000000074FF0411042110C000000000074F7F041\
1042110C000000000074F7F0411042110C0
ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0
failed: Input/output error
cannot open port "hw:0": Input/output error
I do not know the reason for MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.
Quoted 5 lines
Quoted 1 line
................
So, now it's a problem of MIDI "input", if I understand correctly? What we need to check at first is whether the
MPU_RXirq is issued at
the correct timing. If not, check whether MPU watermarks
(MPU_FIFO_WM, CCS0E). According to the datasheet, the values are 0 for both RX and TX.
MPU_RX irq did not get fired at all, even though the IRQ mask register CCS01 was 0x00, i.e. all interrupts enabled. I enabled the watermarks and that did the trick :) MPU_RX gets fired now, the delays are gone and Qsynth plays find with MIDI from USB or ice1724 input. It still feels as if midi from ice1724 has a little bit higher latency but I do not think we can do anything about it (plus it may just be my subjective feeling).
I am enclosing a patch to current HG which does not produce errors and puts HG to the functionality I have now. MIDI input works correctly. MIDI output is not physically tested, I only checked that snd_vt1724_mpu401_write gets called with reasonable data.
Thanks,
Pavel.
drivers/mpu401/mpu401_uart.c +1 -1
@@ -243,7 +243,7 @@ static int snd_mpu401_uart_cmd(struct sn#endif } mpu->write (mpu, cmd,MPU401C (mpu)); -if (ack) { +if (ack && !(mpu->info_flags &MPU401_INFO_NO_ACK )) { ok =0 ; timeout =10000 ;while (!ok && timeout-- >0 ) {
include/mpu401.h +1 -0
@@ -50,6 +50,7 @@#define MPU401_INFO_INTEGRATED (1 << 2)/* integrated h/w port */ #define MPU401_INFO_MMIO (1 << 3)/* MMIO access */ #define MPU401_INFO_TX_IRQ (1 << 4)/* independent TX irq */ +#define MPU401_INFO_NO_ACK (1 << 6)/* No ACK cmd needed */ #define MPU401_MODE_BIT_INPUT 0#define MPU401_MODE_BIT_OUTPUT 1
pci/ice1712/ice1724.c +4 -3
@@ -2429,7 +2429,10 @@ static int __devinit snd_vt1724_probe(stif ((err =snd_mpu401_uart_new (card,0 ,MPU401_HW_ICE1712 ,ICEREG1724 (ice,MPU_CTRL ), (MPU401_INFO_INTEGRATED | -MPU401_INFO_TX_IRQ ), +MPU401_INFO_NO_ACK | +MPU401_INFO_TX_IRQ | +MPU401_INFO_INPUT | +MPU401_INFO_OUTPUT ), ice->irq,0 , &ice->rmidi[0 ])) <0 ) {snd_card_free (card);
@@ -2442,12 +2445,10 @@ static int __devinit snd_vt1724_probe(stoutb (inb (ICEREG1724 (ice,IRQMASK )) & ~(VT1724_IRQ_MPU_RX |VT1724_IRQ_MPU_TX ),ICEREG1724 (ice,IRQMASK )); -#if 0 /* for testing */ /* set watermarks */ outb (VT1724_MPU_RX_FIFO |0x1 ,ICEREG1724 (ice,MPU_FIFO_WM ));outb (0x1 ,ICEREG1724 (ice,MPU_FIFO_WM )); -#endif } }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: MIDI on ice1724 - long delays
At Thu, 24 Apr 2008 22:47:54 +0200,
Quoted 52 lines · Pavel Hofman
Quoted 26 lines · Takashi Iwai
Quoted 25 lines · Pavel Hofman
Quoted 24 lines · Pavel Hofman
Quoted 3 lines · Takashi Iwai
Quoted 2 lines · Pavel Hofman
Hi,
...........
Quoted 8 lines
Quoted 8 lines
After the playback stops, the interrupts are gone too. It seems as if the playback interrupt initiates the MPU TX interrupt.
If we could avoid generating the MPU TX interrupt during regular playback, I believe the major problem would be resolved.
Quoted 7 lines
Quoted 3 lines
Even if I mask the interrupts (CCS01) and do not explicitly unmask them (according to proc ice1724 the CCS01 register stays at
0xa0), the interrupt gets generated.OK, then the simplest way would be to just ignore the TX bit at the second or later check.
How about the patch below?
Takashi, thanks for the hack idea. The overhead is just one more loop which is nothing. I will test it and post details of further problems (there is a bunch of them :) )
Quoted 7 lines
Quoted 4 lines
Hi,
The hack works fine, I am finally getting no CPU burning during playback and MIDI input/output.
Thanks for checking. The fixed patches are on HG tree now. Please sync your tree.
Takashi, the patch you put into HG was not the one I sent you, but sort of the original one that I said did not work.
pavel@nahore:~$ amidi -p hw:0 -d ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0 failed: Input/output error cannot open port "hw:0": Input/output erroramidi -p hw:0 -S
F0411042110C000000000074FF0411042110C000000000074F7F0411042110C000000000\
074F7F0411042110C0F0411042110C000000000074FF0411042110C000000000074F7F041\
1042110C000000000074F7F0411042110C0
ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open/dev/snd/midiC0D0
failed: Input/output error
cannot open port "hw:0": Input/output error
Quoted 2 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.
Ah, thanks, I overlooked it.
Fixed now.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
................
So, now it's a problem of MIDI "input", if I understand correctly? What we need to check at first is whether the
MPU_RXirq is issued at
the correct timing. If not, check whether MPU watermarks
(MPU_FIFO_WM, CCS0E). According to the datasheet, the values are 0 for both RX and TX.
Quoted 4 lines
MPU_RXirq did not get fired at all, even though the IRQ mask register CCS01 was0x00, i.e. all interrupts enabled. I enabled the watermarks and that did the trick :)MPU_RXgets fired now, the delays are gone and Qsynth plays find with MIDI from USB or ice1724 input.
Great, fixed on HG as well.
Quoted 3 lines
It still feels as
if midi from ice1724 has a little bit higher latency but I do not think we can do anything about it (plus it may just be my subjective feeling).
This might be the difference between the transport ways. USB can be faster.
Quoted 4 lines
I am enclosing a patch to current HG which does not produce errors and puts HG to the functionality I have now. MIDI input works correctly. MIDI output is not physically tested, I only checked that
snd_vt1724_mpu401_writegets called with reasonable data.
That should be enough. Thanks for your testing!
Takashi
Re: MIDI on ice1724 - fixing HG
Quoted 6 lines · Takashi Iwai
Quoted 3 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.Ah, thanks, I overlooked it.
Fixed now.
Takashi, thanks, but the patch I sent you sets MPU401_INFO_INPUT and MPU401_INFO_OUTPUT flags too. They enable the actual input/output methods in mpu401_uart.c.
Thanks a lot for fixing.
Pavel.
Re: MIDI on ice1724 - fixing HG
At Fri, 25 Apr 2008 09:06:19 +0200,
Quoted 6 lines · Pavel Hofman
Quoted 4 lines · Takashi Iwai
Quoted 3 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.
Quoted 6 lines
Quoted 2 lines
Ah, thanks, I overlooked it.
Fixed now.Takashi, thanks, but the patch I sent you sets
MPU401_INFO_INPUTandMPU401_INFO_OUTPUTflags too. They enable the actual input/output methods inmpu401_uart.c.
They aren't needed if you create full-duplex streams. Could you check whether the latest code still causes any errors?
thanks,
Takashi
Re: MIDI on ice1724 - fixing HG
Quoted 5 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Quoted 3 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
Quoted 2 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Ah, thanks, I overlooked it.
Fixed now.Takashi, thanks, but the patch I sent you sets
MPU401_INFO_INPUTandMPU401_INFO_OUTPUTflags too. They enable the actual input/output methods inmpu401_uart.c.They aren't needed if you create full-duplex streams. Could you check whether the latest code still causes any errors?
Oh, I overlooked the code
if (! (info_flags & (MPU401_INFO_INPUT | MPU401_INFO_OUTPUT))) info_flags |= MPU401_INFO_INPUT | MPU401_INFO_OUTPUT;
in snd_mpu401_uart_new.
So it should be OK. I will test and report errors, but I don't expect any :)
Thanks,
Pavel.
Re: MIDI on ice1724 - real-time kernel problem
In reply to Takashi IwaiQuoted 5 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Quoted 3 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
Quoted 2 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Ah, thanks, I overlooked it.
Fixed now.Takashi, thanks, but the patch I sent you sets
MPU401_INFO_INPUTandMPU401_INFO_OUTPUTflags too. They enable the actual input/output methods inmpu401_uart.c.They aren't needed if you create full-duplex streams. Could you check whether the latest code still causes any errors?
The code works fine on standard kernel.
But in the RT kernel of Ubuntu 7.10 (2.6.22-14-rt, 1000HZ compared to 250HZ of the -generic kernel), MIDI interrupts get thrown continuously, hogging CPU with the IRQXX "process".
When playing 44.1kHz audio with buffer size of 32768, snd_vt1724_interrupt is called every 185ms. With the buffer size of 4096, it is every 23ms. So far so good.
But when I try to output some midi, the routine gets called every 24us (i.e. 1000 times faster). Comparing the time difference between my several debug printk's in snd_vt1724_interrupt (approx. 5us between each printk record a few lines of code apart) and between each call of the method (24us), I thought there would be a loop somewhere in the interrupt handler calling code. But /proc/interrupts really shows over 40k interrupts a second for ICE1724.
Changing the watermarks up to 0x1f makes no difference.
Masking the MIDI interrupts works, snd_vt1724_interrupt is called only during VT1724_IRQ_MTPCM interrupts, with the MIDI status bits MPU_TX/MPU_RX set when reading/writing with amidi.
My HW: ancient AMD Duron 900MHz.
The interrupt flood occurs no matter whether the MIDI input is connected to my MIDI keyboard or not.
Thanks a lot to anyone for suggestions.
Pavel.
Re: MIDI on ice1724 - real-time kernel problem
At Wed, 30 Apr 2008 22:07:42 +0200,
Quoted 34 lines · Pavel Hofman
Quoted 5 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Quoted 3 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
Quoted 2 lines
I do not know the reason for
MPU401_INFO_NO_ACK. You removed it from the original patch, but without it I always get the input/output error.Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Ah, thanks, I overlooked it.
Fixed now.Takashi, thanks, but the patch I sent you sets
MPU401_INFO_INPUTandMPU401_INFO_OUTPUTflags too. They enable the actual input/output methods inmpu401_uart.c.They aren't needed if you create full-duplex streams. Could you check whether the latest code still causes any errors?
The code works fine on standard kernel.
But in the RT kernel of Ubuntu 7.10 (2.6.22-14-rt, 1000HZ compared to 250HZ of the -generic kernel), MIDI interrupts get thrown continuously, hogging CPU with the IRQXX "process".
When playing 44.1kHz audio with buffer size of 32768,
snd_vt1724_interruptis called every 185ms. With the buffer size of 4096, it is every 23ms. So far so good.But when I try to output some midi, the routine gets called every 24us (i.e. 1000 times faster). Comparing the time difference between my several debug printk's in
snd_vt1724_interrupt(approx. 5us between each printk record a few lines of code apart) and between each call of the method (24us), I thought there would be a loop somewhere in the interrupt handler calling code. But/proc/interruptsreally shows over 40k interrupts a second for ICE1724.
Quoted 1 line
Changing the watermarks up to
0x1fmakes no difference.
That looks bad.
Quoted 3 lines
Masking the MIDI interrupts works,
snd_vt1724_interruptis called only duringVT1724_IRQ_MTPCMinterrupts, with the MIDI status bits MPU_TX/MPU_RX set when reading/writing with amidi.
Hm, is it TX or RX, or in both cases?
Could you check which one (TX or RX) causes this?
Takashi
Quoted 12 lines
My HW: ancient AMD Duron 900MHz.
The interrupt flood occurs no matter whether the MIDI input is connected to my MIDI keyboard or not.
Thanks a lot to anyone for suggestions.
Pavel.
Re: MIDI on ice1724 - real-time kernel problem
Quoted 25 lines · Takashi Iwai
At Wed, 30 Apr 2008 22:07:42 +0200,
Quoted 21 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Pavel Hofman wrote:The code works fine on standard kernel.
But in the RT kernel of Ubuntu 7.10 (2.6.22-14-rt, 1000HZ compared to 250HZ of the -generic kernel), MIDI interrupts get thrown continuously, hogging CPU with the IRQXX "process".
When playing 44.1kHz audio with buffer size of 32768,
snd_vt1724_interruptis called every 185ms. With the buffer size of 4096, it is every 23ms. So far so good.But when I try to output some midi, the routine gets called every 24us (i.e. 1000 times faster). Comparing the time difference between my several debug printk's in
snd_vt1724_interrupt(approx. 5us between each printk record a few lines of code apart) and between each call of the method (24us), I thought there would be a loop somewhere in the interrupt handler calling code. But/proc/interruptsreally shows over 40k interrupts a second for ICE1724.Quoted 1 line
Changing the watermarks up to
0x1fmakes no difference.
Quoted 9 lines
That looks bad.
Quoted 3 lines
Masking the MIDI interrupts works,
snd_vt1724_interruptis called only duringVT1724_IRQ_MTPCMinterrupts, with the MIDI status bits MPU_TX/MPU_RX set when reading/writing with amidi.Hm, is it TX or RX, or in both cases?
Could you check which one (TX or RX) causes this?
Both reading (amidi -p hw:0 -d) and writing (amidi -p hw:0 -S F0411042110C000000000074FF0411042110C000000) starts the TX interrupt flood (irq status: 0x20) immediately. Upon opening input as well as output the method snd_mpu401_do_reset is called - is perhaps the culprit somewhere there?
Thanks,
Pavel.
Re: MIDI on ice1724 - real-time kernel problem
At Sat, 03 May 2008 21:12:02 +0200,
Quoted 39 lines · Pavel Hofman
Quoted 25 lines · Takashi Iwai
At Wed, 30 Apr 2008 22:07:42 +0200,
Quoted 21 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Pavel Hofman wrote:The code works fine on standard kernel.
But in the RT kernel of Ubuntu 7.10 (2.6.22-14-rt, 1000HZ compared to 250HZ of the -generic kernel), MIDI interrupts get thrown continuously, hogging CPU with the IRQXX "process".
When playing 44.1kHz audio with buffer size of 32768,
snd_vt1724_interruptis called every 185ms. With the buffer size of 4096, it is every 23ms. So far so good.But when I try to output some midi, the routine gets called every 24us (i.e. 1000 times faster). Comparing the time difference between my several debug printk's in
snd_vt1724_interrupt(approx. 5us between each printk record a few lines of code apart) and between each call of the method (24us), I thought there would be a loop somewhere in the interrupt handler calling code. But/proc/interruptsreally shows over 40k interrupts a second for ICE1724.Quoted 1 line
Changing the watermarks up to
0x1fmakes no difference.Quoted 9 lines
That looks bad.
Quoted 3 lines
Masking the MIDI interrupts works,
snd_vt1724_interruptis called only duringVT1724_IRQ_MTPCMinterrupts, with the MIDI status bits MPU_TX/MPU_RX set when reading/writing with amidi.Hm, is it TX or RX, or in both cases?
Could you check which one (TX or RX) causes this?
Quoted 5 lines
Both reading (amidi -p hw:0 -d) and writing (amidi -p hw:0 -S F0411042110C000000000074FF0411042110C000000) starts the TX interrupt flood (irq status:
0x20) immediately. Upon opening input as well as output the methodsnd_mpu401_do_resetis called - is perhaps the culprit somewhere there?
Possibly. It write 0x00 to data at the beginning in snd_mpu401_uart_cmd(). What happens if you remove it?
Takashi
Re: MIDI on ice1724 - real-time kernel problem
Quoted 37 lines · Takashi Iwai
At Sat, 03 May 2008 21:12:02 +0200,
Quoted 35 lines · Pavel Hofman
Quoted 32 lines · Takashi Iwai
At Wed, 30 Apr 2008 22:07:42 +0200,
Quoted 21 lines · Pavel Hofman
Quoted 2 lines · Takashi Iwai
At Fri, 25 Apr 2008 09:06:19 +0200,
Pavel Hofman wrote:The code works fine on standard kernel.
But in the RT kernel of Ubuntu 7.10 (2.6.22-14-rt, 1000HZ compared to 250HZ of the -generic kernel), MIDI interrupts get thrown continuously, hogging CPU with the IRQXX "process".
When playing 44.1kHz audio with buffer size of 32768,
snd_vt1724_interruptis called every 185ms. With the buffer size of 4096, it is every 23ms. So far so good.But when I try to output some midi, the routine gets called every 24us (i.e. 1000 times faster). Comparing the time difference between my several debug printk's in
snd_vt1724_interrupt(approx. 5us between each printk record a few lines of code apart) and between each call of the method (24us), I thought there would be a loop somewhere in the interrupt handler calling code. But/proc/interruptsreally shows over 40k interrupts a second for ICE1724.Quoted 1 line
Changing the watermarks up to
0x1fmakes no difference.That looks bad.
Quoted 3 lines
Masking the MIDI interrupts works,
snd_vt1724_interruptis called only duringVT1724_IRQ_MTPCMinterrupts, with the MIDI status bits MPU_TX/MPU_RX set when reading/writing with amidi.Hm, is it TX or RX, or in both cases?
Could you check which one (TX or RX) causes this?
Quoted 9 lines
Quoted 5 lines
Both reading (amidi -p hw:0 -d) and writing (amidi -p hw:0 -S F0411042110C000000000074FF0411042110C000000) starts the TX interrupt flood (irq status:
0x20) immediately. Upon opening input as well as output the methodsnd_mpu401_do_resetis called - is perhaps the culprit somewhere there?Possibly. It write
0x00to data at the beginning insnd_mpu401_uart_cmd(). What happens if you remove it?
Unfortunately nothing, no change.
Actually, when does the MPU_TX interrupt get thrown? Upon exhausting some output buffer? I understand interrupts for DMA, but mpu uart does not use DMA, right?
Thanks a lot for help, I am not giving up :)
Pavel.
Re: MIDI on ice1724 - real-time kernel problem
Quoted 2 lines · Pavel Hofman
Actually, when does the
MPU_TXinterrupt get thrown? Upon exhausting some output buffer?
According to the datasheet, when the number of bytes in the TX FIFO goes below the watermark value (for some unspecified value of "below").
Is there a reason why the watermarks are set to 1 and not to 0?
Anyway, this hardware is not compatible with the MPU-401, so we should not try to twist the MPU-401 code into working with it. Please try the patch below (not tested, I don't have the hardware).
alsa-kernel/pci/Kconfig +1 -1
@@ -695,7 +695,7 @@ config SND_ICE1712 config SND_ICE1724 tristate "ICE/VT1724/1720 (Envy24HT/PT)" depends on SND - select SND_MPU401_UART + select SND_RAWMIDI select SND_AC97_CODEC select SND_VMASTER help
alsa-kernel/pci/ice1712/ice1712.h +2 -0
@@ -333,6 +333,8 @@ struct snd_ice1712 { unsigned int has_spdif: 1; /* VT1720/4 - has SPDIF I/O */ unsigned int force_pdma4: 1; /* VT1720/4 - PDMA4 as non-spdif */ unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */ + unsigned int midi_output: 1; /* VT1720/4: MIDI output triggered */ + unsigned int midi_input: 1; /* VT1720/4: MIDI input triggered */unsigned int num_total_dacs;/* total DACs */ unsigned int num_total_adcs;/* total ADCs */ unsigned int cur_rate;/* current rate */
alsa-kernel/pci/ice1712/envy24ht.h +7 -3
@@ -93,9 +93,13 @@ enum {#define VT1724_REG_MPU_TXFIFO 0x0a/*byte ro. number of bytes in TX fifo*/ #define VT1724_REG_MPU_RXFIFO 0x0b/*byte ro. number of bytes in RX fifo*/ -//are these 2 the wrong way around? they don't seem to be used yet anyway -#define VT1724_REG_MPU_CTRL 0x0c/* byte */ -#define VT1724_REG_MPU_DATA 0x0d/* byte */ +#define VT1724_REG_MPU_DATA 0x0c/* byte */ +#define VT1724_REG_MPU_CTRL 0x0d/* byte */ +#define VT1724_MPU_UART 0x01 +#define VT1724_MPU_TX_EMPTY 0x02 +#define VT1724_MPU_TX_FULL 0x04 +#define VT1724_MPU_RX_EMPTY 0x08 +#define VT1724_MPU_RX_FULL 0x10#define VT1724_REG_MPU_FIFO_WM 0x0e/*byte set the high/low watermarks for RX/TX fifos*/ #define VT1724_MPU_RX_FIFO 0x20 //1=rx fifo watermark 0=tx fifo watermark
alsa-kernel/pci/ice1712/ice1724.c +168 -46
258 lines not on this page · raw message
Re: MIDI on ice1724 - real-time kernel problem
At Thu, 15 May 2008 09:21:02 +0200,
Quoted 9 lines · Clemens Ladisch
Quoted 2 lines · Pavel Hofman
Actually, when does the
MPU_TXinterrupt get thrown? Upon exhausting some output buffer?According to the datasheet, when the number of bytes in the TX FIFO goes below the watermark value (for some unspecified value of "below").
Is there a reason why the watermarks are set to 1 and not to 0?
We got TX IRQ storm when it was 0, according to Pavel.
Quoted 2 lines
Anyway, this hardware is not compatible with the MPU-401, so we should not try to twist the MPU-401 code into working with it.
Agreed. I thought it's enough similar to the real MPU401, but it's getting nastier.
thanks,
Takashi
Re: PATCH - MIDI on ice1724 - real-time kernel problem SOLVED
In reply to Clemens LadischQuoted 7 lines · Clemens Ladisch
Quoted 2 lines · Pavel Hofman
Actually, when does the
MPU_TXinterrupt get thrown? Upon exhausting some output buffer?According to the datasheet, when the number of bytes in the TX FIFO goes below the watermark value (for some unspecified value of "below").
Quoted 7 lines
Is there a reason why the watermarks are set to 1 and not to 0?
Anyway, this hardware is not compatible with the MPU-401, so we should not try to twist the MPU-401 code into working with it. Please try the patch below (not tested, I don't have the hardware).
Clemens,
Thanks a lot. After a few pointer fixes to make it compile your code works flawlessly for both the generic as well as realtime ubuntu kernel.
I am enclosing the functioning patch.
Now I cannot feel any delay difference between usb and ice1724 midi inputs. Well done, gentlemen, thank you all.
Regards,
Pavel Hofman.
pci/Kconfig +1 -1
@@ -695,7 +695,7 @@ config SND_ICE1724 config SND_ICE1724 tristate "ICE/VT1724/1720 (Envy24HT/PT)" depends on SND - select SND_MPU401_UART + select SND_RAWMIDI select SND_AC97_CODEC select SND_VMASTER help
pci/ice1712/envy24ht.h +7 -3
@@ -93,9 +93,13 @@ enum {#define VT1724_REG_MPU_TXFIFO 0x0a/*byte ro. number of bytes in TX fifo*/ #define VT1724_REG_MPU_RXFIFO 0x0b/*byte ro. number of bytes in RX fifo*/ -//are these 2 the wrong way around? they don't seem to be used yet anyway -#define VT1724_REG_MPU_CTRL 0x0c/* byte */ -#define VT1724_REG_MPU_DATA 0x0d/* byte */ +#define VT1724_REG_MPU_DATA 0x0c/* byte */ +#define VT1724_REG_MPU_CTRL 0x0d/* byte */ +#define VT1724_MPU_UART 0x01 +#define VT1724_MPU_TX_EMPTY 0x02 +#define VT1724_MPU_TX_FULL 0x04 +#define VT1724_MPU_RX_EMPTY 0x08 +#define VT1724_MPU_RX_FULL 0x10#define VT1724_REG_MPU_FIFO_WM 0x0e/*byte set the high/low watermarks for RX/TX fifos*/ #define VT1724_MPU_RX_FIFO 0x20 //1=rx fifo watermark 0=tx fifo watermark
pci/ice1712/ice1712.h +2 -0
@@ -333,6 +333,8 @@ struct snd_ice1712 { unsigned int has_spdif: 1; /* VT1720/4 - has SPDIF I/O */ unsigned int force_pdma4: 1; /* VT1720/4 - PDMA4 as non-spdif */ unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */ + unsigned int midi_output: 1; /* VT1720/4: MIDI output triggered */ + unsigned int midi_input: 1; /* VT1720/4: MIDI input triggered */unsigned int num_total_dacs;/* total DACs */ unsigned int num_total_adcs;/* total ADCs */ unsigned int cur_rate;/* current rate */
pci/ice1712/ice1724.c +171 -51
261 lines not on this page · raw message
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: PATCH - MIDI on ice1724 - real-time kernel problem SOLVED
Quoted 2 lines · Pavel Hofman
Thanks a lot. After a few pointer fixes to make it compile your code works flawlessly for both the generic as well as realtime ubuntu kernel.
Does it also work if you set the watermarks to 0?
Regards,
Clemens
Re: PATCH - MIDI on ice1724 - real-time kernel problem SOLVED
Quoted 5 lines · Clemens Ladisch
Quoted 2 lines · Pavel Hofman
Thanks a lot. After a few pointer fixes to make it compile your code works flawlessly for both the generic as well as realtime ubuntu kernel.
Does it also work if you set the watermarks to 0?
Test results for rt kernel - watermarks set to 0 bring the IRQ flood when the MIDI device is opened ( amidi -p hw:0 -d).
I am fine with the current setting - no floods, latency comparable to USB.
Regards,
Pavel.