rename CFG_TUD_MSC_BUFSIZE to CFG_TUD_MSC_EP_BUFSIZE

rename CFG_TUD_HID_BUFSIZE to CFG_TUD_HID_EP_BUFSIZE
This commit is contained in:
hathach
2020-07-16 15:34:16 +07:00
parent fea6fb73a1
commit 5ca748a68e
20 changed files with 74 additions and 76 deletions

View File

@@ -73,14 +73,11 @@
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUD_CDC 0 #define CFG_TUD_CDC 0
#define CFG_TUD_MSC 1 #define CFG_TUD_MSC 0
#define CFG_TUD_HID 0 #define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0 #define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -97,7 +97,6 @@
#define CFG_TUD_CDC 1 #define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUD_HID 0 #define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0 #define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
@@ -106,10 +105,7 @@
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) #define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
// MSC Buffer size of Device Mass storage // MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512 #define CFG_TUD_MSC_EP_BUFSIZE 512
// HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -99,7 +99,6 @@
#define CFG_TUD_CDC 1 #define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUD_HID 0 #define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0 #define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
@@ -108,10 +107,7 @@
#define CFG_TUD_CDC_TX_BUFSIZE 64 #define CFG_TUD_CDC_TX_BUFSIZE 64
// MSC Buffer size of Device Mass storage // MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512 #define CFG_TUD_MSC_EP_BUFSIZE 512
// HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -96,24 +96,20 @@
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUD_CDC 1 #define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUD_HID 0
#define CFG_TUD_MIDI 1 #define CFG_TUD_MIDI 1
#define CFG_TUD_HID 0
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// CDC FIFO size of TX and RX // CDC FIFO size of TX and RX
#define CFG_TUD_CDC_RX_BUFSIZE 64 #define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE 64 #define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
// MIDI FIFO size of TX and RX // MIDI FIFO size of TX and RX
#define CFG_TUD_MIDI_RX_BUFSIZE 64 #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_MIDI_TX_BUFSIZE 64 #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
// MSC Buffer size of Device Mass storage // MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512 #define CFG_TUD_MSC_EP_BUFSIZE 512
// HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -101,7 +101,7 @@
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// HID buffer size Should be sufficient to hold ID (if any) + Data // HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16 #define CFG_TUD_HID_EP_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -105,7 +105,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval // Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10) TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
}; };
// Invoked when received GET CONFIGURATION DESCRIPTOR // Invoked when received GET CONFIGURATION DESCRIPTOR

View File

@@ -101,7 +101,7 @@
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// HID buffer size Should be sufficient to hold ID (if any) + Data // HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16 #define CFG_TUD_HID_EP_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -105,7 +105,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval // Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10) TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
}; };
// Invoked when received GET CONFIGURATION DESCRIPTOR // Invoked when received GET CONFIGURATION DESCRIPTOR

View File

@@ -101,7 +101,7 @@
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// HID buffer size Should be sufficient to hold ID (if any) + Data // HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 64 #define CFG_TUD_HID_EP_BUFSIZE 64
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -72,7 +72,7 @@ uint8_t const * tud_descriptor_device_cb(void)
uint8_t const desc_hid_report[] = uint8_t const desc_hid_report[] =
{ {
TUD_HID_REPORT_DESC_GENERIC_INOUT(CFG_TUD_HID_BUFSIZE) TUD_HID_REPORT_DESC_GENERIC_INOUT(CFG_TUD_HID_EP_BUFSIZE)
}; };
// Invoked when received GET HID REPORT DESCRIPTOR // Invoked when received GET HID REPORT DESCRIPTOR
@@ -103,7 +103,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval // Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, 0x80 | EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10) TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, 0x80 | EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
}; };
// Invoked when received GET CONFIGURATION DESCRIPTOR // Invoked when received GET CONFIGURATION DESCRIPTOR

View File

@@ -101,8 +101,8 @@
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// MIDI FIFO size of TX and RX // MIDI FIFO size of TX and RX
#define CFG_TUD_MIDI_RX_BUFSIZE 64 #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_MIDI_TX_BUFSIZE 64 #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -98,7 +98,7 @@ uint8_t const desc_fs_configuration[] =
}; };
#if TUD_OPT_HIGH_SPEED #if TUD_OPT_HIGH_SPEED
uint8_t const desc_fs_configuration[] = uint8_t const desc_hs_configuration[] =
{ {
// Config number, interface count, string index, total length, attribute, power in mA // Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),

View File

@@ -101,7 +101,7 @@
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
// MSC Buffer size of Device Mass storage // MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512 #define CFG_TUD_MSC_EP_BUFSIZE 512
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -48,8 +48,8 @@ typedef struct
uint8_t idle_rate; // up to application to handle idle rate uint8_t idle_rate; // up to application to handle idle rate
uint16_t report_desc_len; uint16_t report_desc_len;
CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_HID_BUFSIZE]; CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_HID_EP_BUFSIZE];
CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_HID_BUFSIZE]; CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_HID_EP_BUFSIZE];
tusb_hid_descriptor_hid_t const * hid_descriptor; tusb_hid_descriptor_hid_t const * hid_descriptor;
} hidd_interface_t; } hidd_interface_t;
@@ -86,7 +86,7 @@ bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len)
if (report_id) if (report_id)
{ {
len = tu_min8(len, CFG_TUD_HID_BUFSIZE-1); len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE-1);
p_hid->epin_buf[0] = report_id; p_hid->epin_buf[0] = report_id;
memcpy(p_hid->epin_buf+1, report, len); memcpy(p_hid->epin_buf+1, report, len);
@@ -94,7 +94,7 @@ bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len)
}else }else
{ {
// If report id = 0, skip ID field // If report id = 0, skip ID field
len = tu_min8(len, CFG_TUD_HID_BUFSIZE); len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE);
memcpy(p_hid->epin_buf, report, len); memcpy(p_hid->epin_buf, report, len);
} }

View File

@@ -39,8 +39,14 @@
// Class Driver Default Configure & Validation // Class Driver Default Configure & Validation
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#ifndef CFG_TUD_HID_BUFSIZE #if !defined(CFG_TUD_HID_EP_BUFSIZE) & defined(CFG_TUD_HID_BUFSIZE)
#define CFG_TUD_HID_BUFSIZE 16 // TODO warn user to use new name later on
// #warning CFG_TUD_HID_BUFSIZE is renamed to CFG_TUD_HID_EP_BUFSIZE
#define CFG_TUD_HID_EP_BUFSIZE CFG_TUD_HID_BUFSIZE
#endif
#ifndef CFG_TUD_HID_EP_BUFSIZE
#define CFG_TUD_HID_EP_BUFSIZE 16
#endif #endif
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -65,7 +65,7 @@ typedef struct
}mscd_interface_t; }mscd_interface_t;
CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static mscd_interface_t _mscd_itf; CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static mscd_interface_t _mscd_itf;
CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static uint8_t _mscd_buf[CFG_TUD_MSC_BUFSIZE]; CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static uint8_t _mscd_buf[CFG_TUD_MSC_EP_BUFSIZE];
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION // INTERNAL OBJECT & FUNCTION DECLARATION
@@ -564,7 +564,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t
else else
{ {
// READ10 & WRITE10 Can be executed with large bulk of data e.g write 8K bytes (several flash write) // READ10 & WRITE10 Can be executed with large bulk of data e.g write 8K bytes (several flash write)
// We break it into multiple smaller command whose data size is up to CFG_TUD_MSC_BUFSIZE // We break it into multiple smaller command whose data size is up to CFG_TUD_MSC_EP_BUFSIZE
if (SCSI_CMD_READ_10 == p_cbw->command[0]) if (SCSI_CMD_READ_10 == p_cbw->command[0])
{ {
proc_read10_cmd(rhport, p_msc); proc_read10_cmd(rhport, p_msc);

View File

@@ -38,12 +38,19 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Class Driver Configuration // Class Driver Configuration
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
TU_VERIFY_STATIC(CFG_TUD_MSC_BUFSIZE < UINT16_MAX, "Size is not correct");
#ifndef CFG_TUD_MSC_BUFSIZE #if !defined(CFG_TUD_MSC_EP_BUFSIZE) & defined(CFG_TUD_MSC_BUFSIZE)
#error CFG_TUD_MSC_BUFSIZE must be defined, value of a block size should work well, the more the better // TODO warn user to use new name later on
// #warning CFG_TUD_MSC_BUFSIZE is renamed to CFG_TUD_MSC_EP_BUFSIZE
#define CFG_TUD_MSC_EP_BUFSIZE CFG_TUD_MSC_BUFSIZE
#endif #endif
#ifndef CFG_TUD_MSC_EP_BUFSIZE
#error CFG_TUD_MSC_EP_BUFSIZE must be defined, value of a block size should work well, the more the better
#endif
TU_VERIFY_STATIC(CFG_TUD_MSC_EP_BUFSIZE < UINT16_MAX, "Size is not correct");
/** \addtogroup ClassDriver_MSC /** \addtogroup ClassDriver_MSC
* @{ * @{
* \defgroup MSC_Device Device * \defgroup MSC_Device Device

View File

@@ -94,7 +94,7 @@
//------------- HID -------------// //------------- HID -------------//
// Should be sufficient to hold ID (if any) + Data // Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 16 #define CFG_TUD_HID_EP_BUFSIZE 16
#ifdef __cplusplus #ifdef __cplusplus
} }