aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-12 11:54:15 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-12 11:54:15 +0000
commitd749ecc10a40b21a22b3e7ab14ff9861fabe4685 (patch)
tree330febe05c9be6fc7821bcbcd03488554227a208 /os/hal/platforms
parent2f003bd7214c54560500b281661281a5c6903cee (diff)
downloadChibiOS-d749ecc10a40b21a22b3e7ab14ff9861fabe4685.tar.gz
ChibiOS-d749ecc10a40b21a22b3e7ab14ff9861fabe4685.tar.bz2
ChibiOS-d749ecc10a40b21a22b3e7ab14ff9861fabe4685.zip
RAM optimization to the USB driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2732 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/STM32/usb_lld.c10
-rw-r--r--os/hal/platforms/STM32/usb_lld.h17
2 files changed, 13 insertions, 14 deletions
diff --git a/os/hal/platforms/STM32/usb_lld.c b/os/hal/platforms/STM32/usb_lld.c
index fa78879c6..b0d356bcb 100644
--- a/os/hal/platforms/STM32/usb_lld.c
+++ b/os/hal/platforms/STM32/usb_lld.c
@@ -181,7 +181,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) {
EPR_CLEAR_CTR_TX(ep);
if (epcp->flags & USB_EP_FLAGS_IN_PACKET_MODE) {
/* Packet mode, just invokes the callback.*/
- (usbp)->ep[ep]->transmitting = FALSE;
+ (usbp)->transmitting &= ~((uint16_t)(1 << ep));
epcp->in_cb(usbp, ep);
}
else {
@@ -200,7 +200,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) {
}
else {
/* Transfer completed, invokes the callback.*/
- (usbp)->ep[ep]->transmitting = FALSE;
+ (usbp)->transmitting &= ~((uint16_t)(1 << ep));
epcp->in_cb(usbp, ep);
}
}
@@ -210,7 +210,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) {
/* OUT endpoint, receive.*/
if (epcp->flags & USB_EP_FLAGS_OUT_PACKET_MODE) {
/* Packet mode, just invokes the callback.*/
- (usbp)->ep[ep]->receiving = FALSE;
+ (usbp)->receiving &= ~((uint16_t)(1 << ep));
epcp->out_cb(usbp, ep);
}
else {
@@ -233,7 +233,7 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) {
}
else {
/* Transfer completed, invokes the callback.*/
- (usbp)->ep[ep]->receiving = FALSE;
+ (usbp)->receiving &= ~((uint16_t)(1 << ep));
epcp->out_cb(usbp, ep);
}
}
@@ -398,7 +398,7 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
start ready to accept data else it must start in NAK mode.*/
if (epcp->out_cb) {
if (epcp->flags & USB_EP_FLAGS_OUT_PACKET_MODE) {
- usbp->ep[ep]->receiving = TRUE;
+ usbp->receiving |= ((uint16_t)(1 << ep));
epr |= EPR_STAT_RX_VALID;
}
else
diff --git a/os/hal/platforms/STM32/usb_lld.h b/os/hal/platforms/STM32/usb_lld.h
index 6d131796e..4eebda951 100644
--- a/os/hal/platforms/STM32/usb_lld.h
+++ b/os/hal/platforms/STM32/usb_lld.h
@@ -161,15 +161,6 @@ typedef struct {
*/
const USBEndpointConfig *config;
/**
- * @brief @p TRUE if transmitting else @p FALSE.
- */
- uint8_t transmitting;
- /**
- * @brief @p TRUE if receiving else @p FALSE.
- */
- uint8_t receiving;
- /* End of the mandatory fields.*/
- /**
* @brief Number of packets to receive.
*/
uint16_t rxpkts;
@@ -244,6 +235,14 @@ struct USBDriver {
*/
void *param;
/**
+ * @brief Bit map of the transmitting IN endpoints.
+ */
+ uint16_t transmitting;
+ /**
+ * @brief Bit map of the receiving OUT endpoints.
+ */
+ uint16_t receiving;
+ /**
* @brief Active endpoints configurations.
*/
USBEndpointState *ep[USB_MAX_ENDPOINTS + 1];