Kindly refer to Example on how to use the USB control EndPoint EP0 for information on how to handle EP0. I repeat the last post here again:
For the functions like USBFS_ReadOutEP(), the valid value of endpoint number ranges from 1 to 8. You cannot give 0 for the endpoint number parameter in it.
As already mentioned by Len you can use the USBFS_EP_0_ISR_ExitCallback() and USBFS_EP_0_ISR_EntryCallback() ISR's located in the USBFS_dvrc.c . These ISR's are triggered to handle control transfers directed to endpoint.
To use these ISRs you need to define USBFS_EP_0_ISR_ENTRY_CALLBACK (or USBFS_EP_0_ISR_EXIT_CALLBACK) in the cyapicallbacks.h as shown in the image below:
Then define the USBFS_EP_0_ISR_EntryCallback() function in the main.c to perform the desired function.