From fa1aeb7e9a376489ba47b04d3aadeb273c7b6b9f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 11 Jan 2015 13:56:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7622 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h | 2 +- os/hal/ports/STM32/LLD/OTGv1/usb_lld.c | 82 ++++++++++++++++---------------- os/hal/ports/STM32/LLD/OTGv1/usb_lld.h | 18 +++---- 3 files changed, 51 insertions(+), 51 deletions(-) (limited to 'os/hal/ports/STM32/LLD/OTGv1') diff --git a/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h b/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h index e9ba8964e..00d86f91c 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h +++ b/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h @@ -1,5 +1,5 @@ /* - ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c index eb6af99ca..455c1c77e 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c +++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,13 +32,13 @@ /* Driver local definitions. */ /*===========================================================================*/ -#define TRDT_VALUE 5 - -#define EP0_MAX_INSIZE 64 -#define EP0_MAX_OUTSIZE 64 - -/*===========================================================================*/ -/* Driver exported variables. */ +#define TRDT_VALUE 5 + +#define EP0_MAX_INSIZE 64 +#define EP0_MAX_OUTSIZE 64 + +/*===========================================================================*/ +/* Driver exported variables. */ /*===========================================================================*/ /** @brief OTG_FS driver identifier.*/ @@ -590,29 +590,29 @@ static void otg_epout_handler(USBDriver *usbp, usbep_t ep) { specific callback.*/ _usb_isr_invoke_setup_cb(usbp, ep); - } - if ((epint & DOEPINT_XFRC) && (otgp->DOEPMSK & DOEPMSK_XFRCM)) { - /* Receive transfer complete.*/ - USBOutEndpointState *osp = usbp->epc[ep]->out_state; - - if (osp->rxsize < osp->totsize) { - /* In case the transaction covered only part of the total transfer - then another transaction is immediately started in order to - cover the remaining.*/ - osp->rxsize = osp->totsize - osp->rxsize; - osp->rxcnt = 0; - usb_lld_prepare_receive(usbp, ep); - chSysLockFromISR(); - usb_lld_start_out(usbp, ep); - chSysUnlockFromISR(); - } - else { - /* End on OUT transfer.*/ - _usb_isr_invoke_out_cb(usbp, ep); - } - } -} - + } + if ((epint & DOEPINT_XFRC) && (otgp->DOEPMSK & DOEPMSK_XFRCM)) { + /* Receive transfer complete.*/ + USBOutEndpointState *osp = usbp->epc[ep]->out_state; + + if (osp->rxsize < osp->totsize) { + /* In case the transaction covered only part of the total transfer + then another transaction is immediately started in order to + cover the remaining.*/ + osp->rxsize = osp->totsize - osp->rxsize; + osp->rxcnt = 0; + usb_lld_prepare_receive(usbp, ep); + chSysLockFromISR(); + usb_lld_start_out(usbp, ep); + chSysUnlockFromISR(); + } + else { + /* End on OUT transfer.*/ + _usb_isr_invoke_out_cb(usbp, ep); + } + } +} + /** * @brief OTG shared ISR. * @@ -1158,16 +1158,16 @@ void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf) { */ void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep) { uint32_t pcnt; - USBOutEndpointState *osp = usbp->epc[ep]->out_state; - - /* Transfer initialization.*/ - osp->totsize = osp->rxsize; - if ((ep == 0) && (osp->rxsize > EP0_MAX_OUTSIZE)) - osp->rxsize = EP0_MAX_OUTSIZE; - - pcnt = (osp->rxsize + usbp->epc[ep]->out_maxsize - 1) / - usbp->epc[ep]->out_maxsize; - usbp->otg->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) | + USBOutEndpointState *osp = usbp->epc[ep]->out_state; + + /* Transfer initialization.*/ + osp->totsize = osp->rxsize; + if ((ep == 0) && (osp->rxsize > EP0_MAX_OUTSIZE)) + osp->rxsize = EP0_MAX_OUTSIZE; + + pcnt = (osp->rxsize + usbp->epc[ep]->out_maxsize - 1) / + usbp->epc[ep]->out_maxsize; + usbp->otg->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) | DOEPTSIZ_XFRSIZ(osp->rxsize); } diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h index 1b6bf6480..d88987140 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h +++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -260,14 +260,14 @@ typedef struct { * @brief Pointer to the input queue. */ input_queue_t *rxqueue; - } queue; - } mode; - /** - * @brief Total transmit transfer size. - */ - size_t totsize; -} USBOutEndpointState; - + } queue; + } mode; + /** + * @brief Total transmit transfer size. + */ + size_t totsize; +} USBOutEndpointState; + /** * @brief Type of an USB endpoint configuration structure. * @note Platform specific restrictions may apply to endpoints. -- cgit v1.2.3