/************************************************************************************//** ** \brief Receives a communication interface packet if one is present. ** \param data Pointer to byte array where the data is to be stored. ** \return BLT_TRUE if a packet was received, BLT_FALSE otherwise. ** ****************************************************************************************/ blt_bool UsbReceivePacket(blt_int8u *data) { static blt_int8u xcpCtoReqPacket[BOOT_COM_USB_RX_MAX_DATA+1]; /* one extra for length */ static blt_int8u xcpCtoRxLength; static blt_bool xcpCtoRxInProgress = BLT_FALSE; /* poll for USB events */ USB0DeviceIntHandler(); /* start of cto packet received? */ if (xcpCtoRxInProgress == BLT_FALSE) { /* store the message length when received */ if (UsbReceiveByte(&xcpCtoReqPacket[0]) == BLT_TRUE) { if (xcpCtoReqPacket[0] > 0) { /* indicate that a cto packet is being received */ xcpCtoRxInProgress = BLT_TRUE; /* reset packet data count */ xcpCtoRxLength = 0; } } } else { /* store the next packet byte */ if (UsbReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == BLT_TRUE) { /* increment the packet data count */ xcpCtoRxLength++; /* check to see if the entire packet was received */ if (xcpCtoRxLength == xcpCtoReqPacket[0]) { /* copy the packet data */ CpuMemCopy((blt_int32u)data, (blt_int32u)&xcpCtoReqPacket[1], xcpCtoRxLength); /* done with cto packet reception */ xcpCtoRxInProgress = BLT_FALSE; /* packet reception complete */ return BLT_TRUE; } } } /* packet reception not yet complete */ return BLT_FALSE; } /*** end of UsbReceivePacket ***/
/* * ======== USBKBD_hwiHandler ======== * This function calls the USB library's device interrupt handler. */ static Void USBKBD_hwiHandler(UArg arg0) { USB0DeviceIntHandler(); }
/* * ======== USBCDCD_LoggerIdle_hwiHandler ======== * This function calls the USB library's device interrupt handler. */ static Void USBCDCD_LoggerIdle_hwiHandler(UArg arg0) { USB0DeviceIntHandler(); }
__interrupt void f28x_USB0DeviceIntHandler(void) { USB0DeviceIntHandler(); PieCtrlRegs.PIEACK.all |= 0x010; }