204 CHAPTER 7 Target API
7.3.1.7 USBD_SMSD_AddConstFiles()
Description
Adds constant files to SmartMSD. Allows to add multiple files which should be shown on a
SmartMSD volume as soon as it is connected. A common example would be a “Readme.txt”
or a link to the company website.
Prototype
int USBD_SMSD_AddConstFiles( unsigned Lun,
const USB_SMSD_CONST_FILE * paConstFile,
unsigned NumFiles);
Parameters
Parameter Description
Lun Specifies the logical unit number.
paConstFile Pointer to an array of USB_SMSD_CONST_FILE structures.
NumFiles The number of items in the paConstFile array.
Return value
≥ 0 O.K.
< 0 Error
Additional information
For additional information please see USB_SMSD_CONST_FILE.
Notes
(1) Must only be called from USB_SMSD_X_Config() during initialization phase
Example
#define COUNTOF(a) (sizeof((a))/sizeof((a)[0]))
static const U8 _abFile_SeggerHTML[] = {0x3C, 0x68, 0x74, 0x6D, 0x6C, 0x3E, 0x3C,
0x68, 0x65, 0x61, 0x64, 0x3E, 0x3C, 0x6D, 0x65, 0x74, 0x61, 0x20, 0x68, 0x74, 0x74,
0x70, 0x2D, 0x65, 0x71, 0x75, 0x69, 0x76, 0x3D, 0x22, 0x72, 0x65, 0x66, 0x72, 0x65,
0x73, 0x68, 0x22, 0x20, 0x63, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x3D, 0x22, 0x30,
0x3B, 0x20, 0x75, 0x72, 0x6C, 0x3D, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77,
0x77, 0x77, 0x2E, 0x73, 0x65, 0x67, 0x67, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x2F,
0x69, 0x6E, 0x64, 0x65, 0x78, 0x2E, 0x68, 0x74, 0x6D, 0x6C, 0x22, 0x2F, 0x3E, 0x3C,
0x74, 0x69, 0x74, 0x6C, 0x65, 0x3E, 0x53, 0x45, 0x47, 0x47, 0x45, 0x52, 0x20, 0x53,
0x68, 0x6F, 0x72, 0x74, 0x63, 0x75, 0x74, 0x3C, 0x2F, 0x74, 0x69, 0x74, 0x6C, 0x65,
0x3E, 0x3C, 0x2F, 0x68, 0x65, 0x61, 0x64, 0x3E, 0x3C, 0x62, 0x6F, 0x64, 0x79, 0x3E,
0x3C, 0x2F, 0x62, 0x6F, 0x64, 0x79, 0x3E, 0x3C, 0x2F, 0x68, 0x74, 0x6D, 0x6C, 0x3E};
static USB_SMSD_CONST_FILE _aConstFiles[] = {
// sName pData FileSize Flags
{ "Segger.html", _abFile_SeggerHTML, sizeof(_abFile_SeggerHTML), 0, }
};
/*********************************************************************
*
* USB_SMSD_X_Config
*
* Function description
* This function is called by the USB MSD Module during USB_SMSD_Init() and
initializes the SmartMSD volume.
*/
void USB_SMSD_X_Config(void) {
<...>
USBD_SMSD_AddConstFiles(1, &_aConstFiles[0], COUNTOF(_aConstFiles));
<...>
}
emUSB-Device User Guide & Reference Manual © 2010-2018 SEGGER Microcontroller GmbH