File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747
4848/* Includes ------------------------------------------------------------------*/
4949#include "stm32f4xx_hal.h"
50- #include "usbd_cdc .h"
50+ #include "usbd_cdc_msc .h"
5151#include "usbd_cdc_interface.h"
5252
5353/** @addtogroup STM32F4xx_HAL_Driver
Original file line number Diff line number Diff line change 2828/* Includes ------------------------------------------------------------------*/
2929#include <stdbool.h>
3030#include "stm32f4xx_hal.h"
31- #include "usbd_cdc .h"
31+ #include "usbd_cdc_msc .h"
3232#include "usbd_cdc_interface.h"
3333#include "pendsv.h"
3434#include "usb.h"
3535
36+ // CDC control commands
37+ #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
38+ #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
39+ #define CDC_SET_COMM_FEATURE 0x02
40+ #define CDC_GET_COMM_FEATURE 0x03
41+ #define CDC_CLEAR_COMM_FEATURE 0x04
42+ #define CDC_SET_LINE_CODING 0x20
43+ #define CDC_GET_LINE_CODING 0x21
44+ #define CDC_SET_CONTROL_LINE_STATE 0x22
45+ #define CDC_SEND_BREAK 0x23
46+
3647/* Private typedef -----------------------------------------------------------*/
3748/* Private define ------------------------------------------------------------*/
3849#define APP_RX_DATA_SIZE 1024 // I think this must be at least CDC_DATA_FS_OUT_PACKET_SIZE (was 2048)
Original file line number Diff line number Diff line change 3636#include <string.h>
3737
3838#include "mpconfig.h"
39- #include "gc.h" // for gc_alloc and gc_free
4039
4140/* Exported types ------------------------------------------------------------*/
4241/* Exported constants --------------------------------------------------------*/
4746#define USBD_SUPPORT_USER_STRING 0
4847#define USBD_SELF_POWERED 0
4948#define USBD_DEBUG_LEVEL 0
50-
51- // for MSC device
52- #define MSC_MEDIA_PACKET 8192
5349
5450/* Exported macro ------------------------------------------------------------*/
5551/* Memory management macros */
52+ /*
53+ these should not be used because the GC is reset on a soft reset but the usb is not
54+ #include "gc.h"
5655#define USBD_malloc gc_alloc
5756#define USBD_free gc_free
5857#define USBD_memset memset
5958#define USBD_memcpy memcpy
60-
59+ */
60+
6161/* DEBUG macros */
6262#if (USBD_DEBUG_LEVEL > 0 )
6363#define USBD_UsrLog (...) printf(__VA_ARGS__);\
Original file line number Diff line number Diff line change 55#include "usbd_msc_scsi.h"
66#include "usbd_ioreq.h"
77
8- // CDC endpoint parameters
9- #define CDC_DATA_FS_MAX_PACKET_SIZE 64 // Endpoint IN & OUT Packet size
10- #define CDC_CMD_PACKET_SIZE 8 // Control Endpoint Packet size
11- #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
12- #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
8+ // CDC and MSC packet sizes
9+ #define CDC_DATA_FS_MAX_PACKET_SIZE (64) // endpoint IN & OUT packet size
10+ #define MSC_MEDIA_PACKET (2048) // was 8192; how low can it go whilst still working?
1311
1412#if 0
1513// CDC
3432#define MSC_IFACE_NUM (0)
3533#define MSC_IN_EP (0x81)
3634#define MSC_OUT_EP (0x01)
37- #elif 0
35+ #elif 1
3836// CDC + MSC
3937#define USB_CDC_MSC_CONFIG_DESC_SIZ (98)
4038#define NUM_INTERFACES (3)
Original file line number Diff line number Diff line change 33
44#define USB_DESC_TYPE_ASSOCIATION (0x0b)
55
6- /* currently unused
7- #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
8- #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
9- #define CDC_SET_COMM_FEATURE 0x02
10- #define CDC_GET_COMM_FEATURE 0x03
11- #define CDC_CLEAR_COMM_FEATURE 0x04
12- #define CDC_SET_LINE_CODING 0x20
13- #define CDC_GET_LINE_CODING 0x21
14- #define CDC_SET_CONTROL_LINE_STATE 0x22
15- #define CDC_SEND_BREAK 0x23
16- */
6+ #define CDC_CMD_PACKET_SIZE 8 // Control Endpoint Packet size
7+ #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
8+ #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
179
1810#define BOT_GET_MAX_LUN 0xFE
1911#define BOT_RESET 0xFF
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments