added stuff
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
Index: Inc/stm32f1xx_hal_conf.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/stm32f1xx_hal_conf.h (date 1511203976000)
|
||||
+++ Inc/stm32f1xx_hal_conf.h (revision )
|
||||
@@ -147,13 +147,6 @@
|
||||
#define USE_RTOS 0
|
||||
#define PREFETCH_ENABLE 1
|
||||
|
||||
-/* ########################## Assert Selection ############################## */
|
||||
-/**
|
||||
- * @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
- * HAL drivers code
|
||||
- */
|
||||
- #define USE_FULL_ASSERT 1U
|
||||
-
|
||||
/* ################## Ethernet peripheral configuration ##################### */
|
||||
|
||||
/* Section 1 : Ethernet peripheral configuration */
|
||||
@@ -341,21 +334,7 @@
|
||||
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
-#ifdef USE_FULL_ASSERT
|
||||
-/**
|
||||
- * @brief The assert_param macro is used for function's parameters check.
|
||||
- * @param expr: If expr is false, it calls assert_failed function
|
||||
- * which reports the name of the source file and the source
|
||||
- * line number of the call that failed.
|
||||
- * If expr is true, it returns no value.
|
||||
- * @retval None
|
||||
- */
|
||||
- #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
-/* Exported functions ------------------------------------------------------- */
|
||||
- void assert_failed(uint8_t* file, uint32_t line);
|
||||
-#else
|
||||
- #define assert_param(expr) ((void)0U)
|
||||
-#endif /* USE_FULL_ASSERT */
|
||||
+#include "stm32_assert.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
Index: Inc/main.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/main.h (date 1511207348000)
|
||||
+++ Inc/main.h (revision )
|
||||
@@ -58,26 +58,12 @@
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
-/**
|
||||
- * @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
- * HAL drivers code
|
||||
- */
|
||||
- #define USE_FULL_ASSERT 1U
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
#include "stm32_assert.h"
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
-#ifdef __cplusplus
|
||||
- extern "C" {
|
||||
-#endif
|
||||
-void _Error_Handler(char *, int);
|
||||
-
|
||||
-#define Error_Handler() _Error_Handler(__FILE__, __LINE__)
|
||||
-#ifdef __cplusplus
|
||||
-}
|
||||
-#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
Index: Src/main.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Src/main.c (date 1511207348000)
|
||||
+++ Src/main.c (revision )
|
||||
@@ -212,40 +212,7 @@
|
||||
/* USER CODE END Callback 1 */
|
||||
}
|
||||
|
||||
-/**
|
||||
- * @brief This function is executed in case of error occurrence.
|
||||
- * @param None
|
||||
- * @retval None
|
||||
- */
|
||||
-void _Error_Handler(char * file, int line)
|
||||
-{
|
||||
- /* USER CODE BEGIN Error_Handler_Debug */
|
||||
- /* User can add his own implementation to report the HAL error return state */
|
||||
- while(1)
|
||||
- {
|
||||
- }
|
||||
- /* USER CODE END Error_Handler_Debug */
|
||||
-}
|
||||
|
||||
-#ifdef USE_FULL_ASSERT
|
||||
-
|
||||
-/**
|
||||
- * @brief Reports the name of the source file and the source line number
|
||||
- * where the assert_param error has occurred.
|
||||
- * @param file: pointer to the source file name
|
||||
- * @param line: assert_param error line source number
|
||||
- * @retval None
|
||||
- */
|
||||
-void assert_failed(uint8_t* file, uint32_t line)
|
||||
-{
|
||||
- /* USER CODE BEGIN 6 */
|
||||
- /* User can add his own implementation to report the file name and line number,
|
||||
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
- /* USER CODE END 6 */
|
||||
-
|
||||
-}
|
||||
-
|
||||
-#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -0,0 +1,60 @@
|
||||
Index: Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h (revision 58248b7c8c9be227130e4b1e5eed906708cf110b)
|
||||
+++ Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h (revision )
|
||||
@@ -118,8 +118,8 @@
|
||||
PCD_TypeDef *Instance; /*!< Register base address */
|
||||
PCD_InitTypeDef Init; /*!< PCD required parameters */
|
||||
__IO uint8_t USB_Address; /*!< USB Address: not used by USB OTG FS */
|
||||
- PCD_EPTypeDef IN_ep[16]; /*!< IN endpoint parameters */
|
||||
- PCD_EPTypeDef OUT_ep[16]; /*!< OUT endpoint parameters */
|
||||
+ PCD_EPTypeDef IN_ep[USBD_NUM_ENDPOINTS+1]; /*!< IN endpoint parameters */
|
||||
+ PCD_EPTypeDef OUT_ep[USBD_NUM_ENDPOINTS+1]; /*!< OUT endpoint parameters */
|
||||
HAL_LockTypeDef Lock; /*!< PCD peripheral status */
|
||||
__IO PCD_StateTypeDef State; /*!< PCD communication state */
|
||||
uint32_t Setup[12U]; /*!< Setup packet buffer */
|
||||
Index: Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c (revision 58248b7c8c9be227130e4b1e5eed906708cf110b)
|
||||
+++ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c (revision )
|
||||
@@ -181,7 +181,7 @@
|
||||
USB_SetCurrentMode(hpcd->Instance , USB_DEVICE_MODE);
|
||||
|
||||
/* Init endpoints structures */
|
||||
- for (index = 0U; index < 15U ; index++)
|
||||
+ for (index = 0U; index < USBD_NUM_ENDPOINTS ; index++)
|
||||
{
|
||||
/* Init ep structure */
|
||||
hpcd->IN_ep[index].is_in = 1U;
|
||||
@@ -194,7 +194,7 @@
|
||||
hpcd->IN_ep[index].xfer_len = 0U;
|
||||
}
|
||||
|
||||
- for (index = 0U; index < 15U ; index++)
|
||||
+ for (index = 0U; index < USBD_NUM_ENDPOINTS ; index++)
|
||||
{
|
||||
hpcd->OUT_ep[index].is_in = 0U;
|
||||
hpcd->OUT_ep[index].num = index;
|
||||
Index: Inc/stm32f1xx_hal_conf.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/stm32f1xx_hal_conf.h (revision 58248b7c8c9be227130e4b1e5eed906708cf110b)
|
||||
+++ Inc/stm32f1xx_hal_conf.h (revision )
|
||||
@@ -44,6 +44,9 @@
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
+// XXX CUSTOM CONSTANTS
|
||||
+#define USBD_NUM_ENDPOINTS 3 // max 15
|
||||
+
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
@@ -0,0 +1,39 @@
|
||||
Index: Src/stm32f1xx_hal_msp.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Src/stm32f1xx_hal_msp.c (revision f2861f336546d616161007943aa21fe1560c91b0)
|
||||
+++ Src/stm32f1xx_hal_msp.c (revision )
|
||||
@@ -49,7 +49,6 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
-extern void _Error_Handler(char *, int);
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
Index: Inc/usb.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/usb.h (revision f2861f336546d616161007943aa21fe1560c91b0)
|
||||
+++ Inc/usb.h (revision )
|
||||
@@ -56,6 +56,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "main.h"
|
||||
+#include "stm32_assert.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
@@ -67,8 +68,6 @@
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
-extern void _Error_Handler(char *, int);
|
||||
-
|
||||
void MX_USB_PCD_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
@@ -0,0 +1,31 @@
|
||||
Index: Inc/i2c.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/i2c.h (date 1511220966000)
|
||||
+++ Inc/i2c.h (revision )
|
||||
@@ -67,7 +67,6 @@
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
-extern void _Error_Handler(char *, int);
|
||||
|
||||
void MX_I2C1_Init(void);
|
||||
|
||||
Index: Inc/spi.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Inc/spi.h (date 1511220966000)
|
||||
+++ Inc/spi.h (revision )
|
||||
@@ -67,8 +67,6 @@
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
-extern void _Error_Handler(char *, int);
|
||||
-
|
||||
void MX_SPI1_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
@@ -0,0 +1,16 @@
|
||||
Index: Makefile
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Makefile (date 1512425387000)
|
||||
+++ Makefile (revision )
|
||||
@@ -13,7 +13,7 @@
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
-TARGET = gex_f103
|
||||
+TARGET = firmware
|
||||
|
||||
|
||||
######################################
|
||||
@@ -0,0 +1,607 @@
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc.h (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc.h (revision )
|
||||
@@ -58,9 +58,10 @@
|
||||
#define BOT_RESET 0xFF
|
||||
#define USB_MSC_CONFIG_DESC_SIZ 32
|
||||
|
||||
-
|
||||
+#ifndef MSC_CUSTOM_EPS
|
||||
#define MSC_EPIN_ADDR 0x81
|
||||
-#define MSC_EPOUT_ADDR 0x01
|
||||
+#define MSC_EPOUT_ADDR 0x01
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -107,7 +108,7 @@
|
||||
USBD_MSC_BOT_HandleTypeDef;
|
||||
|
||||
/* Structure for MSC process */
|
||||
-extern USBD_ClassTypeDef USBD_MSC;
|
||||
+extern USBD_ClassTypeDef USBD_MSC;
|
||||
#define USBD_MSC_CLASS &USBD_MSC
|
||||
|
||||
uint8_t USBD_MSC_RegisterStorage (USBD_HandleTypeDef *pdev,
|
||||
@@ -118,8 +119,34 @@
|
||||
|
||||
/**
|
||||
* @}
|
||||
- */
|
||||
+ */
|
||||
|
||||
+// XXX "static" moved here for use in composite driver
|
||||
+
|
||||
+uint8_t USBD_MSC_Init (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t cfgidx);
|
||||
+
|
||||
+uint8_t USBD_MSC_DeInit (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t cfgidx);
|
||||
+
|
||||
+uint8_t USBD_MSC_Setup (USBD_HandleTypeDef *pdev,
|
||||
+ USBD_SetupReqTypedef *req);
|
||||
+
|
||||
+uint8_t USBD_MSC_DataIn (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t epnum);
|
||||
+
|
||||
+
|
||||
+uint8_t USBD_MSC_DataOut (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t epnum);
|
||||
+
|
||||
+uint8_t *USBD_MSC_GetHSCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_MSC_GetFSCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_MSC_GetOtherSpeedCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_MSC_GetDeviceQualifierDescriptor (uint16_t *length);
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h (revision )
|
||||
@@ -48,10 +48,12 @@
|
||||
|
||||
/** @defgroup usbd_cdc_Exported_Defines
|
||||
* @{
|
||||
- */
|
||||
+ */
|
||||
+#ifndef CDC_CUSTOM_EPS
|
||||
#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 */
|
||||
+#endif
|
||||
|
||||
/* 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 */
|
||||
@@ -159,9 +161,38 @@
|
||||
uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev);
|
||||
|
||||
uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
|
||||
+
|
||||
+void USBD_CDC_TransmitDone (USBD_HandleTypeDef *pdev);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
+
|
||||
+// XXX exported "static" for composite driver
|
||||
+uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t cfgidx);
|
||||
+
|
||||
+uint8_t USBD_CDC_DeInit (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t cfgidx);
|
||||
+
|
||||
+uint8_t USBD_CDC_Setup (USBD_HandleTypeDef *pdev,
|
||||
+ USBD_SetupReqTypedef *req);
|
||||
+
|
||||
+uint8_t USBD_CDC_DataIn (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t epnum);
|
||||
+
|
||||
+uint8_t USBD_CDC_DataOut (USBD_HandleTypeDef *pdev,
|
||||
+ uint8_t epnum);
|
||||
+
|
||||
+uint8_t USBD_CDC_EP0_RxReady (USBD_HandleTypeDef *pdev);
|
||||
+
|
||||
+uint8_t *USBD_CDC_GetFSCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_CDC_GetHSCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_CDC_GetOtherSpeedCfgDesc (uint16_t *length);
|
||||
+
|
||||
+uint8_t *USBD_CDC_GetDeviceQualifierDescriptor (uint16_t *length);
|
||||
+
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h (revision )
|
||||
@@ -99,6 +99,7 @@
|
||||
#define USB_DESC_TYPE_ENDPOINT 5
|
||||
#define USB_DESC_TYPE_DEVICE_QUALIFIER 6
|
||||
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
|
||||
+#define USB_DESC_TYPE_IFACE_ASSOCIATION 11
|
||||
#define USB_DESC_TYPE_BOS 0x0F
|
||||
|
||||
#define USB_CONFIG_REMOTE_WAKEUP 2
|
||||
@@ -147,7 +148,7 @@
|
||||
|
||||
typedef struct usb_setup_req
|
||||
{
|
||||
-
|
||||
+
|
||||
uint8_t bmRequest;
|
||||
uint8_t bRequest;
|
||||
uint16_t wValue;
|
||||
@@ -230,7 +231,7 @@
|
||||
uint32_t dev_config_status;
|
||||
USBD_SpeedTypeDef dev_speed;
|
||||
USBD_EndpointTypeDef ep_in[15];
|
||||
- USBD_EndpointTypeDef ep_out[15];
|
||||
+ USBD_EndpointTypeDef ep_out[15];
|
||||
uint32_t ep0_state;
|
||||
uint32_t ep0_data_len;
|
||||
uint8_t dev_state;
|
||||
@@ -242,10 +243,14 @@
|
||||
|
||||
USBD_SetupReqTypedef request;
|
||||
USBD_DescriptorsTypeDef *pDesc;
|
||||
- USBD_ClassTypeDef *pClass;
|
||||
- void *pClassData;
|
||||
- void *pUserData;
|
||||
- void *pData;
|
||||
+ USBD_ClassTypeDef *pClass; // the composite class
|
||||
+ void *pClassData;
|
||||
+ void *pUserData;
|
||||
+ void *pClassData2; // used for secondary class
|
||||
+ void *pUserData2; // used for secondary class
|
||||
+ void *pClassData3; // used for tertiary class
|
||||
+ void *pUserData3; // used for tertiary class
|
||||
+ void *pData; // this is a pointer to the low level registers struct
|
||||
} USBD_HandleTypeDef;
|
||||
|
||||
/**
|
||||
@@ -262,8 +267,14 @@
|
||||
|
||||
#define LOBYTE(x) ((uint8_t)(x & 0x00FF))
|
||||
#define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8))
|
||||
+
|
||||
+#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
+#endif
|
||||
+
|
||||
+#ifndef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
+#endif
|
||||
|
||||
|
||||
#if defined ( __GNUC__ )
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c (revision )
|
||||
@@ -59,6 +59,7 @@
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
+#include "usbd_msc.h" // for rejecting bad control messages
|
||||
#include "usbd_cdc.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_ctlreq.h"
|
||||
@@ -103,34 +104,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
-
|
||||
-static uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev,
|
||||
- uint8_t cfgidx);
|
||||
-
|
||||
-static uint8_t USBD_CDC_DeInit (USBD_HandleTypeDef *pdev,
|
||||
- uint8_t cfgidx);
|
||||
-
|
||||
-static uint8_t USBD_CDC_Setup (USBD_HandleTypeDef *pdev,
|
||||
- USBD_SetupReqTypedef *req);
|
||||
-
|
||||
-static uint8_t USBD_CDC_DataIn (USBD_HandleTypeDef *pdev,
|
||||
- uint8_t epnum);
|
||||
-
|
||||
-static uint8_t USBD_CDC_DataOut (USBD_HandleTypeDef *pdev,
|
||||
- uint8_t epnum);
|
||||
-
|
||||
-static uint8_t USBD_CDC_EP0_RxReady (USBD_HandleTypeDef *pdev);
|
||||
-
|
||||
-static uint8_t *USBD_CDC_GetFSCfgDesc (uint16_t *length);
|
||||
-
|
||||
-static uint8_t *USBD_CDC_GetHSCfgDesc (uint16_t *length);
|
||||
-
|
||||
-static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc (uint16_t *length);
|
||||
-
|
||||
-static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc (uint16_t *length);
|
||||
-
|
||||
-uint8_t *USBD_CDC_GetDeviceQualifierDescriptor (uint16_t *length);
|
||||
-
|
||||
+#ifndef CDC_COMPOSITE
|
||||
/* USB Standard Device Descriptor */
|
||||
__ALIGN_BEGIN static uint8_t USBD_CDC_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END =
|
||||
{
|
||||
@@ -156,7 +130,7 @@
|
||||
|
||||
|
||||
/* CDC interface class callbacks structure */
|
||||
-USBD_ClassTypeDef USBD_CDC =
|
||||
+USBD_ClassTypeDef USBD_CDC =
|
||||
{
|
||||
USBD_CDC_Init,
|
||||
USBD_CDC_DeInit,
|
||||
@@ -172,6 +146,7 @@
|
||||
USBD_CDC_GetFSCfgDesc,
|
||||
USBD_CDC_GetOtherSpeedCfgDesc,
|
||||
USBD_CDC_GetDeviceQualifierDescriptor,
|
||||
+ NULL
|
||||
};
|
||||
|
||||
/* USB CDC device Configuration Descriptor */
|
||||
@@ -456,6 +431,7 @@
|
||||
0x00,
|
||||
0x00 /* bInterval */
|
||||
};
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -463,7 +439,7 @@
|
||||
|
||||
/** @defgroup USBD_CDC_Private_Functions
|
||||
* @{
|
||||
- */
|
||||
+ */
|
||||
|
||||
/**
|
||||
* @brief USBD_CDC_Init
|
||||
@@ -472,7 +448,7 @@
|
||||
* @param cfgidx: Configuration index
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev,
|
||||
+uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev,
|
||||
uint8_t cfgidx)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
@@ -514,18 +490,18 @@
|
||||
CDC_CMD_PACKET_SIZE);
|
||||
|
||||
|
||||
- pdev->pClassData = USBD_malloc(sizeof (USBD_CDC_HandleTypeDef));
|
||||
+ pdev->pClassData2 = USBD_malloc(sizeof (USBD_CDC_HandleTypeDef));
|
||||
|
||||
- if(pdev->pClassData == NULL)
|
||||
+ if(pdev->pClassData2 == NULL)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
- hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
/* Init physical Interface components */
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Init();
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->Init();
|
||||
|
||||
/* Init Xfer states */
|
||||
hcdc->TxState =0;
|
||||
@@ -560,7 +536,7 @@
|
||||
* @param cfgidx: Configuration index
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_DeInit (USBD_HandleTypeDef *pdev,
|
||||
+uint8_t USBD_CDC_DeInit (USBD_HandleTypeDef *pdev,
|
||||
uint8_t cfgidx)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
@@ -579,11 +555,11 @@
|
||||
|
||||
|
||||
/* DeInit physical Interface components */
|
||||
- if(pdev->pClassData != NULL)
|
||||
+ if(pdev->pClassData2 != NULL)
|
||||
{
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->DeInit();
|
||||
- USBD_free(pdev->pClassData);
|
||||
- pdev->pClassData = NULL;
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->DeInit();
|
||||
+ USBD_free(pdev->pClassData2);
|
||||
+ pdev->pClassData2 = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -596,20 +572,23 @@
|
||||
* @param req: usb requests
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_Setup (USBD_HandleTypeDef *pdev,
|
||||
+uint8_t USBD_CDC_Setup (USBD_HandleTypeDef *pdev,
|
||||
USBD_SetupReqTypedef *req)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
static uint8_t ifalt = 0;
|
||||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
case USB_REQ_TYPE_CLASS :
|
||||
+ if (req->bRequest == BOT_GET_MAX_LUN) break; // Not ours!
|
||||
+ if (req->bRequest == BOT_RESET) break; // Not ours!
|
||||
+
|
||||
if (req->wLength)
|
||||
{
|
||||
if (req->bmRequest & 0x80)
|
||||
{
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->Control(req->bRequest,
|
||||
(uint8_t *)hcdc->data,
|
||||
req->wLength);
|
||||
USBD_CtlSendData (pdev,
|
||||
@@ -629,7 +608,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->Control(req->bRequest,
|
||||
(uint8_t*)req,
|
||||
0);
|
||||
}
|
||||
@@ -661,14 +640,15 @@
|
||||
* @param epnum: endpoint number
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_DataIn (USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
+uint8_t USBD_CDC_DataIn (USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
- if(pdev->pClassData != NULL)
|
||||
+ if(pdev->pClassData2 != NULL)
|
||||
{
|
||||
|
||||
hcdc->TxState = 0;
|
||||
+ USBD_CDC_TransmitDone(pdev);
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
@@ -685,18 +665,18 @@
|
||||
* @param epnum: endpoint number
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
+uint8_t USBD_CDC_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
/* Get the received data length */
|
||||
hcdc->RxLength = USBD_LL_GetRxDataSize (pdev, epnum);
|
||||
|
||||
/* USB data will be immediately processed, this allow next USB traffic being
|
||||
NAKed till the end of the application Xfer */
|
||||
- if(pdev->pClassData != NULL)
|
||||
+ if(pdev->pClassData2 != NULL)
|
||||
{
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Receive(hcdc->RxBuffer, &hcdc->RxLength);
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->Receive(hcdc->RxBuffer, &hcdc->RxLength);
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
@@ -715,13 +695,13 @@
|
||||
* @param epnum: endpoint number
|
||||
* @retval status
|
||||
*/
|
||||
-static uint8_t USBD_CDC_EP0_RxReady (USBD_HandleTypeDef *pdev)
|
||||
+uint8_t USBD_CDC_EP0_RxReady (USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
- if((pdev->pUserData != NULL) && (hcdc->CmdOpCode != 0xFF))
|
||||
+ if((pdev->pUserData2 != NULL) && (hcdc->CmdOpCode != 0xFF))
|
||||
{
|
||||
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(hcdc->CmdOpCode,
|
||||
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData2)->Control(hcdc->CmdOpCode,
|
||||
(uint8_t *)hcdc->data,
|
||||
hcdc->CmdLength);
|
||||
hcdc->CmdOpCode = 0xFF;
|
||||
@@ -730,6 +710,7 @@
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
+#ifndef CDC_COMPOSITE
|
||||
/**
|
||||
* @brief USBD_CDC_GetFSCfgDesc
|
||||
* Return configuration descriptor
|
||||
@@ -737,7 +718,7 @@
|
||||
* @param length : pointer data length
|
||||
* @retval pointer to descriptor buffer
|
||||
*/
|
||||
-static uint8_t *USBD_CDC_GetFSCfgDesc (uint16_t *length)
|
||||
+uint8_t *USBD_CDC_GetFSCfgDesc (uint16_t *length)
|
||||
{
|
||||
*length = sizeof (USBD_CDC_CfgFSDesc);
|
||||
return USBD_CDC_CfgFSDesc;
|
||||
@@ -750,7 +731,7 @@
|
||||
* @param length : pointer data length
|
||||
* @retval pointer to descriptor buffer
|
||||
*/
|
||||
-static uint8_t *USBD_CDC_GetHSCfgDesc (uint16_t *length)
|
||||
+uint8_t *USBD_CDC_GetHSCfgDesc (uint16_t *length)
|
||||
{
|
||||
*length = sizeof (USBD_CDC_CfgHSDesc);
|
||||
return USBD_CDC_CfgHSDesc;
|
||||
@@ -763,7 +744,7 @@
|
||||
* @param length : pointer data length
|
||||
* @retval pointer to descriptor buffer
|
||||
*/
|
||||
-static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc (uint16_t *length)
|
||||
+uint8_t *USBD_CDC_GetOtherSpeedCfgDesc (uint16_t *length)
|
||||
{
|
||||
*length = sizeof (USBD_CDC_OtherSpeedCfgDesc);
|
||||
return USBD_CDC_OtherSpeedCfgDesc;
|
||||
@@ -780,6 +761,7 @@
|
||||
*length = sizeof (USBD_CDC_DeviceQualifierDesc);
|
||||
return USBD_CDC_DeviceQualifierDesc;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* @brief USBD_CDC_RegisterInterface
|
||||
@@ -794,7 +776,7 @@
|
||||
|
||||
if(fops != NULL)
|
||||
{
|
||||
- pdev->pUserData= fops;
|
||||
+ pdev->pUserData2= fops;
|
||||
ret = USBD_OK;
|
||||
}
|
||||
|
||||
@@ -811,7 +793,7 @@
|
||||
uint8_t *pbuff,
|
||||
uint16_t length)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
hcdc->TxBuffer = pbuff;
|
||||
hcdc->TxLength = length;
|
||||
@@ -829,7 +811,7 @@
|
||||
uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev,
|
||||
uint8_t *pbuff)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
hcdc->RxBuffer = pbuff;
|
||||
|
||||
@@ -845,9 +827,9 @@
|
||||
*/
|
||||
uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
- if(pdev->pClassData != NULL)
|
||||
+ if(pdev->pClassData2 != NULL)
|
||||
{
|
||||
if(hcdc->TxState == 0)
|
||||
{
|
||||
@@ -882,10 +864,10 @@
|
||||
*/
|
||||
uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
- USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData;
|
||||
+ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) pdev->pClassData2;
|
||||
|
||||
/* Suspend or Resume USB Out process */
|
||||
- if(pdev->pClassData != NULL)
|
||||
+ if(pdev->pClassData2 != NULL)
|
||||
{
|
||||
if(pdev->dev_speed == USBD_SPEED_HIGH )
|
||||
{
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c (revision )
|
||||
@@ -116,7 +116,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
-
|
||||
+#ifndef MSC_COMPOSITE
|
||||
USBD_ClassTypeDef USBD_MSC =
|
||||
{
|
||||
USBD_MSC_Init,
|
||||
@@ -279,6 +279,7 @@
|
||||
0x01,
|
||||
0x00,
|
||||
};
|
||||
+#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -530,6 +531,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifndef MSC_COMPOSITE
|
||||
/**
|
||||
* @brief USBD_MSC_GetHSCfgDesc
|
||||
* return configuration descriptor
|
||||
@@ -576,6 +578,7 @@
|
||||
*length = sizeof (USBD_MSC_DeviceQualifierDesc);
|
||||
return USBD_MSC_DeviceQualifierDesc;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* @brief USBD_MSC_RegisterStorage
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c (date 1511202099000)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c (revision )
|
||||
@@ -190,14 +190,27 @@
|
||||
INVALID_CDB);
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- if(((USBD_StorageTypeDef *)pdev->pUserData)->IsReady(lun) !=0 )
|
||||
+
|
||||
+ // XXX THIS SECTION IS MODIFIED FOR NOTIFY!
|
||||
+ // https://www.microchip.com/forums/m401735.aspx
|
||||
+ int8_t changeStatus = ((USBD_StorageTypeDef *)pdev->pUserData)->IsReady(lun);
|
||||
+ if(changeStatus != 0)
|
||||
{
|
||||
- SCSI_SenseCode(pdev,
|
||||
- lun,
|
||||
- NOT_READY,
|
||||
- MEDIUM_NOT_PRESENT);
|
||||
-
|
||||
+ if (changeStatus == -1)
|
||||
+ {
|
||||
+ SCSI_SenseCode(pdev,
|
||||
+ lun,
|
||||
+ UNIT_ATTENTION,
|
||||
+ MEDIUM_HAVE_CHANGED);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ SCSI_SenseCode(pdev,
|
||||
+ lun,
|
||||
+ NOT_READY,
|
||||
+ MEDIUM_NOT_PRESENT);
|
||||
+ }
|
||||
+
|
||||
hmsc->bot_state = USBD_BOT_NO_DATA;
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h (revision 58248b7c8c9be227130e4b1e5eed906708cf110b)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h (revision )
|
||||
@@ -230,8 +230,8 @@
|
||||
uint32_t dev_default_config;
|
||||
uint32_t dev_config_status;
|
||||
USBD_SpeedTypeDef dev_speed;
|
||||
- USBD_EndpointTypeDef ep_in[15];
|
||||
- USBD_EndpointTypeDef ep_out[15];
|
||||
+ USBD_EndpointTypeDef ep_in[USBD_NUM_ENDPOINTS];
|
||||
+ USBD_EndpointTypeDef ep_out[USBD_NUM_ENDPOINTS];
|
||||
uint32_t ep0_state;
|
||||
uint32_t ep0_data_len;
|
||||
uint8_t dev_state;
|
||||
Index: Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h (revision 58248b7c8c9be227130e4b1e5eed906708cf110b)
|
||||
+++ Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h (revision )
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
- uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */
|
||||
+ uint32_t data[CDC_DATA_FS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */
|
||||
uint8_t CmdOpCode;
|
||||
uint8_t CmdLength;
|
||||
uint8_t *RxBuffer;
|
||||
Reference in New Issue
Block a user