*F**************************************************************************
* NAME: usb_send_ep0_packet
*----------------------------------------------------------------------------
* PARAMS:
* *tbuf: address of the first data to send
* data_length: number of bytes to send
* return: address of the next Ucharto send
*----------------------------------------------------------------------------
* PURPOSE:
* This function moves the data pointed by tbuf to the default Control
* endpoint fifo and sends it through the USB.
*----------------------------------------------------------------------------
* EXAMPLE:
* usb_send_ep0_packet(&first_data,0x20); // send packet
* while(!(Usb_tx_complete)); // wait packet ACK'ed by the Host
* Usb_clear_tx_complete(); // acknowledge the transmit
*----------------------------------------------------------------------------
* NOTE:
* tbuf is incremented of 'data_length'.
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Uchar* usb_send_ep0_packet (Uchar* tbuf, Uchar data_length)
{
Uchar i;
Usb_select_ep(0);
for (i = data_length; i != 0 ; i--, tbuf++) { Usb_write_byte(*tbuf); }
Usb_set_tx_ready();
return tbuf;
}