mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
Cleanup for PR.
This commit is contained in:
parent
142871654e
commit
529622710c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -66,7 +66,7 @@ typedef struct
|
|||||||
|
|
||||||
#if CFG_TUD_AUDIO_EPSIZE_IN
|
#if CFG_TUD_AUDIO_EPSIZE_IN
|
||||||
uint8_t ep_in; // Outgoing (out of uC) audio data EP.
|
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)
|
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
|
#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.
|
// 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.
|
// 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
|
#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 = ep_addr;
|
||||||
_audiod_itf[idxDriver].ep_in_as_intf_num = itf;
|
_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 and trigger data generation - if not already running
|
||||||
// Invoke callback - fill something in the FIFO here for now
|
|
||||||
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
|
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;
|
uint16_t n_bytes_copied;
|
||||||
TU_VERIFY(audiod_tx_done_cb(rhport, &_audiod_itf[idxDriver], &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));
|
TU_VERIFY(audiod_tx_done_cb(rhport, &_audiod_itf[idxDriver], &n_bytes_copied));
|
||||||
|
|
||||||
// Transmission of ZLP is done by audiod_tx_done_cb()
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -690,43 +690,6 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
|||||||
return true;
|
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)
|
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);
|
uint8_t const epnum = tu_edpt_number(ep_addr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user