*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
static inline uint16_t *ao_usb_packet_buffer_addr(uint16_t sram_addr)
{
- return (uint16_t *) (stm_usb_sram + sram_addr);
+ return (uint16_t *) (void *) (stm_usb_sram + sram_addr);
}
static inline uint16_t ao_usb_packet_buffer_offset(uint16_t *addr)
#endif
}
+#if USB_STATUS
static uint16_t control_count;
static uint16_t int_count;
static uint16_t in_count;
static uint16_t out_count;
static uint16_t reset_count;
+#endif
/* The USB memory must be accessed in 16-bit units
*/
ao_usb_ep0_flush();
}
-static struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8};
+struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8};
#if AO_USB_DEVICE_ID_SERIAL
static uint8_t ao_usb_serial[2 + 48];
switch (ep) {
case 0:
+#if USB_STATUS
++control_count;
+#endif
if (ao_usb_epr_ctr_rx(epr)) {
if (ao_usb_epr_setup(epr))
ao_usb_ep0_receive |= AO_USB_EP0_GOT_SETUP;
ao_usb_ep0_handle(ao_usb_ep0_receive);
break;
case AO_USB_OUT_EPR:
+#if USB_STATUS
++out_count;
+#endif
if (ao_usb_epr_ctr_rx(epr)) {
_rx_dbg1("RX ISR", epr);
ao_usb_out_avail = 1;
}
break;
case AO_USB_IN_EPR:
+#if USB_STATUS
++in_count;
+#endif
_tx_dbg1("TX ISR", epr);
if (ao_usb_epr_ctr_tx(epr)) {
ao_usb_in_pending = 0;
break;
#endif
case AO_USB_INT_EPR:
+#if USB_STATUS
++int_count;
+#endif
if (ao_usb_epr_ctr_tx(epr))
_ao_usb_set_stat_tx(AO_USB_INT_EPR, STM_USB_EPR_STAT_TX_NAK);
break;
}
if (istr & (1 << STM_USB_ISTR_RESET)) {
+#if USB_STATUS
++reset_count;
+#endif
debug ("\treset\n");
ao_usb_set_ep0();
}
return buffer;
}
-void
-ao_usb_free(uint16_t *addr)
-{
- uint16_t offset = ao_usb_packet_buffer_offset(addr);
- if (offset < ao_usb_sram_addr)
- ao_usb_sram_addr = offset;
-}
-
void
ao_usb_write(uint16_t *buffer, uint16_t len)
{