/********************************************************************* * Function: void APP_DeviceVendorThroughputTestInitialize(void); * * Overview: Initializes the demo * * PreCondition: Configuration for this app is already set by the USB host. * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceVendorThroughputTestInitialize() { EP1OUTEvenHandle = NULL; EP2OUTEvenHandle = NULL; EP3OUTEvenHandle = NULL; EP1OUTOddHandle = NULL; EP2OUTOddHandle = NULL; EP3OUTOddHandle = NULL; //Now that we are configured, enable the endpoints for use in the demo // and start the initial transfers USBEnableEndpoint(1,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(2,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(3,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Prepare the OUT endpoints to receive the first packets from the host. EP1OUTEvenHandle = USBTransferOnePacket(1, OUT_FROM_HOST,(uint8_t*)&EP1OUTEvenBuffer,64); //First 64-bytes of data sent to EP1 OUT will arrive in the even buffer. EP1OUTOddHandle = USBTransferOnePacket(1, OUT_FROM_HOST,(uint8_t*)&EP1OUTOddBuffer,64); //Second 64-bytes of data sent to EP1 OUT will arrive in the odd buffer. EP1OUTEvenNeedsServicingNext = true; //Used to keep track of which buffer will contain the next sequential data packet. EP2OUTEvenHandle = USBTransferOnePacket(2, OUT_FROM_HOST,(uint8_t*)&EP2OUTEvenBuffer,64); EP2OUTOddHandle = USBTransferOnePacket(2, OUT_FROM_HOST,(uint8_t*)&EP2OUTOddBuffer,64); EP2OUTEvenNeedsServicingNext = true; //Used to keep track of which buffer will contain the next sequential data packet. EP3OUTEvenHandle = USBTransferOnePacket(3, OUT_FROM_HOST,(uint8_t*)&EP3OUTEvenBuffer,64); EP3OUTOddHandle = USBTransferOnePacket(3, OUT_FROM_HOST,(uint8_t*)&EP3OUTOddBuffer,64); EP3OUTEvenNeedsServicingNext = true; //Used to keep track of which buffer will contain the next sequential data packet. }
/************************************************************************** Function: void USBCCIDInitEP(void) Summary: This function initializes the CCID function driver. This function should be called after the SET_CONFIGURATION command. Description: This function initializes the CCID function driver. This function sets the default line coding (baud rate, bit parity, number of data bits, and format). This function also enables the endpoints and prepares for the first transfer from the host. This function should be called after the SET_CONFIGURATION command. This is most simply done by calling this function from the USBCBInitEP() function. Typical Usage: <code> void USBCBInitEP(void) { USBCCIDInitEP(); } </code> Conditions: None Remarks: None **************************************************************************/ void USBCCIDInitEP(void) { usbCcidBulkInTrfState = USB_CCID_BULK_IN_READY; usbCcidBulkInLen =0; /* * Do not have to init Cnt of IN pipes here. * Reason: Number of BYTEs to send to the host * varies from one transaction to * another. Cnt should equal the exact * number of BYTEs to transmit for * a given IN transaction. * This number of BYTEs will only * be known right before the data is * sent. */ USBEnableEndpoint(USB_EP_INT_IN,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(USB_EP_BULK_IN,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); usbCcidBulkInHandle = 0; usbCcidInterruptInHandle = 0; usbCcidBulkOutHandle = USBRxOnePacket(USB_EP_BULK_OUT,(BYTE*)&usbCcidBulkOutEndpoint,USB_EP_SIZE); }//end CCIDInitEP
/************************************************************************** Function: void CDCInitEP(void) Summary: This function initializes the CDC function driver. This function should be called after the SET_CONFIGURATION command. Description: This function initializes the CDC function driver. This function sets the default line coding (baud rate, bit parity, number of data bits, and format). This function also enables the endpoints and prepares for the first transfer from the host. This function should be called after the SET_CONFIGURATION command. This is most simply done by calling this function from the USBCBInitEP() function. Typical Usage: <code> void USBCBInitEP(void) { CDCInitEP(); } </code> Conditions: None Remarks: None **************************************************************************/ void CDCInitEP(void) { //Abstract line coding information line_coding.dwDTERate.Val = 19200; // baud rate line_coding.bCharFormat = 0x00; // 1 stop bit line_coding.bParityType = 0x00; // None line_coding.bDataBits = 0x08; // 5,6,7,8, or 16 cdc_trf_state = CDC_TX_READY; cdc_rx_len = 0; /* * Do not have to init Cnt of IN pipes here. * Reason: Number of BYTEs to send to the host * varies from one transaction to * another. Cnt should equal the exact * number of BYTEs to transmit for * a given IN transaction. * This number of BYTEs will only * be known right before the data is * sent. */ USBEnableEndpoint(CDC_COMM_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(CDC_DATA_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); CDCDataOutHandle = USBRxOnePacket(CDC_DATA_EP,(BYTE*)&cdc_data_rx,sizeof(cdc_data_rx)); CDCDataInHandle = NULL; }//end CDCInitEP
/****************************************************************************** * Function: static void UsbCbInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *****************************************************************************/ static void UsbCbInitEP(void) { USBEnableEndpoint(USBGEN_CMD_EP_NUM, USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(USBGEN_DATA_EP_NUM, USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); UsbOutCmdHandle = USBGenRead(USBGEN_CMD_EP_NUM, (BYTE*)&OutCmdPacket, USBGEN_EP_SIZE); UsbOutDataHandle = USBGenRead(USBGEN_DATA_EP_NUM, (BYTE*)&OutDataPacket, USBGEN_EP_SIZE); }
void FlashInitEP(void) { FlashTxState = FLASH_TX_READY; USBEnableEndpoint(NAND_TX_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(NAND_RX_EP,USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); FlashDataOutHandle = USBRxOnePacket(NAND_RX_EP,(BYTE*)&FlashRxBuffer,sizeof(FlashRxBuffer)); FlashDataInHandle = NULL; }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP,USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #endif USBMSDInit(); }
/********************************************************************* * Function: void APP_DeviceMSDInitialize(void); * * Overview: Initializes the Custom HID demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceMSDInitialize() { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP,USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #endif USBMSDInit(); }
/************************************************************************** Function: void CDCInitEP(void) Summary: This function initializes the CDC function driver. This function should be called after the SET_CONFIGURATION command (ex: within the context of the USBCBInitEP() function). Description: This function initializes the CDC function driver. This function sets the default line coding (baud rate, bit parity, number of data bits, and format). This function also enables the endpoints and prepares for the first transfer from the host. This function should be called after the SET_CONFIGURATION command. This is most simply done by calling this function from the USBCBInitEP() function. Typical Usage: <code> void USBCBInitEP(void) { CDCInitEP(); } </code> Conditions: None Remarks: None **************************************************************************/ void CDCInitEP(void) { //Abstract line coding information line_coding.dwDTERate.Val = 19200; // baud rate line_coding.bCharFormat = 0x00; // 1 stop bit line_coding.bParityType = 0x00; // None line_coding.bDataBits = 0x08; // 5,6,7,8, or 16 cdc_rx_len = 0; /* * Do not have to init Cnt of IN pipes here. * Reason: Number of BYTEs to send to the host * varies from one transaction to * another. Cnt should equal the exact * number of BYTEs to transmit for * a given IN transaction. * This number of BYTEs will only * be known right before the data is * sent. */ USBEnableEndpoint(CDC_COMM_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(CDC_DATA_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); CDCDataOutHandle = USBRxOnePacket(CDC_DATA_EP,(BYTE*)&cdc_data_rx,sizeof(cdc_data_rx)); CDCDataInHandle = NULL; #if defined(USB_CDC_SUPPORT_DSR_REPORTING) CDCNotificationInHandle = NULL; mInitDTSPin(); //Configure DTS as a digital input SerialStateBitmap.byte = 0x00; OldSerialStateBitmap.byte = !SerialStateBitmap.byte; //To force firmware to send an initial serial state packet to the host. //Prepare a SerialState notification element packet (contains info like DSR state) SerialStatePacket.bmRequestType = 0xA1; //Always 0xA1 for this type of packet. SerialStatePacket.bNotification = SERIAL_STATE; SerialStatePacket.wValue = 0x0000; //Always 0x0000 for this type of packet SerialStatePacket.wIndex = CDC_COMM_INTF_ID; //Interface number SerialStatePacket.SerialState.byte = 0x00; SerialStatePacket.Reserved = 0x00; SerialStatePacket.wLength = 0x02; //Always 2 bytes for this type of packet CDCNotificationHandler(); #endif #if defined(USB_CDC_SUPPORT_DTR_SIGNALING) mInitDTRPin(); #endif #if defined(USB_CDC_SUPPORT_HARDWARE_FLOW_CONTROL) mInitRTSPin(); mInitCTSPin(); #endif cdc_trf_state = CDC_TX_READY; }//end CDCInitEP
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { //enable the HID endpoint USBEnableEndpoint(HID_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet //USBOutHandle = HIDRxPacket(HID_EP | MIDI_EP,(BYTE*)&ReceivedHidDataBuffer,64); hidRxHandle = USBRxOnePacket(HID_EP, (BYTE*)&rcvHidDataBuffer, 64); //enable the HID endpoint USBEnableEndpoint(MIDI_EP, USB_OUT_ENABLED | USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet midiRxHandle = USBRxOnePacket(MIDI_EP, (BYTE*)&rcvMidiDataBuffer, 64); }
/****************************************************************************** * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *****************************************************************************/ void USBCBInitEP(void) { //Enable the application endpoints USBEnableEndpoint(USBGEN_EP_NUM,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Arm the application OUT endpoint, so it can receive a packet from the host USBGenericOutHandle = USBGenRead(USBGEN_EP_NUM,(BYTE*)&OUTPacket,USBGEN_EP_SIZE); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { //enable the HID endpoint USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Arm the OUT endpoint for the packet we will be receiving. USBOutHandle = HIDRxPacket(HID_EP,(BYTE*)UsbRxData,MaxUsbPacketSize); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP,USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #endif //enable the HID endpoint USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet USBOutHandle = HIDRxPacket(HID_EP,(BYTE*)&ReceivedDataBuffer,64); USBMSDInit(); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { //enable the HID endpoint USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet USBOutHandle = HIDRxPacket(HID_EP,(BYTE*)&ReceivedDataBuffer,64); }
void USBCBInitEP(void) { // enable the HID endpoint USBEnableEndpoint(HID_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); // Arm OUT endpoint so we can receive caps lock, num lock, etc. info from host g_usb_handle_out = HIDRxPacket(HID_EP, (BYTE*)&hid_report_out, 1); }
void USBCBInitEP( void ) { // Enable the HID endpoint USBEnableEndpoint( HID_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP ); // Re-arm the OUT endpoint for the next packet Usb_RxBufferedPacket(); }
/******************************************************************* * Function: void USBCBInitEP(void) *******************************************************************/ void USBCBInitEP(void) { //enable the HID endpoint USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); lastOUTTransmission = HIDRxPacket(HID_EP,(BYTE*)&hid_report_out,1); }
void USBCBInitEP(void) { // enable the MIDI endpoint USBEnableEndpoint(MIDI_EP, USB_OUT_ENABLED | USB_IN_ENABLED | USB_HANDSHAKE_ENABLED |\ USB_DISALLOW_SETUP); // Re-arm the endpoint for the next packet USBRxHandle = USBRxOnePacket(MIDI_EP,(BYTE*)&ReceivedDataBuffer,64); }
void APP_DeviceCustomHIDInitialize() { //initialize the variable holding the handle for the last transmission USBInHandle = 0; //enable the HID endpoint USBEnableEndpoint(CUSTOM_DEVICE_HID_EP, USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet USBOutHandle = (volatile USB_HANDLE)HIDRxPacket(CUSTOM_DEVICE_HID_EP,(uint8_t*)&ReceivedDataBuffer,64); }
// This function is called when the device becomes initialized, which occurs after the host sends a // SET_CONFIGURATION (wValue not = 0) request. This callback function should initialize the endpoints // for the device's usage according to the current configuration. void USBCBInitEP( void ) { // Enable the endpoint. USBEnableEndpoint( USBGEN_EP_NUM, USB_OUT_ENABLED | USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP ); // Now begin waiting for the first packets to be received from the host via this endpoint. OutIndex = 0; OutHandle[0] = USBGenRead( USBGEN_EP_NUM, (BYTE *)&OutBuffer[0], USBGEN_EP_SIZE ); OutHandle[1] = USBGenRead( USBGEN_EP_NUM, (BYTE *)&OutBuffer[1], USBGEN_EP_SIZE ); // Initialize the pointer to the buffer which will return data to the host via this endpoint. InIndex = 0; InPacket = &InBuffer[0]; }
/******************************************************************* * Function: void USBCBInitEP(void) * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. *******************************************************************/ void USBCBInitEP(void) { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED| USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP, USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP, USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED| USB_DISALLOW_SETUP); #endif #if defined(DISPLAY_ENABLED) oled_cmd(OLEDREG_DISPLAY_OFF); // to avoid interference disp_start_usb(); #endif USBMSDInit(); // init Mass Sstorage Device over USB CDCInitEP(); // init serial line over USB }
bool USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event, void *pdata, uint16_t size) { switch (event) { case EVENT_TRANSFER: //Add application specific callback task or callback function here if desired. break; case EVENT_SOF: USBCB_SOF_Handler(); break; case EVENT_SUSPEND: USBCBSuspend(); break; case EVENT_RESUME: USBCBWakeFromSuspend(); break; case EVENT_CONFIGURED: // enable the HID endpoint USBEnableEndpoint(HID_EP_SNES, USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); USBEnableEndpoint(HID_EP_CFG, USB_OUT_ENABLED | USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); USBOutHandleCfg = HIDRxPacket(HID_EP_CFG, usbOutBuffer, sizeof (usbOutBuffer)); break; case EVENT_SET_DESCRIPTOR: USBCBStdSetDscHandler(); break; case EVENT_EP0_REQUEST: USBCheckHIDRequest(); break; case EVENT_BUS_ERROR: USBCBErrorHandler(); break; case EVENT_TRANSFER_TERMINATED: break; default: break; } return true; }
/** * USBCBInitEP: * * Called when the host sends a SET_CONFIGURATION. **/ static void USBCBInitEP(void) { /* enable the HID endpoint */ USBEnableEndpoint(HID_EP, USB_IN_ENABLED| USB_OUT_ENABLED| USB_HANDSHAKE_ENABLED| USB_DISALLOW_SETUP); /* re-arm the OUT endpoint for the next packet */ USBOutHandle = HIDRxPacket(HID_EP, (BYTE*)&RxBuffer, CH_USB_HID_EP_SIZE); }
BOOL USER_USB_CALLBACK_EVENT_HANDLER(int event, void *pdata, WORD size) { switch(event) { case EVENT_CONFIGURED: USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBOutHandle = HIDRxPacket(HID_EP,(BYTE*)&outbuffer, HID_OUT_SIZE); break; case EVENT_EP0_REQUEST: USBCheckHIDRequest(); break; default: break; } return TRUE; }
/********************************************************************* * Function: void APP_DeviceAudioMIDIInitialize(void); * * Overview: Initializes the demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceAudioMIDIInitialize() { USBTxHandle = NULL; USBRxHandle = NULL; pitch = 0x3C; sentNoteOff = true; msCounter = 0; //enable the HID endpoint USBEnableEndpoint(USB_DEVICE_AUDIO_MIDI_ENDPOINT,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); //Re-arm the OUT endpoint for the next packet USBRxHandle = USBRxOnePacket(USB_DEVICE_AUDIO_MIDI_ENDPOINT,(uint8_t*)&ReceivedDataBuffer,64); }
/* * This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. */ void USBCBInitEP (void) { USBEnableEndpoint (HID_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); }
/****************************************************************************** * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *****************************************************************************/ void USBCBInitEP(void) { USBEnableEndpoint(USBGEN_EP_NUM,USB_OUT_ENABLED|USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBGenericOutHandle = USBGenRead(USBGEN_EP_NUM,(BYTE*)&OUTPacket,USBGEN_EP_SIZE); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { //enable the HID endpoint USBEnableEndpoint(HID_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); }