From 22e3407bda1bcc4ce0317b14cd75add80b3f41a4 Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Wed, 22 Jul 2015 09:27:12 +0100 Subject: [PATCH] usbdux: usbduxsigma: added soft interval mode in the firmware urb->interval is ignored in xhci drivers. Instead, the firmware has an interval counter and transmits data at this interval. The uframes in-between are zero length packets. In order to be backward compatible with older kernels which support only USB 2.0 and 1.1 there are two ADC modes in the firmware. The old one which assumes that the interval is established by the host (urb->interval) and the new one where the interval value is transmitted to the firmware. Signed-off-by: Bernd Porr Signed-off-by: Kyle McMartin --- usbdux/usbduxsigma_firmware.asm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/usbdux/usbduxsigma_firmware.asm b/usbdux/usbduxsigma_firmware.asm index 071d5d6b..90998a0b 100644 --- a/usbdux/usbduxsigma_firmware.asm +++ b/usbdux/usbduxsigma_firmware.asm @@ -39,6 +39,8 @@ .equ DPTRL,85H .equ DPTRH,86h .equ ASYNC_ON,87h + .equ INTERVAL,88h ; uframe/frame interval + .equ INTCTR,89h ; interval counter ;;; actual code .org 0000h ; after reset the processor starts here @@ -546,7 +548,18 @@ sof_isr: push 07h ; R7 clr IE.7 ; make sure that no other int's disturbe us + + mov r0,#INTCTR ; interval counter + mov a,@r0 ; get the value + dec a ; decrement + mov @r0,a ; save it again + jz sof_adc ; we do ADC functions + ljmp epfull ; we skip all adc functions +sof_adc: + mov r1,#INTERVAL ; get the interval + mov a,@r1 ; get it + mov @r0,a ; save it in the counter mov a,EP2468STAT anl a,#20H ; full? jnz epfull ; EP6-buffer is full @@ -762,6 +775,7 @@ ep1out_jmp: sjmp nothing ; a=6 sjmp pwm_on ; a=7 sjmp pwm_off ; a=8 + sjmp startadcint ; a=9 nothing: ljmp over_da @@ -790,12 +804,25 @@ initsgADchannel: sjmp over_da +startadcint: + mov dptr,#0e781h ; FIFO buffer of EP1OUT from 2nd byte + + movx a,@dptr ; interval is the 1st byte + inc dptr ; data pointer + sjmp startadc2 ; the other paramters as with startadc ;;; config AD: ;;; we write to the registers of the A/D converter startadc: mov dptr,#0e781h ; FIFO buffer of EP1OUT from 2nd byte + mov a,#1 ; interval is 1 here all the time +startadc2: + mov r0,#INTERVAL ; set it + mov @r0,a + mov r0,#INTCTR ; the counter is also just one + mov @r0,a + movx a,@dptr ; get length of channel list inc dptr mov r0,#MAXSMPL