git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8664 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
Giovanni Di Sirio 2015-12-31 15:54:56 +00:00
parent 1671d6b7e1
commit d832e5d173
2 changed files with 0 additions and 118 deletions

View File

@ -493,17 +493,6 @@ void usb_lld_start(USBDriver *usbp) {
/* Reset procedure enforced on driver start.*/
_usb_reset(usbp);
}
#if STM32_USB_USE_PUMP_THREAD && defined(_CHIBIOS_RT_)
/* Creates the data pump thread. Note, it is created only once.*/
if (usbp->tr == NULL) {
usbp->tr = chThdCreateI(usbp->wa_pump, sizeof usbp->wa_pump,
STM32_USB_PUMP_THREAD_PRIO,
usb_lld_pump, usbp);
chThdStartI(usbp->tr);
chSchRescheduleS();
}
#endif
}
/**
@ -869,65 +858,6 @@ void usb_lld_clear_in(USBDriver *usbp, usbep_t ep) {
EPR_SET_STAT_TX(ep, EPR_STAT_TX_NAK);
}
#if STM32_USB_USE_PUMP_THREAD || defined(__DOXYGEN__)
/**
* @brief USB data transfer loop.
* @details This function must be executed by a system thread in order to
* make the USB driver work.
* @note The data copy part of the driver is implemented in this thread
* in order to not perform heavy tasks within interrupt handlers.
*
* @param[in] p pointer to the @p USBDriver object
*
* @special
*/
void usb_lld_pump(void *p) {
USBDriver *usbp = (USBDriver *)p;
#if defined(_CHIBIOS_RT_)
chRegSetThreadName("usb_lld_pump");
#endif
while (true) {
usbep_t ep;
/* Checking if to go to sleep.*/
osalSysLock();
if ((usbp->state == USB_STOP) && (usbp->pending == 0U)) {
osalThreadSuspendS(&usbp->wait);
}
osalSysUnlock();
/* Scanning endpoints.*/
for (ep = 0; ep <= USB_ENDOPOINTS_NUMBER; ep++) {
uint32_t epmask;
/* Checking of active endpoints.*/
const USBEndpointConfig *epcp = usbp->epc[ep];
if (epcp != NULL) {
if (epcp->in_state != NULL) {
epmask = (1U << 16U) << ep;
if ((usbp->pending & epmask) != 0U) {
/* Handling transfer of this IN endpoint.*/
osalSysLock();
usbp->pending &= ~epmask;
osalSysUnlock();
}
epmask = 1U << ep;
if ((usbp->pending & epmask) != 0U) {
/* Handling transfer of this OUT endpoint.*/
osalSysLock();
usbp->pending &= ~epmask;
osalSysUnlock();
}
}
}
}
}
}
#endif /* STM32_USB_USE_PUMP_THREAD */
#endif /* HAL_USE_USB */
/** @} */

View File

@ -105,30 +105,6 @@
#define STM32_USB_USE_FAST_COPY FALSE
#endif
/**
* @brief Enables the use of a thread for data moving.
* @details This option improves IRQ handling by performing data moving
* from a dedicated internal thread at the cost of increased
* footprint.
*/
#if !defined(STM32_USB_USE_PUMP_THREAD) || defined(__DOXYGEN__)
#define STM32_USB_USE_PUMP_THREAD FALSE
#endif
/**
* @brief Dedicated data pump threads priority.
*/
#if !defined(STM32_USB_PUMP_THREAD_PRIO) || defined(__DOXYGEN__)
#define STM32_USB_PUMP_THREAD_PRIO LOWPRIO
#endif
/**
* @brief Dedicated data pump threads stack size.
*/
#if !defined(STM32_USB_PUMP_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
#define STM32_USB_PUMP_THREAD_STACK_SIZE 128
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@ -405,27 +381,6 @@ struct USBDriver {
* @brief Pointer to the next address in the packet memory.
*/
uint32_t pmnext;
#if STM32_USB_USE_PUMP_THREAD || defined(__DOXYGEN__)
/**
* @brief Mask of endpoints to be served by the pump thread.
* @note 0..15 for OUT endpoints, 16..31 for IN endpoints.
*/
uint32_t pending;
/**
* @brief Pointer to the thread when it is sleeping or @p NULL.
*/
thread_reference_t wait;
#if defined(_CHIBIOS_RT_) || defined(__DOXYGEN__)
/**
* @brief Pointer to the thread once created.
*/
thread_reference_t tr;
/**
* @brief Working area for the dedicated data pump thread;
*/
THD_WORKING_AREA(wa_pump, STM32_USB_PUMP_THREAD_STACK_SIZE);
#endif /* _CHIBIOS_RT_ */
#endif /* STM32_USB_USE_PUMP_THREAD */
};
/*===========================================================================*/
@ -516,9 +471,6 @@ extern "C" {
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep);
#if STM32_USB_USE_PUMP_THREAD
void usb_lld_pump(void *p);
#endif
#ifdef __cplusplus
}
#endif