/************************************************************************************ * this module is represents the access layer to USB STACK DRIVER * used to communication over USB protocol * the USB protocol implementation is inside the module no need for another includes * ======== USBCDCD.h ======== ************************************************************************************/ #ifndef USBCDCD_H_ #define USBCDCD_H_ #ifdef __cplusplus extern "C" { #endif #include #include #include "include.h" /****************************************************************** * ======== USBCDCD_init ======== * Function to initialize the USB serial reference module. * * Note: This function is not reentrant safe. ******************************************************************/ void USBCDCD_init(void); /**************************************************************************** * ======== USBCDCD_sendData ======== * A blocking function that sends a specified amount of data. * * Function sends _size number of bytes from the buffer pointed by _pBuff. * * @param(_pBuff) Pointer to a buffer of data * * @param(_size) Number of bytes to be sent * * @return Number of bytes added to the USB Buffer for transmission ******************************************************************************/ unsigned int USBCDCD_sendData(const unsigned char *_pBuff, unsigned int _length, unsigned int _timeout); /********************************************************************************** * ======== USBCDCD_receiveData ======== * A blocking function to read from the USB Buffer * * Function reads up to _size number of bytes from the USB Buffer. The return * value will indicate how many bytes were read from the USB Buffer. If there * is no data in the USB Buffer, this function will block timeout number of * ticks. Note: The BIOS_WAIT_FOREVER macro can be used to block indefinitely. * * @param(_pBuff) Pointer to a buffer to which data is written to. * * @param(_length) Maximum number of bytes to be read * * @param(_timeout) Number of tick to block if no data is currently available in * the USB Buffer. * * @return Returns the number of bytes actually read from the USB * Buffer. **********************************************************************************/ unsigned int USBCDCD_receiveData(unsigned char *_pBuff, unsigned int _length, unsigned int _timeout); /********************************************************** * ======== USBCDCD_waitForConnect ======== * This function blocks while the USB is not connected **********************************************************/ bool USBCDCD_waitForConnect(unsigned int _timeout); void USBCDCD_Reinit(void); void USBCDCD_hwiHandler(UArg arg0); extern bool UpdateFlag; //bool SendChars(char* buffer,size_t length); #ifdef __cplusplus } #endif #endif /* USBCDCD_H_ */