
#include "OB90A64U1.h"
#include "Timer32.h"
#include "USB.h"
#include "USBDEF.h"
#include "USBCOM.h"
#include "Bulk.h"

void Bulk_ProcBulkPkg(void)
{

    uint8_t     RcvBuffer[4]; 
	  uint8_t SendBuffer[4] = {5, 6, 7, 8};
	  uint32_t  UsbStatus;
    UsbStatus = USB_Transfer_Out(RcvBuffer, USB_BULK_OUT_POINT,  sizeof(RcvBuffer));
    if ( UsbStatus != USB_STATUS_OK)	
        goto ERROR_HAPPENED;
    
    SendBuffer[0] = RcvBuffer[0] + 1;
    SendBuffer[1] = RcvBuffer[1] + 1;
    SendBuffer[2] = RcvBuffer[2] + 1;
    SendBuffer[3] = RcvBuffer[3] + 1;        
		UsbStatus =  USB_Transfer_In(SendBuffer, USB_BULK_IN_POINT,sizeof(SendBuffer), sizeof(SendBuffer));
    if ( UsbStatus != USB_STATUS_OK)
        goto ERROR_HAPPENED;     

	return;
		
ERROR_HAPPENED:
 	USB_StallEp(USB_BULK_IN_POINT);

	return;
}
