usb_config.h is a file used to configure the MCHPFSUSB stack and various function drivers. This file provides compile time selection of options provided by the stack. This file defines constants needed by the stack and various function drivers.
This section will detail the definitions required by the MSD function driver. Additional definitions may be required by the stack itself. Please see the Files topic of the Stack section for more details about stack specific definitions.
Please note that the usb_config.h file can also be generated using the USBConfig.exe tool provided in the "<Install Directory>\USB Tools\USBConfig Tool" directory.
USB_USE_MSD - This define lets the USB stack know that it will be using the MSD function driver. This should be defined for any device using the MSD driver.
#define USB_USE_MSD
MSD_INTF_ID - This defines the interface number for the MSD device. This number should be unique within the configuration. Valid numbers range from 0-255.
#define MSD_INTF_ID 0x00
MSD_IN_EP_SIZE - this defines the size of the IN endpoint used by the MSD driver. The valid range is 1-64.
#define MSD_IN_EP_SIZE 64
MSD_OUT_EP_SIZE - this defines the size of the OUT endpoint used by the MSD driver. The valid range is 1-64.
#define MSD_OUT_EP_SIZE 64
MAX_LUN - This defines the largest logical unit number (LUN) of the device (0 indexed). Each LUN will appear to the computer as its own drive. For one drive, use 0. For sixteen drives, use 15. The valid range is 0-15. For each valid LUN defined here there should be a corresponding entry in the array of LUN_FUNCTIONS variables.
#define MAX_LUN 0
MSD_DATA_IN_EP - This defined the IN endpoint number used by the MSD driver. This number should be unique within the configuration (but can be the same as the MSD_DATA_OUT_EP).
#define MSD_DATA_IN_EP 1
MSD_DATA_OUT_EP - This defined the OUT endpoint number used by the MSD driver. This number should be unique within the configuration (but can be the same as the MSD_DATA_IN_EP).
#define MSD_DATA_OUT_EP 1
MSD_BUFFER_ADDRESS - This defines the address where the MSD RAM buffer will reside. This implementation requires a sector size buffer (typically 512 bytes).
#define MSD_BUFFER_ADDRESS 0x600