- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-/** @addtogroup CMSIS
- * @{
- */
-
-/** @addtogroup stm32f4xx_system
- * @{
- */
-
-/** @addtogroup STM32F4xx_System_Private_Includes
- * @{
- */
-#include "usb_interface.h"
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-#ifdef USBCON
-/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Variables
- * @{
- */
-/* USB Device Core handle declaration */
-#ifdef USBD_USE_HID_COMPOSITE
-static USBD_HandleTypeDef hUSBD_Device_HID;
-#endif //USBD_USE_HID_COMPOSITE
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Functions
- * @{
- */
-
-/**
- * @brief initialize the USB HID interface
- * @param HID_Desc : usb HID descriptor callbacks
- * @retval none
- */
-void usbd_interface_init(void)
-{
-#ifdef USBD_USE_HID_COMPOSITE
- /* Init Device Library */
- USBD_Init(&hUSBD_Device_HID, &HID_Desc, 0);
-
- /* Add Supported Class */
- USBD_RegisterClass(&hUSBD_Device_HID, USBD_COMPOSITE_HID_CLASS);
-
- /* Start Device Process */
- USBD_Start(&hUSBD_Device_HID);
-#endif // USBD_USE_HID_COMPOSITE
-}
-
-/**
- * @brief initialize the USB HID interface
- * @param HID_Desc : usb HID descriptor callbacks
- * @retval none
- */
-void usbd_interface_mouse_sendReport(uint8_t *report, uint16_t len)
-{
-#ifdef USBD_USE_HID_COMPOSITE
- USBD_HID_MOUSE_SendReport(&hUSBD_Device_HID, report, len);
-#endif // USBD_USE_HID_COMPOSITE
-}
-
-/**
- * @brief initialize the USB HID interface
- * @param HID_Desc : usb HID descriptor callbacks
- * @retval none
- */
-void usbd_interface_keyboard_sendReport(uint8_t *report, uint16_t len)
-{
-#ifdef USBD_USE_HID_COMPOSITE
- USBD_HID_KEYBOARD_SendReport(&hUSBD_Device_HID, report, len);
-#endif // USBD_USE_HID_COMPOSITE
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif // USBCON
-#ifdef __cplusplus
-}
-#endif
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/libraries/USBSerial/examples/USBSerial/USBSerial.ino b/libraries/USBSerial/examples/USBSerial/USBSerial.ino
new file mode 100644
index 0000000000..c7813635e8
--- /dev/null
+++ b/libraries/USBSerial/examples/USBSerial/USBSerial.ino
@@ -0,0 +1,16 @@
+#include
+
+void setup() {
+ // Default baudrate is set to 9600
+ SerialUSB.begin();
+}
+
+void loop() {
+ SerialUSB.println("Hello world!");
+ delay(1000);
+
+ while(SerialUSB.available()) {
+ char c = SerialUSB.read();
+ SerialUSB.print(c);
+ }
+}
diff --git a/libraries/USBSerial/library.properties b/libraries/USBSerial/library.properties
new file mode 100644
index 0000000000..26b31a4254
--- /dev/null
+++ b/libraries/USBSerial/library.properties
@@ -0,0 +1,9 @@
+name=USB Serial
+version=1.0.0
+author=Wi6Labs
+maintainer=STMicroelectronics
+sentence=Provides USB CDC class.
+paragraph=
+category=Device Control
+url=https://github.com/stm32duino/Arduino_Core_STM32
+architectures=stm32
diff --git a/libraries/USBSerial/src/USBSerial.cpp b/libraries/USBSerial/src/USBSerial.cpp
new file mode 100644
index 0000000000..ea41e60f57
--- /dev/null
+++ b/libraries/USBSerial/src/USBSerial.cpp
@@ -0,0 +1,222 @@
+/******************************************************************************
+ * The MIT License
+ *
+ * Copyright (c) 2010 Perry Hung.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *****************************************************************************/
+
+/**
+ * @brief USB virtual serial terminal
+ */
+
+/*
+ * Arduino srl - www.arduino.org
+ * 2016 Jun 9: Edited Francesco Alessi (alfran) - francesco@arduino.org
+ */
+
+#ifdef USBCON
+
+#include
+
+#include "USBSerial.h"
+#include "usbd_cdc.h"
+#include "usbd_cdc_if.h"
+#include "usbd_desc.h"
+#include "usbd_desc_cdc.h"
+#include "wiring.h"
+
+#define USB_TIMEOUT 50
+/* USB Device Core handle declaration */
+USBD_HandleTypeDef hUSBD_Device_CDC;
+extern __IO uint32_t device_connection_status;
+extern __IO uint32_t lineState;
+extern __IO uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
+extern __IO uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
+extern __IO uint32_t UserTxBufPtrIn;
+extern __IO uint32_t UserTxBufPtrOut;
+extern __IO uint32_t UserRxBufPtrIn;
+extern __IO uint32_t UserRxBufPtrOut;
+__IO uint32_t usbEnableBlockingTx;
+
+USBSerial SerialUSB;
+
+USBSerial::USBSerial(void) {}
+
+void USBSerial::reenumerate() {
+ /* Re-enumerate the USB */
+ volatile unsigned int i;
+
+ pinMode(PA12, OUTPUT);
+ digitalWrite(PA12, LOW);
+ for (i = 0; i < 1512; i++) {
+ };
+ pinMode(PA12, INPUT);
+ for (i = 0; i < 512; i++) {
+ };
+}
+
+/* USBSerial is always available and instantiated in main.cpp */
+void USBSerial::begin(void) {
+ reenumerate();
+
+ if (USBD_Init(&hUSBD_Device_CDC, &CDC_Desc, DEVICE_FS) == USBD_OK) {
+
+ /* Add Supported Class */
+ if (USBD_RegisterClass(&hUSBD_Device_CDC, USBD_CDC_CLASS) == USBD_OK) {
+
+ /* Add CDC Interface Class */
+ if (USBD_CDC_RegisterInterface(&hUSBD_Device_CDC,
+ &USBD_Interface_fops_FS) == USBD_OK) {
+
+ /* Start Device Process */
+ USBD_Start(&hUSBD_Device_CDC);
+ }
+ }
+ }
+}
+
+void USBSerial::begin(int) {
+ reenumerate();
+
+ if (USBD_Init(&hUSBD_Device_CDC, &CDC_Desc, DEVICE_FS) == USBD_OK) {
+
+ /* Add Supported Class */
+ if (USBD_RegisterClass(&hUSBD_Device_CDC, USBD_CDC_CLASS) == USBD_OK) {
+
+ /* Add CDC Interface Class */
+ if (USBD_CDC_RegisterInterface(&hUSBD_Device_CDC,
+ &USBD_Interface_fops_FS) == USBD_OK) {
+
+ /* Start Device Process */
+ USBD_Start(&hUSBD_Device_CDC);
+ }
+ }
+ }
+}
+
+void USBSerial::end(void) { USBD_LL_DeInit(&hUSBD_Device_CDC); }
+
+int USBSerial::availableForWrite(void) {
+ int ret_val;
+
+ /* UserTxBufPtrOut can be modified by TIM ISR, so in order to be sure
+ * that the value that we read is correct, we need to disable TIM Interrupt.
+ */
+ CDC_disable_TIM_Interrupt();
+
+ if (UserTxBufPtrIn >= UserTxBufPtrOut) {
+ ret_val = (APP_TX_DATA_SIZE - 1 - UserTxBufPtrIn + UserTxBufPtrOut);
+ } else {
+ ret_val = (UserTxBufPtrOut - UserTxBufPtrIn - 1);
+ }
+
+ CDC_enable_TIM_Interrupt();
+
+ return ret_val;
+}
+
+size_t USBSerial::write(uint8_t ch) {
+
+ /* UserTxBufPtrOut can be modified by TIM ISR, so in order to be sure
+ * that the value that we read is correct, we need to disable TIM Interrupt.
+ */
+ CDC_disable_TIM_Interrupt();
+
+ if (((UserTxBufPtrIn + 1) % APP_TX_DATA_SIZE) == UserTxBufPtrOut) {
+ CDC_flush(); // Buffer full!!! Force a flush to not loose data and go on
+ }
+ UserTxBufferFS[UserTxBufPtrIn] = ch;
+ UserTxBufPtrIn = ((UserTxBufPtrIn + 1) % APP_TX_DATA_SIZE);
+
+ CDC_enable_TIM_Interrupt();
+
+ return 1;
+}
+
+int USBSerial::available(void) {
+ return ((APP_RX_DATA_SIZE + (UserRxBufPtrIn - UserRxBufPtrOut)) %
+ APP_RX_DATA_SIZE);
+}
+
+int USBSerial::read(void) {
+ if (UserRxBufPtrOut == UserRxBufPtrIn) {
+ return -1;
+ } else {
+ unsigned char c = UserRxBufferFS[UserRxBufPtrOut];
+ UserRxBufPtrOut = ((UserRxBufPtrOut + 1) % APP_RX_DATA_SIZE);
+
+ CDC_resume_receive();
+ return c;
+ }
+}
+
+int USBSerial::peek(void) {
+ if (UserRxBufPtrOut == UserRxBufPtrIn) {
+ return -1;
+ } else {
+ unsigned char c = UserRxBufferFS[UserRxBufPtrOut];
+ return c;
+ }
+}
+
+void USBSerial::flush(void) {
+ /* UserTxBufPtrOut can be modified by TIM ISR, so in order to be sure
+ * that the value that we read is correct, we need to disable TIM Interrupt.
+ */
+ CDC_disable_TIM_Interrupt();
+ CDC_flush();
+ CDC_enable_TIM_Interrupt();
+}
+
+uint8_t USBSerial::pending(void) {
+ // return usbGetPending(); // No equivalent in HAL
+ return 0;
+}
+
+uint8_t USBSerial::isConnected(void) {
+
+ if (device_connection_status == 1) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+uint8_t USBSerial::getDTR(void) {
+ // return usbGetDTR();
+ return 0;
+}
+
+uint8_t USBSerial::getRTS(void) {
+ // return usbGetRTS();
+ return 0;
+}
+
+USBSerial::operator bool() {
+ bool result = false;
+ if (lineState == 1)
+ result = true;
+ delay(10);
+ return result;
+}
+
+#endif // USBCON
diff --git a/libraries/USBSerial/src/USBSerial.h b/libraries/USBSerial/src/USBSerial.h
new file mode 100644
index 0000000000..32bae92fc0
--- /dev/null
+++ b/libraries/USBSerial/src/USBSerial.h
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * The MIT License
+ *
+ * Copyright (c) 2010 Perry Hung.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *****************************************************************************/
+
+/**
+ * @brief Wirish virtual serial port
+ */
+
+ /*
+ * Arduino srl - www.arduino.org
+ * 2016 Jun 9: Edited Francesco Alessi (alfran) - francesco@arduino.org
+ */
+
+
+#ifndef _USB_SERIAL_H_
+#define _USB_SERIAL_H_
+
+#if !defined (USBCON)
+#warning "Using legacy CDC core (non pluggable)"
+#else
+#include "Stream.h"
+#include "usbd_core.h"
+
+/**
+ * @brief Virtual serial terminal.
+ */
+class USBSerial : public Stream {
+public:
+ USBSerial(void);
+
+ void reenumerate();
+
+ void begin(void);
+ void begin(int);
+ void end(void);
+
+ virtual int available(void);
+ virtual int peek(void);
+ virtual void flush(void);
+ virtual int read(void);
+
+ int availableForWrite(void);
+ virtual size_t write(uint8_t);
+ inline size_t write(unsigned long n) { return write((uint8_t)n); }
+ inline size_t write(long n) { return write((uint8_t)n); }
+ inline size_t write(unsigned int n) { return write((uint8_t)n); }
+ inline size_t write(int n) { return write((uint8_t)n); }
+ using Print::write;
+
+ uint8_t getRTS();
+ uint8_t getDTR();
+ uint8_t isConnected();
+ uint8_t pending();
+
+ virtual operator bool(void);
+
+};
+
+extern USBSerial SerialUSB;
+#endif
+#endif
diff --git a/libraries/USBSerial/src/usb_device_cdc.c b/libraries/USBSerial/src/usb_device_cdc.c
new file mode 100644
index 0000000000..9ce6bc71c3
--- /dev/null
+++ b/libraries/USBSerial/src/usb_device_cdc.c
@@ -0,0 +1,26 @@
+/*
+ *
+ *
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: YOUR NAME <> for STMicroelectronics.
+ *
+ * License type: GPLv2
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see
+ * .
+ */
+#ifdef USBCON
+
+#include "usbd_cdc.c"
+
+#endif //USBCON
diff --git a/libraries/USBSerial/src/usbd_cdc_if.c b/libraries/USBSerial/src/usbd_cdc_if.c
new file mode 100644
index 0000000000..167a00d466
--- /dev/null
+++ b/libraries/USBSerial/src/usbd_cdc_if.c
@@ -0,0 +1,448 @@
+/**
+ ******************************************************************************
+ * @file : usbd_cdc_if.c
+ * @brief :
+ ******************************************************************************
+ * COPYRIGHT(c) 2016 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+*/
+#ifdef USBCON
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_cdc_if.h"
+#include "stm32_def.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+ * @{
+ */
+
+/** @defgroup USBD_CDC
+ * @brief usbd core module
+ * @{
+ */
+
+/** @defgroup USBD_CDC_Private_TypesDefinitions
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_Private_Defines
+ * @{
+ */
+/* Define size for the receive and transmit buffer over CDC */
+/* It's up to user to redefine and/or remove those define */
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_Private_Variables
+ * @{
+ */
+/* Create buffer for reception and transmission */
+/* It's up to user to redefine and/or remove those define */
+extern USBD_HandleTypeDef hUSBD_Device_CDC;
+/* Received Data over USB are stored in this buffer */
+__IO uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
+__IO uint8_t StackRxBufferFS[USB_OTG_FS_MAX_PACKET_SIZE];
+
+/* Send Data over USB CDC are stored in this buffer */
+__IO uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
+__IO uint8_t StackTxBufferFS[APP_TX_DATA_SIZE];
+
+__IO uint32_t UserTxBufPtrIn = 0; /* Increment this pointer or roll it back to
+ * start address when data are received over write call
+ */
+__IO uint32_t UserTxBufPtrOut = 0; /* Increment this pointer or roll it back to
+ * start address when data are sent over USB
+ */
+
+__IO uint32_t UserRxBufPtrIn = 0; /* Increment this pointer or roll it back to
+ * start address when data are received over USB
+ */
+__IO uint32_t UserRxBufPtrOut = 0; /* Increment this pointer or roll it back to
+ * start address when data are sent over read call
+ */
+
+__IO uint32_t lineState = 0;
+__IO bool receiveSuspended = false;
+__IO bool sendZLP = false;
+
+/* Default configuration: 115200, 8N1 */
+uint8_t lineSetup[] = {0x00, 0xc2, 0x01, 0x00, 0x00, 0x00, 0x08};
+
+#define CDC_POLLING_INTERVAL 2 /* in ms. The max is 65 and the min is 1 */
+
+stimer_t TimHandle;
+
+static void TIM_Config(void);
+
+/* USB handler declaration */
+/* Handle for USB Full Speed IP */
+// USBD_HandleTypeDef *hUsbDevice_0;
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_Private_FunctionPrototypes
+ * @{
+ */
+static int8_t CDC_Init_FS(void);
+static int8_t CDC_DeInit_FS(void);
+static int8_t CDC_Control_FS(uint8_t cmd, uint8_t *pbuf, uint16_t length);
+static int8_t CDC_Receive_FS(uint8_t *pbuf, uint32_t *Len);
+
+/**
+ * @}
+ */
+
+USBD_CDC_ItfTypeDef USBD_Interface_fops_FS = {CDC_Init_FS, CDC_DeInit_FS,
+ CDC_Control_FS, CDC_Receive_FS};
+
+/* Private functions ---------------------------------------------------------*/
+/**
+ * @brief CDC_Init_FS
+ * Initializes the CDC media low layer over the FS USB IP
+ * @param None
+ * @retval Result of the operation: USBD_OK if all operations are OK else
+ * USBD_FAIL
+ */
+static int8_t CDC_Init_FS(void) {
+ /* Configure and start the TIM Base generation */
+ TIM_Config();
+
+ /* Set Application Buffers */
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC, (uint8_t *)UserTxBufferFS, 1);
+ USBD_CDC_SetRxBuffer(&hUSBD_Device_CDC, (uint8_t *)StackRxBufferFS);
+
+ return (USBD_OK);
+}
+
+/**
+ * @brief CDC_DeInit_FS
+ * DeInitializes the CDC media low layer
+ * @param None
+ * @retval Result of the operation: USBD_OK if all operations are OK else
+ * USBD_FAIL
+ */
+static int8_t CDC_DeInit_FS(void) { return (USBD_OK); }
+
+/**
+ * @brief CDC_Control_FS
+ * Manage the CDC class requests
+ * @param cmd: Command code
+ * @param pbuf: Buffer containing command data (request parameters)
+ * @param length: Number of data to be sent (in bytes)
+ * @retval Result of the operation: USBD_OK if all operations are OK else
+ * USBD_FAIL
+ */
+static int8_t CDC_Control_FS(uint8_t cmd, uint8_t *pbuf, uint16_t length) {
+ UNUSED(length);
+ switch (cmd) {
+ case CDC_SEND_ENCAPSULATED_COMMAND:
+
+ break;
+
+ case CDC_GET_ENCAPSULATED_RESPONSE:
+
+ break;
+
+ case CDC_SET_COMM_FEATURE:
+
+ break;
+
+ case CDC_GET_COMM_FEATURE:
+
+ break;
+
+ case CDC_CLEAR_COMM_FEATURE:
+
+ break;
+
+ /*******************************************************************************/
+ /* Line Coding Structure */
+ /*-----------------------------------------------------------------------------*/
+ /* Offset | Field | Size | Value | Description */
+ /* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per
+ * second*/
+ /* 4 | bCharFormat | 1 | Number | Stop bits */
+ /* 0 - 1 Stop bit */
+ /* 1 - 1.5 Stop bits */
+ /* 2 - 2 Stop bits */
+ /* 5 | bParityType | 1 | Number | Parity */
+ /* 0 - None */
+ /* 1 - Odd */
+ /* 2 - Even */
+ /* 3 - Mark */
+ /* 4 - Space */
+ /* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
+ /*******************************************************************************/
+ case CDC_SET_LINE_CODING:
+ memcpy(lineSetup, pbuf, 7);
+ break;
+
+ case CDC_GET_LINE_CODING:
+ memcpy(pbuf, lineSetup, 7);
+ break;
+
+ case CDC_SET_CONTROL_LINE_STATE:
+ lineState =
+ (((USBD_SetupReqTypedef *)pbuf)->wValue & 0x01) != 0; // Check DTR state
+ break;
+
+ case CDC_SEND_BREAK:
+
+ break;
+
+ default:
+ break;
+ }
+
+ return (USBD_OK);
+}
+
+/**
+ * @brief CDC_Receive_FS
+ * Data received over USB OUT endpoint are sent over CDC interface
+ * through this function.
+ *
+ * @note
+ * This function will block any OUT packet reception on USB endpoint
+ * untill exiting this function. If you exit this function before
+ * transfer is complete on CDC interface (ie. using DMA controller) it will
+ * result in receiving more data while previous ones are still not sent.
+ *
+ * @param Buf: Buffer of data to be received
+ * @param Len: Number of data received (in bytes)
+ * @retval Result of the operation: USBD_OK if all operations are OK else
+ * USBD_FAIL
+ */
+
+static int8_t CDC_Receive_FS(uint8_t *Buf, uint32_t *Len) {
+
+ uint32_t packetSize = *Len;
+
+ if (packetSize > 0) {
+ if (UserRxBufPtrIn + packetSize > APP_RX_DATA_SIZE) {
+ memcpy(((uint8_t *)UserRxBufferFS + UserRxBufPtrIn), &Buf[0],
+ (APP_RX_DATA_SIZE - UserRxBufPtrIn));
+ memcpy((uint8_t *)UserRxBufferFS,
+ &Buf[(APP_RX_DATA_SIZE - UserRxBufPtrIn)],
+ (packetSize - (APP_RX_DATA_SIZE - UserRxBufPtrIn)));
+ UserRxBufPtrIn = ((UserRxBufPtrIn + packetSize) % APP_RX_DATA_SIZE);
+ } else {
+ memcpy(((uint8_t *)UserRxBufferFS + UserRxBufPtrIn), Buf, packetSize);
+ UserRxBufPtrIn = ((UserRxBufPtrIn + packetSize) % APP_RX_DATA_SIZE);
+ }
+ }
+
+ if ((UserRxBufPtrOut + APP_RX_DATA_SIZE - UserRxBufPtrIn - 1) %
+ APP_RX_DATA_SIZE +
+ 1 >=
+ USB_OTG_FS_MAX_PACKET_SIZE)
+ USBD_CDC_ReceivePacket(
+ &hUSBD_Device_CDC); // Initiate next USB packet transfer once a packet
+ // is received and there is enouch space in the
+ // buffer
+ else
+ receiveSuspended = true;
+
+ return (USBD_OK);
+}
+
+/**
+ * @brief CDC_Transmit_FS
+ * Data send over USB IN endpoint are sent over CDC interface
+ * through this function.
+ * @note
+ *
+ *
+ * @param Buf: Buffer of data to be send
+ * @param Len: Number of data to be send (in bytes)
+ * @retval Result of the operation: USBD_OK if all operations are OK else
+ * USBD_FAIL or USBD_BUSY
+ */
+uint8_t CDC_Transmit_FS(uint8_t *Buf, uint16_t Len) {
+ UNUSED(Buf);
+ uint8_t result = USBD_OK;
+ UNUSED(Len);
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC, (uint8_t *)UserTxBufferFS, 1);
+ result = USBD_CDC_TransmitPacket(&hUSBD_Device_CDC);
+ return result;
+}
+
+void CDC_flush(void) {
+ uint8_t status;
+
+ if (UserTxBufPtrOut != UserTxBufPtrIn) {
+ if (UserTxBufPtrOut > UserTxBufPtrIn) /* Roll-back */
+ {
+ memcpy((uint8_t *)&StackTxBufferFS[0],
+ (uint8_t *)&UserTxBufferFS[UserTxBufPtrOut],
+ (APP_TX_DATA_SIZE - UserTxBufPtrOut));
+ memcpy((uint8_t *)&StackTxBufferFS[APP_TX_DATA_SIZE - UserTxBufPtrOut],
+ (uint8_t *)&UserTxBufferFS[0], UserTxBufPtrIn);
+
+ USBD_CDC_SetTxBuffer(
+ &hUSBD_Device_CDC, (uint8_t *)&StackTxBufferFS[0],
+ (APP_TX_DATA_SIZE - UserTxBufPtrOut + UserTxBufPtrIn));
+ } else {
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC,
+ (uint8_t *)&UserTxBufferFS[UserTxBufPtrOut],
+ (UserTxBufPtrIn - UserTxBufPtrOut));
+ }
+
+ do {
+ if (lineState == 0) // Device disconnected
+ status = USBD_OK;
+ else
+ status = USBD_CDC_TransmitPacket(&hUSBD_Device_CDC);
+ } while (status == USBD_BUSY);
+
+ if (status == USBD_OK) {
+ UserTxBufPtrOut = UserTxBufPtrIn;
+ }
+ }
+}
+
+void CDC_disable_TIM_Interrupt(void) { HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn); }
+
+void CDC_enable_TIM_Interrupt(void) { HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); }
+
+void CDC_resume_receive(void) {
+ if (receiveSuspended) {
+ if ((UserRxBufPtrOut + APP_RX_DATA_SIZE - UserRxBufPtrIn - 1) %
+ APP_RX_DATA_SIZE +
+ 1 >=
+ USB_OTG_FS_MAX_PACKET_SIZE) {
+ USBD_CDC_ReceivePacket(
+ &hUSBD_Device_CDC); // Initiate next USB packet transfer once a packet
+ // is received and there is enouch space in the
+ // buffer
+ receiveSuspended = false;
+ HAL_GPIO_WritePin(GPIOD, GPIO_PIN_10, GPIO_PIN_RESET);
+ }
+ }
+}
+
+static void TIM_Config(void) {
+ /* Set TIMx instance */
+ TimHandle.timer = TIM6;
+ /* Initialize TIM6 peripheral as follow:
+ + Period = 10000 - 1
+ + Prescaler = ((SystemCoreClock/2)/10000) - 1
+ + ClockDivision = 0
+ + Counter direction = Up
+ */
+ TimerHandleInit(&TimHandle, (uint16_t)((CDC_POLLING_INTERVAL * 1000) - 1),
+ ((uint32_t)(getTimerClkFreq(TIM6) / (1000000)) -
+ 1)); // CDC_POLLING_INTERVAL
+
+ HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 6, 0);
+
+ timer_attach_interrupt_handle(&TimHandle.handle, TIM6_PeriodElapsedCallback);
+}
+
+void TIM6_PeriodElapsedCallback(stimer_t *htim) {
+ UNUSED(htim);
+
+ if (UserTxBufPtrOut == UserTxBufPtrIn &&
+ sendZLP == false) // Nothing to do, return immediately
+ return;
+
+ uint8_t status;
+ uint16_t packetLength;
+
+ if (UserTxBufPtrOut > UserTxBufPtrIn) { /* Roll-back */
+ memcpy((uint8_t *)&StackTxBufferFS[0],
+ (uint8_t *)&UserTxBufferFS[UserTxBufPtrOut],
+ (APP_TX_DATA_SIZE - UserTxBufPtrOut));
+ memcpy((uint8_t *)&StackTxBufferFS[APP_TX_DATA_SIZE - UserTxBufPtrOut],
+ (uint8_t *)&UserTxBufferFS[0], UserTxBufPtrIn);
+
+ packetLength = (APP_TX_DATA_SIZE - UserTxBufPtrOut + UserTxBufPtrIn);
+
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC, (uint8_t *)&StackTxBufferFS[0],
+ packetLength);
+ } else if (UserTxBufPtrOut != UserTxBufPtrIn) {
+ packetLength = (UserTxBufPtrIn - UserTxBufPtrOut);
+
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC,
+ (uint8_t *)&UserTxBufferFS[UserTxBufPtrOut],
+ packetLength);
+ } else {
+ packetLength = 0;
+
+ USBD_CDC_SetTxBuffer(&hUSBD_Device_CDC, NULL, 0); // Send Zero Length Packet
+ }
+
+ if (lineState == 0) // Device disconnected
+ status = USBD_OK;
+ else
+ status = USBD_CDC_TransmitPacket(&hUSBD_Device_CDC);
+
+ if (status == USBD_OK) {
+ UserTxBufPtrOut = UserTxBufPtrIn;
+
+ sendZLP = packetLength % USB_OTG_FS_MAX_PACKET_SIZE == 0;
+ }
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif // USBCON
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/libraries/USBSerial/src/usbd_cdc_if.h b/libraries/USBSerial/src/usbd_cdc_if.h
new file mode 100644
index 0000000000..67e2d30ef5
--- /dev/null
+++ b/libraries/USBSerial/src/usbd_cdc_if.h
@@ -0,0 +1,118 @@
+/**
+ ******************************************************************************
+ * @file : usbd_cdc_if.h
+ * @brief : Header for usbd_cdc_if file.
+ ******************************************************************************
+ * COPYRIGHT(c) 2016 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+*/
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_CDC_IF_H
+#define __USBD_CDC_IF_H
+
+#ifdef USBCON
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_cdc.h"
+#include "timer.h"
+
+/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
+ * @{
+ */
+
+/** @defgroup USBD_CDC_IF
+ * @brief header
+ * @{
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_Defines
+ * @{
+ */
+#define APP_RX_DATA_SIZE 2048
+#define APP_TX_DATA_SIZE 2048
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_Variables
+ * @{
+ */
+extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
+
+/**
+ * @}
+ */
+
+/** @defgroup USBD_CDC_IF_Exported_FunctionsPrototype
+ * @{
+ */
+uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
+
+void CDC_flush(void);
+void CDC_resume_receive(void);
+void CDC_disable_TIM_Interrupt(void);
+void CDC_enable_TIM_Interrupt(void);
+void TIM6_PeriodElapsedCallback(stimer_t *htim);
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif
+#endif // USBCON
+#endif /* __USBD_CDC_IF_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/libraries/USBSerial/src/usbd_desc_cdc.c b/libraries/USBSerial/src/usbd_desc_cdc.c
new file mode 100644
index 0000000000..9bc64aae14
--- /dev/null
+++ b/libraries/USBSerial/src/usbd_desc_cdc.c
@@ -0,0 +1,197 @@
+/**
+ ******************************************************************************
+ * @file USB_Device/HID_Standalone/Src/usbd_desc.c
+ * @author MCD Application Team
+ * @version V1.0.2
+ * @date 06-May-2016
+ * @brief This file provides the USBD descriptors and string formatting method.
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
+ *
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_DESC_CDC_H
+#define __USBD_DESC_CDC_H
+
+#ifdef USBCON
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_def.h"
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+extern USBD_DescriptorsTypeDef CDC_Desc;
+
+#endif // USBCON
+#endif /* __USBD_DESC_CDC_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/platform.txt b/platform.txt
index 01ac507e35..fb4cd4c938 100644
--- a/platform.txt
+++ b/platform.txt
@@ -9,9 +9,7 @@ version=1.0.0
# STM compile variables
# ----------------------
-compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.core.path}/stm32/LL" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
-
-# "-I{build.system.path}/Drivers/BSP/Components" "-I{build.system.path}/Middlewares/Third_Party/FatFs/src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc"
+compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.core.path}/stm32/LL" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.variant.path}/Ethernet" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src"
compiler.warning_flags=-w
compiler.warning_flags.none=-w
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h
index 31397d2440..1ed36739f0 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h
@@ -2,29 +2,47 @@
******************************************************************************
* @file usbd_cdc.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief header file for the usbd_cdc.c file.
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
-
+ */
+
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_CDC_H
#define __USB_CDC_H
@@ -39,26 +57,34 @@
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
-
+
/** @defgroup usbd_cdc
* @brief This file is the Header file for usbd_cdc.c
* @{
- */
+ */
/** @defgroup usbd_cdc_Exported_Defines
* @{
- */
-#define CDC_IN_EP 0x81 /* EP1 for data IN */
-#define CDC_OUT_EP 0x01 /* EP1 for data OUT */
-#define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
+ */
+#define CDC_IN_EP 0x81U /* EP1 for data IN */
+#define CDC_OUT_EP 0x01U /* EP1 for data OUT */
+#define CDC_CMD_EP 0x82U /* EP2 for CDC commands */
+
+#ifndef CDC_HS_BINTERVAL
+ #define CDC_HS_BINTERVAL 0x10U
+#endif /* CDC_HS_BINTERVAL */
+
+#ifndef CDC_FS_BINTERVAL
+ #define CDC_FS_BINTERVAL 0x10U
+#endif /* CDC_FS_BINTERVAL */
/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
-#define CDC_DATA_HS_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */
-#define CDC_DATA_FS_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
-#define CDC_CMD_PACKET_SIZE 8 /* Control Endpoint Packet size */
+#define CDC_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */
+#define CDC_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */
+#define CDC_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */
-#define USB_CDC_CONFIG_DESC_SIZ 67
+#define USB_CDC_CONFIG_DESC_SIZ 67U
#define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
#define CDC_DATA_HS_OUT_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
@@ -68,19 +94,19 @@
/*---------------------------------------------------------------------*/
/* CDC definitions */
/*---------------------------------------------------------------------*/
-#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
-#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
-#define CDC_SET_COMM_FEATURE 0x02
-#define CDC_GET_COMM_FEATURE 0x03
-#define CDC_CLEAR_COMM_FEATURE 0x04
-#define CDC_SET_LINE_CODING 0x20
-#define CDC_GET_LINE_CODING 0x21
-#define CDC_SET_CONTROL_LINE_STATE 0x22
-#define CDC_SEND_BREAK 0x23
+#define CDC_SEND_ENCAPSULATED_COMMAND 0x00U
+#define CDC_GET_ENCAPSULATED_RESPONSE 0x01U
+#define CDC_SET_COMM_FEATURE 0x02U
+#define CDC_GET_COMM_FEATURE 0x03U
+#define CDC_CLEAR_COMM_FEATURE 0x04U
+#define CDC_SET_LINE_CODING 0x20U
+#define CDC_GET_LINE_CODING 0x21U
+#define CDC_SET_CONTROL_LINE_STATE 0x22U
+#define CDC_SEND_BREAK 0x23U
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_TypesDefinitions
@@ -89,7 +115,7 @@
/**
* @}
- */
+ */
typedef struct
{
uint32_t bitrate;
@@ -102,51 +128,51 @@ typedef struct _USBD_CDC_Itf
{
int8_t (* Init) (void);
int8_t (* DeInit) (void);
- int8_t (* Control) (uint8_t, uint8_t * , uint16_t);
- int8_t (* Receive) (uint8_t *, uint32_t *);
+ int8_t (* Control) (uint8_t cmd, uint8_t* pbuf, uint16_t length);
+ int8_t (* Receive) (uint8_t* Buf, uint32_t *Len);
}USBD_CDC_ItfTypeDef;
typedef struct
{
- uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */
+ uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE / 4U]; /* Force 32bits alignment */
uint8_t CmdOpCode;
- uint8_t CmdLength;
- uint8_t *RxBuffer;
- uint8_t *TxBuffer;
+ uint8_t CmdLength;
+ uint8_t *RxBuffer;
+ uint8_t *TxBuffer;
uint32_t RxLength;
- uint32_t TxLength;
-
- __IO uint32_t TxState;
- __IO uint32_t RxState;
+ uint32_t TxLength;
+
+ __IO uint32_t TxState;
+ __IO uint32_t RxState;
}
-USBD_CDC_HandleTypeDef;
+USBD_CDC_HandleTypeDef;
/** @defgroup USBD_CORE_Exported_Macros
* @{
- */
-
+ */
+
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_Variables
* @{
- */
+ */
extern USBD_ClassTypeDef USBD_CDC;
#define USBD_CDC_CLASS &USBD_CDC
/**
* @}
- */
+ */
/** @defgroup USB_CORE_Exported_Functions
* @{
*/
-uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev,
+uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev,
USBD_CDC_ItfTypeDef *fops);
uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev,
@@ -155,13 +181,13 @@ uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev,
uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev,
uint8_t *pbuff);
-
+
uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev);
uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
/**
* @}
- */
+ */
#ifdef __cplusplus
}
@@ -170,10 +196,10 @@ uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
#endif /* __USB_CDC_H */
/**
* @}
- */
+ */
/**
* @}
- */
-
+ */
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc_if_template.h b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc_if_template.h
index 7fb81d441c..d2e70b1ea5 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc_if_template.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc_if_template.h
@@ -2,25 +2,43 @@
******************************************************************************
* @file usbd_cdc_if_template.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief Header for usbd_cdc_if_template.c file.
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
index 06b3fc839a..57847370a9 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
@@ -2,23 +2,21 @@
******************************************************************************
* @file usbd_cdc.c
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
- * @brief This file provides the high layer firmware functions to manage the
+ * @brief This file provides the high layer firmware functions to manage the
* following functionalities of the USB CDC Class:
* - Initialization and Configuration of high and low layer
* - Enumeration as CDC Device (and enumeration for each implemented memory interface)
* - OUT/IN data transfer
* - Command IN transfer (class requests management)
* - Error management
- *
+ *
* @verbatim
- *
- * ===================================================================
+ *
+ * ===================================================================
* CDC Class Driver Description
- * ===================================================================
+ * ===================================================================
* This driver manages the "Universal Serial Bus Class Definitions for Communications Devices
- * Revision 1.2 November 16, 2007" and the sub-protocol specification of "Universal Serial Bus
+ * Revision 1.2 November 16, 2007" and the sub-protocol specification of "Universal Serial Bus
* Communications Class Subclass Specification for PSTN Devices Revision 1.2 February 9, 2007"
* This driver implements the following aspects of the specification:
* - Device descriptor management
@@ -28,39 +26,63 @@
* - Abstract Control Model compliant
* - Union Functional collection (using 1 IN endpoint for control)
* - Data interface class
- *
+ *
* These aspects may be enriched or modified for a specific user application.
- *
- * This driver doesn't implement the following aspects of the specification
+ *
+ * This driver doesn't implement the following aspects of the specification
* (but it is possible to manage these features with some modifications on this driver):
* - Any class-specific aspect relative to communication classes should be managed by user application.
* - All communication classes other than PSTN are not managed
- *
+ *
* @endverbatim
- *
+ *
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
+
+ /* BSPDependencies
+ - "stm32xxxxx_{eval}{discovery}{nucleo_144}.c"
+ - "stm32xxxxx_{eval}{discovery}_io.c"
+ EndBSPDependencies */
/* Includes ------------------------------------------------------------------*/
#include "usbd_cdc_if_template.h"
@@ -33,34 +56,34 @@
*/
-/** @defgroup USBD_CDC
+/** @defgroup USBD_CDC
* @brief usbd core module
* @{
- */
+ */
/** @defgroup USBD_CDC_Private_TypesDefinitions
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CDC_Private_Defines
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CDC_Private_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CDC_Private_FunctionPrototypes
@@ -72,7 +95,7 @@ static int8_t TEMPLATE_DeInit (void);
static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t TEMPLATE_Receive (uint8_t* pbuf, uint32_t *Len);
-USBD_CDC_ItfTypeDef USBD_CDC_Template_fops =
+USBD_CDC_ItfTypeDef USBD_CDC_Template_fops =
{
TEMPLATE_Init,
TEMPLATE_DeInit,
@@ -99,8 +122,8 @@ USBD_CDC_LineCodingTypeDef linecoding =
static int8_t TEMPLATE_Init(void)
{
/*
- Add your initialization code here
- */
+ Add your initialization code here
+ */
return (0);
}
@@ -113,8 +136,8 @@ static int8_t TEMPLATE_Init(void)
static int8_t TEMPLATE_DeInit(void)
{
/*
- Add your deinitialization code here
- */
+ Add your deinitialization code here
+ */
return (0);
}
@@ -122,13 +145,13 @@ static int8_t TEMPLATE_DeInit(void)
/**
* @brief TEMPLATE_Control
* Manage the CDC class requests
- * @param Cmd: Command code
+ * @param Cmd: Command code
* @param Buf: Buffer containing command data (request parameters)
* @param Len: Number of data to be sent (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
-{
+{
switch (cmd)
{
case CDC_SEND_ENCAPSULATED_COMMAND:
@@ -157,7 +180,7 @@ static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
linecoding.format = pbuf[4];
linecoding.paritytype = pbuf[5];
linecoding.datatype = pbuf[6];
-
+
/* Add your code here */
break;
@@ -168,8 +191,8 @@ static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
pbuf[3] = (uint8_t)(linecoding.bitrate >> 24);
pbuf[4] = linecoding.format;
pbuf[5] = linecoding.paritytype;
- pbuf[6] = linecoding.datatype;
-
+ pbuf[6] = linecoding.datatype;
+
/* Add your code here */
break;
@@ -179,8 +202,8 @@ static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
case CDC_SEND_BREAK:
/* Add your code here */
- break;
-
+ break;
+
default:
break;
}
@@ -190,37 +213,37 @@ static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
/**
* @brief TEMPLATE_Receive
- * Data received over USB OUT endpoint are sent over CDC interface
+ * Data received over USB OUT endpoint are sent over CDC interface
* through this function.
- *
+ *
* @note
- * This function will issue a NAK packet on any OUT packet received on
+ * This function will issue a NAK packet on any OUT packet received on
* USB endpoint untill exiting this function. If you exit this function
* before transfer is complete on CDC interface (ie. using DMA controller)
- * it will result in receiving more data while previous ones are still
+ * it will result in receiving more data while previous ones are still
* not sent.
- *
+ *
* @param Buf: Buffer of data to be received
* @param Len: Number of data received (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t TEMPLATE_Receive (uint8_t* Buf, uint32_t *Len)
{
-
+
return (0);
}
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_conf_template.h b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_conf_template.h
index 1f4d9e582c..5d12b2070c 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_conf_template.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_conf_template.h
@@ -2,25 +2,43 @@
******************************************************************************
* @file usbd_conf_template.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief Header file for the usbd_conf_template.c file
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
@@ -42,114 +60,116 @@
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
-
+
/** @defgroup USBD_CONF
* @brief USB device low level driver configuration file
* @{
- */
+ */
/** @defgroup USBD_CONF_Exported_Defines
* @{
- */
+ */
-#define USBD_MAX_NUM_INTERFACES 1
-#define USBD_MAX_NUM_CONFIGURATION 1
-#define USBD_MAX_STR_DESC_SIZ 0x100
-#define USBD_SUPPORT_USER_STRING 0
-#define USBD_SELF_POWERED 1
-#define USBD_DEBUG_LEVEL 2
+#define USBD_MAX_NUM_INTERFACES 1U
+#define USBD_MAX_NUM_CONFIGURATION 1U
+#define USBD_MAX_STR_DESC_SIZ 0x100U
+#define USBD_SUPPORT_USER_STRING 0U
+#define USBD_SELF_POWERED 1U
+#define USBD_DEBUG_LEVEL 2U
/* MSC Class Config */
-#define MSC_MEDIA_PACKET 8192
+#define MSC_MEDIA_PACKET 8192U
/* CDC Class Config */
-#define USBD_CDC_INTERVAL 2000
+#define USBD_CDC_INTERVAL 2000U
/* DFU Class Config */
-#define USBD_DFU_MAX_ITF_NUM 1
-#define USBD_DFU_XFERS_IZE 1024
+#define USBD_DFU_MAX_ITF_NUM 1U
+#define USBD_DFU_XFERS_IZE 1024U
/* AUDIO Class Config */
-#define USBD_AUDIO_FREQ 22100
+#define USBD_AUDIO_FREQ 22100U
/** @defgroup USBD_Exported_Macros
* @{
- */
+ */
- /* Memory management macros */
+ /* Memory management macros */
#define USBD_malloc malloc
#define USBD_free free
#define USBD_memset memset
#define USBD_memcpy memcpy
-
- /* DEBUG macros */
-
-#if (USBD_DEBUG_LEVEL > 0)
-#define USBD_UsrLog(...) printf(__VA_ARGS__);\
- printf("\n");
+/* DEBUG macros */
+#if (USBD_DEBUG_LEVEL > 0U)
+#define USBD_UsrLog(...) do { \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+} while (0)
#else
-#define USBD_UsrLog(...)
-#endif
-
-
-#if (USBD_DEBUG_LEVEL > 1)
-
-#define USBD_ErrLog(...) printf("ERROR: ") ;\
- printf(__VA_ARGS__);\
- printf("\n");
+#define USBD_UsrLog(...) do {} while (0)
+#endif
+
+#if (USBD_DEBUG_LEVEL > 1U)
+
+#define USBD_ErrLog(...) do { \
+ printf("ERROR: ") ; \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+} while (0)
#else
-#define USBD_ErrLog(...)
-#endif
-
-
-#if (USBD_DEBUG_LEVEL > 2)
-#define USBD_DbgLog(...) printf("DEBUG : ") ;\
- printf(__VA_ARGS__);\
- printf("\n");
+#define USBD_ErrLog(...) do {} while (0)
+#endif
+
+#if (USBD_DEBUG_LEVEL > 2U)
+#define USBD_DbgLog(...) do { \
+ printf("DEBUG : ") ; \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+} while (0)
#else
-#define USBD_DbgLog(...)
+#define USBD_DbgLog(...) do {} while (0)
#endif
-
+
/**
* @}
- */
-
-
-
+ */
+
+
+
/**
* @}
- */
+ */
/** @defgroup USBD_CONF_Exported_Types
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CONF_Exported_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CONF_Exported_Variables
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CONF_Exported_FunctionsPrototype
* @{
- */
+ */
/**
* @}
- */
+ */
#ifdef __cplusplus
}
@@ -160,10 +180,9 @@
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h
index 6550cd7814..215c6116c2 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h
@@ -2,28 +2,46 @@
******************************************************************************
* @file usbd_core.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief Header file for usbd_core.c file
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_CORE_H
@@ -42,59 +60,61 @@
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
-
+
/** @defgroup USBD_CORE
* @brief This file is the Header file for usbd_core.c file
* @{
- */
+ */
/** @defgroup USBD_CORE_Exported_Defines
* @{
- */
-
+ */
+#ifndef USBD_DEBUG_LEVEL
+#define USBD_DEBUG_LEVEL 0U
+#endif /* USBD_DEBUG_LEVEL */
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_TypesDefinitions
* @{
*/
-
+
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_Variables
* @{
- */
+ */
#define USBD_SOF USBD_LL_SOF
/**
* @}
- */
+ */
/** @defgroup USBD_CORE_Exported_FunctionsPrototype
* @{
- */
+ */
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id);
USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_Start (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_Stop (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass);
-USBD_StatusTypeDef USBD_RunTestMode (USBD_HandleTypeDef *pdev);
+USBD_StatusTypeDef USBD_RunTestMode (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
@@ -119,33 +139,33 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev);
-USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev,
- uint8_t ep_addr,
+USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev,
+ uint8_t ep_addr,
uint8_t ep_type,
uint16_t ep_mps);
-USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
-USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
-USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
-USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
-uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
-USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr);
-USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev,
- uint8_t ep_addr,
+USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr);
+USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev,
+ uint8_t ep_addr,
uint8_t *pbuf,
uint16_t size);
-USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
- uint8_t ep_addr,
+USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
+ uint8_t ep_addr,
uint8_t *pbuf,
uint16_t size);
-uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
+uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
void USBD_LL_Delay (uint32_t Delay);
/**
* @}
- */
+ */
#ifdef __cplusplus
}
@@ -155,11 +175,11 @@ void USBD_LL_Delay (uint32_t Delay);
/**
* @}
- */
+ */
/**
* @}
-*/
+*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
index 66380fdccb..70742ae46e 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
@@ -2,28 +2,46 @@
******************************************************************************
* @file usbd_req.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief Header file for the usbd_req.c file
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_REQUEST_H
@@ -40,18 +58,18 @@
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
-
+
/** @defgroup USBD_REQ
* @brief header file for the usbd_req.c file
* @{
- */
+ */
/** @defgroup USBD_REQ_Exported_Defines
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Exported_Types
@@ -59,27 +77,27 @@
*/
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Exported_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Exported_Variables
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Exported_FunctionsPrototype
* @{
- */
+ */
USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
@@ -93,7 +111,7 @@ void USBD_ParseSetupRequest (USBD_SetupReqTypedef *req, uint8_t *pdata);
void USBD_GetString (uint8_t *desc, uint8_t *unicode, uint16_t *len);
/**
* @}
- */
+ */
#ifdef __cplusplus
}
@@ -103,11 +121,11 @@ void USBD_GetString (uint8_t *desc, uint8_t *unicode, uint16_t *len);
/**
* @}
- */
+ */
/**
* @}
-*/
+*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
index 20d04183cb..2929bd39b6 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
@@ -2,25 +2,43 @@
******************************************************************************
* @file usbd_def.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief General defines for the usb device library
******************************************************************************
* @attention
*
- *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
+ *
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __USBD_DESC_TEMPLATE_H
+#define __USBD_DESC_TEMPLATE_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "usbd_def.h"
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+#define DEVICE_ID1 (0x1FFF7A10)
+#define DEVICE_ID2 (0x1FFF7A14)
+#define DEVICE_ID3 (0x1FFF7A18)
+
+#define USB_SIZ_STRING_SERIAL 0x1A
+
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+extern USBD_DescriptorsTypeDef XXX_Desc; /* Replace 'XXX_Desc' with your active USB device class, ex: HID_Desc */
+
+#endif /* __USBD_DESC_TEMPLATE_H*/
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
index dbf8ca19ec..ba97a6d7e0 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
@@ -2,28 +2,46 @@
******************************************************************************
* @file usbd_ioreq.h
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief Header file for the usbd_ioreq.c file
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_IOREQ_H
@@ -40,18 +58,18 @@
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
-
+
/** @defgroup USBD_IOREQ
* @brief header file for the usbd_ioreq.c file
* @{
- */
+ */
/** @defgroup USBD_IOREQ_Exported_Defines
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Exported_Types
@@ -61,56 +79,55 @@
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Exported_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Exported_Variables
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
* @{
- */
+ */
-USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
- uint8_t *buf,
+USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
+ uint8_t *pbuf,
uint16_t len);
-USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
+USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
uint8_t *pbuf,
uint16_t len);
-USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
+USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
+ uint8_t *pbuf,
uint16_t len);
-USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
+USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev,
+ uint8_t *pbuf,
uint16_t len);
USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev);
-uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev ,
- uint8_t epnum);
+uint32_t USBD_GetRxCount (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
/**
* @}
- */
+ */
#ifdef __cplusplus
}
@@ -120,9 +137,9 @@ uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev ,
/**
* @}
- */
+ */
/**
* @}
-*/
+*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c
index 613409d9e9..ab32c02039 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c
@@ -2,30 +2,48 @@
******************************************************************************
* @file usbd_conf_template.c
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief USB Device configuration and interface file
* This template should be copied to the user folder, renamed and customized
- * following user needs.
+ * following user needs.
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
/* Includes ------------------------------------------------------------------*/
#include "usbd_core.h"
@@ -41,7 +59,7 @@
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
-{
+{
return USBD_OK;
}
@@ -56,7 +74,7 @@ USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
}
/**
- * @brief Starts the Low Level portion of the Device driver.
+ * @brief Starts the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
@@ -132,7 +150,7 @@ USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
*/
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{
- return USBD_OK;
+ return USBD_OK;
}
/**
@@ -154,7 +172,7 @@ uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
*/
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr)
{
- return USBD_OK;
+ return USBD_OK;
}
/**
@@ -162,10 +180,10 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
* @param pdev: Device handle
* @param ep_addr: Endpoint Number
* @param pbuf: Pointer to data to be sent
- * @param size: Data size
+ * @param size: Data size
* @retval USBD Status
*/
-USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
+USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
uint8_t ep_addr,
uint8_t *pbuf,
uint16_t size)
@@ -181,7 +199,7 @@ USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
* @param size: Data size
* @retval USBD Status
*/
-USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
+USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
uint8_t ep_addr,
uint8_t *pbuf,
uint16_t size)
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
index c31f1f8341..75c5f2091d 100644
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
+++ b/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
@@ -2,25 +2,43 @@
******************************************************************************
* @file usbd_core.c
* @author MCD Application Team
- * @version V2.4.2
- * @date 11-December-2015
* @brief This file provides all the USBD core functions.
******************************************************************************
* @attention
*
- *
*
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * http://www.st.com/software_license_agreement_liberty_v2
+ * 1. Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific written permission.
+ * 4. This software, including modifications and/or derivative works of this
+ * software, must execute solely and exclusively on microcontroller or
+ * microprocessor devices manufactured by or for STMicroelectronics.
+ * 5. Redistribution and use of this software other than as permitted under
+ * this license is void and will automatically terminate your rights under
+ * this license.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
+ * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
+ * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
- */
+ */
/* Includes ------------------------------------------------------------------*/
#include "usbd_ioreq.h"
@@ -33,56 +51,56 @@
*/
-/** @defgroup USBD_IOREQ
+/** @defgroup USBD_IOREQ
* @brief control I/O requests module
* @{
- */
+ */
/** @defgroup USBD_IOREQ_Private_TypesDefinitions
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Private_Defines
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Private_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Private_Variables
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Private_FunctionPrototypes
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_IOREQ_Private_Functions
* @{
- */
+ */
/**
* @brief USBD_CtlSendData
@@ -92,17 +110,17 @@
* @param len: length of data to be sent
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
- uint16_t len)
+USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
+ uint16_t len)
{
/* Set EP0 State */
- pdev->ep0_state = USBD_EP0_DATA_IN;
+ pdev->ep0_state = USBD_EP0_DATA_IN;
pdev->ep_in[0].total_length = len;
pdev->ep_in[0].rem_length = len;
+
/* Start the transfer */
- USBD_LL_Transmit (pdev, 0x00, pbuf, len);
-
+ USBD_LL_Transmit (pdev, 0x00U, pbuf, len);
+
return USBD_OK;
}
@@ -114,13 +132,12 @@ USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
* @param len: length of data to be sent
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
- uint16_t len)
+USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
+ uint8_t *pbuf, uint16_t len)
{
/* Start the next transfer */
- USBD_LL_Transmit (pdev, 0x00, pbuf, len);
-
+ USBD_LL_Transmit (pdev, 0x00U, pbuf, len);
+
return USBD_OK;
}
@@ -132,20 +149,17 @@ USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
* @param len: length of data to be received
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
- uint16_t len)
+USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
+ uint16_t len)
{
/* Set EP0 State */
- pdev->ep0_state = USBD_EP0_DATA_OUT;
+ pdev->ep0_state = USBD_EP0_DATA_OUT;
pdev->ep_out[0].total_length = len;
pdev->ep_out[0].rem_length = len;
+
/* Start the transfer */
- USBD_LL_PrepareReceive (pdev,
- 0,
- pbuf,
- len);
-
+ USBD_LL_PrepareReceive (pdev, 0U, pbuf, len);
+
return USBD_OK;
}
@@ -157,32 +171,28 @@ USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
* @param len: length of data to be received
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev,
- uint8_t *pbuf,
- uint16_t len)
+USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
+ uint16_t len)
{
+ USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
- USBD_LL_PrepareReceive (pdev,
- 0,
- pbuf,
- len);
return USBD_OK;
}
+
/**
* @brief USBD_CtlSendStatus
* send zero lzngth packet on the ctl pipe
* @param pdev: device instance
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev)
+USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev)
{
-
/* Set EP0 State */
pdev->ep0_state = USBD_EP0_STATUS_IN;
-
- /* Start the transfer */
- USBD_LL_Transmit (pdev, 0x00, NULL, 0);
-
+
+ /* Start the transfer */
+ USBD_LL_Transmit(pdev, 0x00U, NULL, 0U);
+
return USBD_OK;
}
@@ -192,21 +202,17 @@ USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev)
* @param pdev: device instance
* @retval status
*/
-USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev)
+USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev)
{
/* Set EP0 State */
- pdev->ep0_state = USBD_EP0_STATUS_OUT;
-
- /* Start the transfer */
- USBD_LL_PrepareReceive ( pdev,
- 0,
- NULL,
- 0);
+ pdev->ep0_state = USBD_EP0_STATUS_OUT;
+
+ /* Start the transfer */
+ USBD_LL_PrepareReceive (pdev, 0U, NULL, 0U);
return USBD_OK;
}
-
/**
* @brief USBD_GetRxCount
* returns the received data length
@@ -214,23 +220,23 @@ USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev)
* @param ep_addr: endpoint address
* @retval Rx Data blength
*/
-uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev , uint8_t ep_addr)
+uint32_t USBD_GetRxCount (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{
return USBD_LL_GetRxDataSize(pdev, ep_addr);
}
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/system/Middlewares/ST/STM32_USB_Device_Library/Release_Notes.html b/system/Middlewares/ST/STM32_USB_Device_Library/Release_Notes.html
deleted file mode 100644
index 4863825308..0000000000
--- a/system/Middlewares/ST/STM32_USB_Device_Library/Release_Notes.html
+++ /dev/null
@@ -1,1267 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Release Notes for STM32 USB Device Library
-
-
-
-
-
-
-
-
-
usbd_cdc.c: change #include "USBD_CDC.h" by #include "usbd_cdc.h"
-
-
-
-
V2.4.1 / 19-June-2015
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
CDC Class
-
-
usbd_cdc.c: comments update
-
-
MSC Class
-
-
usbd_msc_bot.h: update to be C++ compliant
-
-
AUDIO Class
-
-
usbd_audio.c: fix issue when Host sends GetInterface command it gets a wrong value
-
-
-
usbd_audio.c: remove useless management of DMA half transfer
-
-
-
-
-
-
-
V2.4.0 / 28-February-2015
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Core Driver
-
-
Add support of Link Power Management (LPM): add new API GetBOSDescriptor(), that is used only if USBD_LPM_ENABLED switch is enabled in usbd_conf.h file
usbd_core.c:
-Fix bug of unsupported premature Host Out stage during data In stage
-(ie. when endpoint 0 maximum data size is 8 and Host requests
-GetDeviceDescriptor for the first time)
usbd_ctlreq.c: Fix bug of unsupported Endpoint Class requests (ie. Audio SetCurrent request for endpoint sampling rate setting)
-
-
HID Class
-
-
Updating Polling time API USBD_HID_GetPollingInterval() to query this period for HS and FS
usbd_hid.c: Fix USBD_LL_CloseEP() function call in USBD_HID_DeInit() replacing endpoint size by endpoint address.
-
CDC Class
usbd_cdc.c:
Add missing GetInterface request management in USBD_CDC_Setup() function
Update
-USBD_CDC_Setup() function to allow correct user implementation of
-CDC_SET_CONTROL_LINE_STATE and similar no-data setup requests.
-
-
-
V2.3.0 / 04-November-2014
-
-
-
-
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Update all drivers to be C++ compliant
-
-
CDC Class
-
-
usbd_cdc.c: fix clear flag issue in USBD_CDC_TransmitPacket() function
-
-
-
usbd_cdc_if_template.c: update TEMPLATE_Receive() function header comment
-
-
-
Miscellaneous source code comments update
-
-
V2.2.0 / 13-June-2014
-
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Source code comments review and update
-
HID class
-
-
Remove unused API USBD_HID_DeviceQualifierDescriptor()
-
Add a new API in the HID class to query the poll time USBD_HID_GetPollingInterval()
-
Add alias for the class definition, it's defined as macro with capital letter
-
-
-
ex. for the HID, the USBD_HID_CLASS macro is defined this way #define USBD_HID_CLASS &USBD_HID and the application code can use the previous definition: &USBD_HID ex. USBD_RegisterClass(&USBD_Device, &USBD_HID) or the new USBD_HID_CLASS ex. USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS)
-
V2.1.0 / 22-April-2014
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
usbd_conf_template.c: update file with the right content (it was using MSC memory management layer)
-
-
usbd_conf_template.h: change include of stm32f4xx.h by stm32xxx.h and add comment to inform user to adapt it to the device used
-
Several enhancements in CustomHID class
-
-
Update the Custom HID class driver to simplify the link with user processes
-
Optimize the Custom HID class driver and reduce footprint
-
Add USBD_CUSTOM_HID_RegisterInterface() API to link user process to custom HID class
Major update
-based on STM32Cube specification: Library Core, Classes architecture and APIs
-modified vs. V1.1.0, and thus the 2 versions are not compatible.
-
This version has to be used only with STM32Cube based development
-
-
-
-
V1.1.0 / 19-March-2012
-
Main
-Changes
-
-
Official support of STM32F4xx devices
All source files: license disclaimer text update and add link to the License file on ST Internet.
Handle test mode in the set feature request
Handle dynamically the USB SELF POWERED feature
Handle correctly the USBD_CtlError process to take into account error during Control OUT stage
Miscellaneous bug fix
V1.0.0 / 22-July-2011
Main
-Changes
-
First official version for STM32F105/7xx and STM32F2xx devices
-
License
-
Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:
Unless
-required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
-the License for the specific language governing permissions and
-limitations under the License.
-
-
-
-
For
- complete documentation on STM32
- Microcontrollers visit www.st.com/STM32
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/system/Middlewares/ST/STM32_USB_Host_Library/Release_Notes.html b/system/Middlewares/ST/STM32_USB_Host_Library/Release_Notes.html
deleted file mode 100644
index ce52ddfa14..0000000000
--- a/system/Middlewares/ST/STM32_USB_Host_Library/Release_Notes.html
+++ /dev/null
@@ -1,1194 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-Release Notes for STM32 USB Host Library
-
-
-
-
-
-
-
-
-
-
usbh_def.h:
-update USBH_MAX_PIPES_NBR literal definition to be conditioned by
-#ifndef directive, to allow application code to change its value (i.e.
-in the compiler preprocessor)
-
-
-
MSC Class
-
-
usbh_msc.c
-
-
Update USBH_MSC_GetMaxLUN() to return the correct number of supported LUNs (was returning 0xFF)
-
Fix timeout calculation issue
-
-
-
-
-
usbh_msc.h:
-update MAX_SUPPORTED_LUN literal definition to be conditioned by
-#ifndef directive, to allow application code to change its value
-(i.e.in the compiler preprocessor)
-
-
HID Class
-
-
usbh_hid.h: fix HID's handle “timer” type to uint32_t instead of uint16_t
-
MTP Class
-
-
usbh_mtp.c : Fix timeout calculation issue
-
-
-
-
-
-
-
V3.2.0 / 04-November-2014
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Update all drivers to be C++ compliant
-
-
Core driver
-
-
usbh_core.c: remove HOST_IDLE state in USBH_LL_Connect() function
-
-
-
MSC class
-
-
Update to manage correctly older USB Keys that do not support GetMaxLun request
-
-
Miscellaneous source code comments update
-
-
-
V3.1.0 / 19-June-2014
-
-
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
-
-
Core driver
-
-
Add a new define USBH_PROCESS_STACK_SIZE in the usbh_conf.h
-file to change the default internal USB host process stack. Note that
-by omitting this define, the default stack size (2KB) is used
-
-
Add a user callback to handle unrecoverable error case in the application
-
-
-
Remove the wrong check on the interface descriptor index in the USBH_FindInterface() function
-
-
-
All classes
-
-
Update class description in files comment by adding reference to the used USB class specification revision
-
-
Audio, CDC and MTP classes
-
-
-
Add full RTOS support by handling state transitions through OS messages
-
-
-
HID class
-
-
Add new API USBH_HID_GetPollInterval() to allow user to retrieve the needed poll time (interval between two USBD_HID_SendReport())
-
-
Audio class
-
-
Add a new weak callback USBH_AUDIO_BufferEmptyCallback() to indicate the end of audio data processing on the user buffer
-
-
MSC class
-
-
Return mass storage device capacity in Bytes in the user log message instead of MBytes
-
-
-
-
-
-
V3.0.0 / 18-February-2014
-
-
-
-
Main
-Changes
-
-
-
-
-
-
-
-
-
Major update
-based on STM32Cube specification: Library Core, Classes architecture and APIs
-modified vs. V2.1.0, and thus the 2 versions are not compatible.
-
-
This version has to be used only with STM32Cube based development
-
-
V2.1.0 / 19-March-2012
-
Main
-Changes
-
-
Official support of STM32F4xx devices
All source files: license disclaimer text update and add link to the License file on ST Internet
Add ISR structure to link the low level driver to the Host library
Change length parameter in the I/O operations to handle large amount of data
Enhance the configuration descriptor parsing method to take into account multi interface devices
HID class
Remove blocking even frame synchronization loop
MSC class
Handle correctly the BOT transfer with length < max length
Handle multi sector length data in the FAT FS interface
Miscellaneous bug fix
V2.0.0 / 22-July-2011
Main
-Changes
-
Second official version supporting STM32F105/7 and STM32F2xx devices
Add support for STM32F2xx devices
Add multi interface feature
Add dynamic configuration parsing
Add
-USBH_DeAllocate_AllChannel function in the Host channel management
-layer to clean up channels allocation table when de-initializing the
-library
Change the core layer to stop correctly the host core and free all allocated channels
Add usbh_conf.h file in the application layer to customize some user parameters
V1.0.0 - 11/29/2010
-
Created
License
-
Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:
Unless
-required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
-the License for the specific language governing permissions and
-limitations under the License.
-
-
-
-
For
- complete documentation on STM32
- Microcontrollers visit www.st.com/STM32
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/variants/REMRAM_V1/usb/usbd_conf.c b/variants/REMRAM_V1/usb/usbd_conf.c
index d4c9e69281..860d8f3b06 100644
--- a/variants/REMRAM_V1/usb/usbd_conf.c
+++ b/variants/REMRAM_V1/usb/usbd_conf.c
@@ -1,537 +1,538 @@
-/**
- ******************************************************************************
- * @file USB_Device/HID_Standalone/Src/usbd_conf.c
- * @author MCD Application Team
- * @version V1.0.2
- * @date 06-May-2016
- * @brief This file implements the USB Device library callbacks and MSP
- ******************************************************************************
- * @attention
- *
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted, provided that the following conditions are met:
- *
- * 1. Redistribution of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific written permission.
- * 4. This software, including modifications and/or derivative works of this
- * software, must execute solely and exclusively on microcontroller or
- * microprocessor devices manufactured by or for STMicroelectronics.
- * 5. Redistribution and use of this software other than as permitted under
- * this license is void and will automatically terminate your rights under
- * this license.
- *
- * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
- * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
- * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
+ ******************************************************************************
+ * @file usbd_conf.h
+ * @author MCD Application Team
+ * @version V1.0.2
+ * @date 06-May-2016
+ * @brief General low level driver configuration
+ ******************************************************************************
+ * @attention
+ *
+ *