The constant is used in usb_driver.c, in this routine:
/**************************************************************************//*!
*
* @name _usb_device_register_service
*
* @brief The function registers a callback function from the Application layer
*
* @param controller_ID : Controller ID
* @param type : event type or endpoint number
* @param service : callback function pointer
*
* @return status
* USB_OK : When Successfull
* USBERR_ALLOC_SERVICE : When invalid type or already registered
*
******************************************************************************
* This function registers a callback function from the application if it is
* called not already registered so that the registered callback function can
* be if the event of that type occurs
*****************************************************************************/
uint_8 _usb_device_register_service(
uint_8 controller_ID, /* [IN] Controller ID */
uint_8 type, /* [IN] type of event or endpoint
number to service */
USB_SERVICE_CALLBACK service /* [IN] pointer to callback
function */
)
{
UNUSED (controller_ID)
UNUSED (service)
#ifdef MULTIPLE_DEVICES
/* check if the type is valid and callback for the type
is not already registered */
if(((type <= USB_SERVICE_MAX_EP) ||
((type < USB_SERVICE_MAX) && (type >= USB_SERVICE_BUS_RESET))) &&
(g_usb_CB[type] == NULL))
{
/* register the callback function */
g_usb_CB[type] = service;
return USB_OK;
}
else
{
return USBERR_ALLOC_SERVICE;
}
#else
UNUSED(type);
return USB_OK;
#endif
}
The result appears to be that you can only register up to USB_SERVICE_MAX_EP endpoint callbacks.
I have not yet compiled the code and inspected the generated code to verify the limit. One of our other guys is currently fighting with the various toolsets, and he's sporting some arrows in his back at the moment.
I'm not real impressed with putting both the USB events and the endpoints in the same callback table. As written, with the registration limit, about half to 2/3 of the table lies fallow. I'm sure someone had a reason at some point.
In the real world, this will not be an issue unless someone starts registering a lot of endpoints.