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

This commit is contained in:
gdisirio 2014-12-20 16:53:05 +00:00
parent 2e7aee242c
commit 6184745e4e
8 changed files with 40 additions and 15 deletions

View File

@ -65,6 +65,14 @@ typedef struct {
* @brief Buffer Table Address.
*/
volatile uint32_t BTABLE;
/*
* @brief LPM Control and Status Register.
*/
volatile uint32_t LPMCSR;
/*
* @brief Battery Charging Detector
*/
volatile uint32_t BCDR;
} stm32_usb_t;
/**
@ -95,14 +103,6 @@ typedef struct {
* @brief RX counter register 1.
*/
volatile uint16_t RXCOUNT1;
/*
* @brief LPM Control and Status Register.
*/
volatile uint32_t LPMCSR;
/*
* @brief Battery Charging Detector
*/
volatile uint32_t BCDR;
} stm32_usb_descriptor_t;
/**

View File

@ -404,6 +404,26 @@ struct USBDriver {
#define usb_lld_get_transaction_size(usbp, ep) \
((usbp)->epc[ep]->out_state->rxcnt)
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
/**
* @brief Connects the USB device.
*
* @api
*/
#if !defined(usb_lld_connect_bus)
#define usb_lld_connect_bus(usbp) (STM32_USB->BCDR |= USB_BCDR_DPPU)
#endif
/**
* @brief Disconnect the USB device.
*
* @api
*/
#if !defined(usb_lld_disconnect_bus)
#define usb_lld_disconnect_bus(usbp) (STM32_USB->BCDR &= ~USB_BCDR_DPPU)
#endif
#endif /* STM32_USB_HAS_BCDR */
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/

View File

@ -195,6 +195,7 @@
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || \
defined(STM32F078xx)
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR TRUE
#else
#define STM32_HAS_USB FALSE
#endif

View File

@ -582,6 +582,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
/** @} */
@ -756,6 +757,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
/** @} */
@ -930,6 +932,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
/** @} */

View File

@ -206,6 +206,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F373xC) */

View File

@ -204,6 +204,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F303xC) */
@ -658,6 +659,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F302x8) */
@ -821,6 +823,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F302xC) */
@ -971,6 +974,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F318x8) */
@ -1283,6 +1287,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
#endif /* defined(STM32F358xC) */

View File

@ -178,6 +178,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE
@ -333,6 +334,7 @@
/* USB attributes.*/
#define STM32_HAS_USB TRUE
#define STM32_USB_HAS_BCDR FALSE
#define STM32_HAS_OTG1 FALSE
#define STM32_HAS_OTG2 FALSE

View File

@ -35,13 +35,6 @@
#define USBD1_DATA_AVAILABLE_EP 1
#define USBD1_INTERRUPT_REQUEST_EP 2
/*
* DP resistor control is not possible on the STM32F3-Discovery, using stubs
* for the connection macros.
*/
#define usb_lld_connect_bus(usbp)
#define usb_lld_disconnect_bus(usbp)
/*
* Serial over USB Driver structure.
*/