This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK16 USB MSC - Understanding working buffers

Hi everyone,

I am working on USB MSC example. I have two questions.

1. What is the MSC_WORKBUFFER_SIZE defines in the example? Is the last parameter of APP_USBD_MSC_GLOBAL_DEF function. The documentation says that is the " Work buffer size (need to fit into all block devices from block device list)", What does it mean?

    a.  What's the purpose? I understand that this is somehow related to the number of block devices?

    b. How does it calculated for each specific project? For instance, why the example defines MSC_WORKBUFFER_SIZE (1024)?

#define MSC_WORKBUFFER_SIZE (1024)

/*lint -save -e26 -e64 -e123 -e505 -e651*/
/**
 * @brief Mass storage class instance
 */
APP_USBD_MSC_GLOBAL_DEF(m_app_msc,
    0,
    msc_user_ev_handler,
    ENDPOINT_LIST(),
    BLOCKDEV_LIST(),
    MSC_WORKBUFFER_SIZE);


2. The second question is related to the f_mkfs() function. 

    a. What is the purpose of the 4th parameter

    b. How does it calculated for each specific project? For instance, why the example sets the working buffer to 512bytes?

static uint8_t buf[512];
ff_result = f_mkfs("", FM_FAT, 1024, buf, sizeof(buf)); 

Thanks in advance

Nick

Related