summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2020-09-28 18:10:57 +0200
committerReinhard Panhuber <[email protected]>2020-09-28 18:10:57 +0200
commit529622710ca6a234fa385402e4a298759a04ad72 (patch)
tree2cef503c43e68ea9a5eb6892fcbbffac49111bb1 /src
parent142871654e27e93688ce599643b506dab6530036 (diff)
Cleanup for PR.
Diffstat (limited to 'src')
-rw-r--r--src/class/audio/audio_device.c16
-rw-r--r--src/portable/st/synopsys/dcd_synopsys.c37
2 files changed, 5 insertions, 48 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index 1b9cfe13a..d208d1c84 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2020 Reinhard Panhuber
+ * Copyright (c) 2020 Reinhard Panhuber, Jerzy Kasenberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -66,7 +66,7 @@ typedef struct
#if CFG_TUD_AUDIO_EPSIZE_IN
uint8_t ep_in; // Outgoing (out of uC) audio data EP.
- uint16_t epin_buf_cnt; // Count filling status of EP in buffer
+ uint16_t epin_buf_cnt; // Count filling status of EP in buffer - this is a shared state currently and is intended to be removed once EP buffers can be implemented as FIFOs!
uint8_t ep_in_as_intf_num; // Corresponding Standard AS Interface Descriptor (4.9.1) belonging to output terminal to which this EP belongs - 0 is invalid (this fits to UAC2 specification since AS interfaces can not have interface number equal to zero)
#endif
@@ -468,7 +468,7 @@ uint32_t tud_audio_int_ctr_n_write(uint8_t itf, uint8_t const* buffer, uint32_t
// This function is called once a transmit of an audio packet was successfully completed. Here, we encode samples and place it in IN EP's buffer for next transmission.
-// If you prefer your own (more efficient) implementation suiting your purpose set CFG_TUD_AUDIO_TX_FIFO_SIZE = 0.
+// If you prefer your own (more efficient) implementation suiting your purpose set CFG_TUD_AUDIO_TX_FIFO_SIZE = 0 and use tud_audio_n_write_ep_in_buffer() (NOT IMPLEMENTED SO FAR).
// n_bytes_copied - Informs caller how many bytes were loaded. In case n_bytes_copied = 0, a ZLP is scheduled to inform host no data is available for current frame.
#if CFG_TUD_AUDIO_EPSIZE_IN
@@ -925,10 +925,10 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
_audiod_itf[idxDriver].ep_in = ep_addr;
_audiod_itf[idxDriver].ep_in_as_intf_num = itf;
- // HERE WE WOULD NEED TO SCHEDULE OUR FIRST TRANSMIT, HOWEVER, WE ALSO WOULD FIRST NEED TO ENABLE SAMPLING AT ALL - HOW TO HANDLE THIS?
- // Invoke callback - fill something in the FIFO here for now
+ // Invoke callback and trigger data generation - if not already running
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
+ // Schedule first transmit - in case no sample data is available a ZLP is loaded
uint16_t n_bytes_copied;
TU_VERIFY(audiod_tx_done_cb(rhport, &_audiod_itf[idxDriver], &n_bytes_copied));
}
@@ -1218,12 +1218,6 @@ bool audiod_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint3
TU_VERIFY(audiod_tx_done_cb(rhport, &_audiod_itf[idxDriver], &n_bytes_copied));
// Transmission of ZLP is done by audiod_tx_done_cb()
-// if (n_bytes_copied == 0)
-// {
-// // Load with ZLP
-// return usbd_edpt_xfer(rhport, ep_addr, NULL, 0);
-// }
-
return true;
}
#endif
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c
index 4c670515a..b3d82c3aa 100644
--- a/src/portable/st/synopsys/dcd_synopsys.c
+++ b/src/portable/st/synopsys/dcd_synopsys.c
@@ -690,43 +690,6 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
return true;
}
-///**
-// * Close an EP.
-// *
-// * Currently, we only deactivate the EPs and do not fully disable them - this might not be necessary!
-// *
-// */
-//void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr)
-//{
-// (void)rhport;
-// uint32_t const epnum = tu_edpt_number(ep_addr);
-// uint32_t const dir = tu_edpt_dir(ep_addr);
-//
-// USB_OTG_DeviceTypeDef * dev = DEVICE_BASE(rhport);
-//
-// if(dir == TUSB_DIR_IN)
-// {
-// USB_OTG_INEndpointTypeDef * in_ep = IN_EP_BASE(rhport);
-//
-// // Disable interrupt for this EP
-// dev->DAINTMSK &= ~(1 << (USB_OTG_DAINTMSK_IEPM_Pos + epnum));
-//
-// // Clear USB active EP
-// in_ep[epnum].DIEPCTL &= ~USB_OTG_DIEPCTL_USBAEP;
-// }
-// else
-// {
-// USB_OTG_OUTEndpointTypeDef * out_ep = OUT_EP_BASE(rhport);
-//
-// // Disable interrupt for this EP
-// dev->DAINTMSK &= ~(1 << (USB_OTG_DAINTMSK_OEPM_Pos + epnum));;
-//
-// // Clear USB active EP bit
-// out_ep[epnum].DOEPCTL &= ~USB_OTG_DOEPCTL_USBAEP;
-//
-// }
-//}
-
bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{
uint8_t const epnum = tu_edpt_number(ep_addr);