GetMemSize(USBD_CDC_INIT_PARAM_T* param) - where is result used?

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by larsen on Sun Dec 30 16:11:54 MST 2012
In the virtual com example for nxpUSBlib, both the structures:
(1) USBD_API_INIT_PARAM_T.. mem_size;
(2) USBD_CDC_INIT_PARAM_T.. mem_size;
have a mem_size parameter and a corresponding mem_base.

In the code it says: The call to 'GetMemSize(USBD_CDC_INIT_PARAM_T* param)' returns the required ram size. I suppose it is for (2) the USBD_CDC_INIT_PARAM_T mem_size parameter.
A) Is that correct?

It says in the notes in USBD_CDC_INIT_PARAM_T struct:
".. mem_size should be _greater_ than the size returned by USBD_CDC_API::GetMemSize() routine".
B) Is one byte more than GetMemSize() returns sufficient or should more be reserved?
C) How much more then? Why does the function not simply return the _required_ ram size. No more no less. Would be more clear.

E) How to determine the mem_size required in the other structure USBD_API_INIT_PARAM_T?

Of course I could just copy the hardcoded values from the cdc example, but I would like to make it according to the "books" to improve reliability and conserve precious ram.

Thanks for any advice you have.