diff options
Diffstat (limited to 'src/stm/ao_usb_stm.c')
| -rw-r--r-- | src/stm/ao_usb_stm.c | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/src/stm/ao_usb_stm.c b/src/stm/ao_usb_stm.c index 595bddac..b06814d2 100644 --- a/src/stm/ao_usb_stm.c +++ b/src/stm/ao_usb_stm.c @@ -446,15 +446,11 @@ ao_usb_write_short(uint16_t data, uint32_t *base, uint16_t offset)  }  static void -ao_usb_write(const uint8_t *src, uint32_t *base, uint16_t offset, uint16_t bytes) +ao_usb_write(const uint8_t *src, uint32_t *base, uint16_t bytes)  { +	uint16_t offset = 0;  	if (!bytes)  		return; -	if (offset & 1) { -		debug_data (" %02x", src[0]); -		ao_usb_write_byte(*src++, base, offset++); -		bytes--; -	}  	while (bytes >= 2) {  		debug_data (" %02x %02x", src[0], src[1]);  		ao_usb_write_short((src[1] << 8) | src[0], base, offset); @@ -531,7 +527,7 @@ ao_usb_ep0_flush(void)  	ao_usb_ep0_in_len -= this_len;  	debug_data ("Flush EP0 len %d:", this_len); -	ao_usb_write(ao_usb_ep0_in_data, ao_usb_ep0_tx_buffer, 0, this_len); +	ao_usb_write(ao_usb_ep0_in_data, ao_usb_ep0_tx_buffer, this_len);  	debug_data ("\n");  	ao_usb_ep0_in_data += this_len; @@ -850,7 +846,7 @@ _ao_usb_in_send(void)  	ao_usb_in_pending = 1;  	if (ao_usb_tx_count != AO_USB_IN_SIZE)  		ao_usb_in_flushed = 1; -	ao_usb_write(ao_usb_tx_buffer, ao_usb_in_tx_buffer, 0, ao_usb_tx_count); +	ao_usb_write(ao_usb_tx_buffer, ao_usb_in_tx_buffer, ao_usb_tx_count);  	ao_usb_bdt[AO_USB_IN_EPR].single.count_tx = ao_usb_tx_count;  	ao_usb_tx_count = 0;  	_ao_usb_set_stat_tx(AO_USB_IN_EPR, STM_USB_EPR_STAT_TX_VALID); @@ -974,6 +970,11 @@ ao_usb_getchar(void)  	return c;  } +#ifndef HAS_USB_DISABLE +#define HAS_USB_DISABLE 1 +#endif + +#if HAS_USB_DISABLE  void  ao_usb_disable(void)  { @@ -991,6 +992,7 @@ ao_usb_disable(void)  	stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_USBEN);  	ao_arch_release_interrupts();  } +#endif  void  ao_usb_enable(void)  | 
