• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

UsbCdc.h

Go to the documentation of this file.
00001 //******************************************************************************
00002 //THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
00003 //REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
00004 //INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
00005 //FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
00006 //COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
00007 //TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
00008 //POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
00009 //INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
00010 //YOUR USE OF THE PROGRAM.
00011 //
00012 //IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
00013 //CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
00014 //THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
00015 //OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
00016 //OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
00017 //EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
00018 //REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
00019 //OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
00020 //USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
00021 //AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
00022 //YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
00023 //(U.S.$500).
00024 //
00025 //Unless otherwise stated, the Program written and copyrighted
00026 //by Texas Instruments is distributed as "freeware".  You may,
00027 //only under TI's copyright in the Program, use and modify the
00028 //Program without any charge or restriction.  You may
00029 //distribute to third parties, provided that you transfer a
00030 //copy of this license to the third party and the third party
00031 //agrees to these terms by its first use of the Program. You
00032 //must reproduce the copyright notice and any other legend of
00033 //ownership on each copy or partial copy, of the Program.
00034 //
00035 //You acknowledge and agree that the Program contains
00036 //copyrighted material, trade secrets and other TI proprietary
00037 //information and is protected by copyright laws,
00038 //international copyright treaties, and trade secret laws, as
00039 //well as other intellectual property laws.  To protect TI's
00040 //rights in the Program, you agree not to decompile, reverse
00041 //engineer, disassemble or otherwise translate any object code
00042 //versions of the Program to a human-readable form.  You agree
00043 //that in no event will you alter, remove or destroy any
00044 //copyright notice included in the Program.  TI reserves all
00045 //rights not specifically granted under this license. Except
00046 //as specifically provided herein, nothing in this agreement
00047 //shall be construed as conferring by implication, estoppel,
00048 //or otherwise, upon you, any license or other right under any
00049 //TI patents, copyrights or trade secrets.
00050 // 
00051 //You may not use the Program in non-TI devices.
00052 //
00053 //This software has been submitted to export control regulations
00054 //The ECCN is EAR99 
00067 // (c)2009 by Texas Instruments Incorporated, All Rights Reserved.
00068 /*----------------------------------------------------------------------------+
00069 |                                                                             |
00070 |                              Texas Instruments                              |
00071 |                                                                             |
00072 |                          MSP430 USB-Example (CDC Driver)                    |
00073 |                                                                             |
00074 +-----------------------------------------------------------------------------+
00075 |  Source: UsbCdc.h, v1.18 2009/06/11                                         |
00076 |  Author: RSTO                                                               |
00077 |                                                                             |
00078 |  WHO          WHEN         WHAT                                             |
00079 |  ---          ----------   ------------------------------------------------ |
00080 |  RSTO         2008/09/03   born                                             |
00081 |  RSTO         2008/12/23   enhancements of CDC API                          |
00082 |  RSTO         2009/05/15   added param to USBCDC_rejectData()               |
00083 |  RSTO         2009/05/26   added USBCDC_bytesInUSBBuffer()                  |
00084 +----------------------------------------------------------------------------*/
00085 
00086 #ifndef _UsbCdc_H_
00087 #define _UsbCdc_H_
00088 
00089 #ifdef __cplusplus
00090 extern "C"
00091 {
00092 #endif
00093 
00094 
00095 #define kUSBCDC_sendStarted         0x01
00096 #define kUSBCDC_sendComplete        0x02
00097 #define kUSBCDC_intfBusyError       0x03
00098 #define kUSBCDC_receiveStarted      0x04
00099 #define kUSBCDC_receiveCompleted    0x05
00100 #define kUSBCDC_receiveInProgress   0x06
00101 #define kUSBCDC_generalError        0x07
00102 #define kUSBCDC_busNotAvailable     0x08
00103 
00104 
00105 
00106 /*----------------------------------------------------------------------------
00107 These functions can be used in application
00108 +----------------------------------------------------------------------------*/
00109 
00110 /*
00111 Sends data over interface intfNum, of size size and starting at address data.
00112   Returns:  kUSBCDC_sendStarted
00113             kUSBCDC_sendComplete
00114             kUSBCDC_intfBusyError
00115 */
00116 BYTE USBCDC_sendData(const BYTE* data, WORD size, BYTE intfNum);
00117 
00118 /*
00119 Receives data over interface intfNum, of size size, into memory starting at address data.
00120 */
00121 BYTE USBCDC_receiveData(BYTE* data, WORD size, BYTE intfNum);
00122 
00123 /*
00124 Aborts an active receive operation on interface intfNum.
00125   size: the number of bytes that were received and transferred
00126   to the data location established for this receive operation.
00127 */
00128 BYTE USBCDC_abortReceive(WORD* size, BYTE intfNum);
00129 
00130 
00131 #define kUSBCDC_noDataWaiting 1 //returned by USBCDC_rejectData() if no data pending
00132 
00133 /*
00134 This function rejects payload data that has been received from the host.
00135 */
00136 BYTE USBCDC_rejectData(BYTE intfNum);
00137 
00138 /*
00139 Aborts an active send operation on interface intfNum.  Returns the number of bytes that were sent prior to the abort, in size.
00140 */
00141 BYTE USBCDC_abortSend(WORD* size, BYTE intfNum);
00142 
00143 
00144 #define kUSBCDC_waitingForSend      0x01
00145 #define kUSBCDC_waitingForReceive   0x02
00146 #define kUSBCDC_dataWaiting         0x04
00147 #define kUSBCDC_busNotAvailable     0x08
00148 /*
00149 This function indicates the status of the interface intfNum.
00150   If a send operation is active for this interface,
00151   the function also returns the number of bytes that have been transmitted to the host.
00152   If a receiver operation is active for this interface, the function also returns
00153   the number of bytes that have been received from the host and are waiting at the assigned address.
00154 
00155 returns kUSBCDC_waitingForSend (indicates that a call to USBCDC_SendData()
00156   has been made, for which data transfer has not been completed)
00157 
00158 returns kUSBCDC_waitingForReceive (indicates that a receive operation
00159   has been initiated, but not all data has yet been received)
00160 
00161 returns kUSBCDC_dataWaiting (indicates that data has been received
00162   from the host, waiting in the USB receive buffers)
00163 */
00164 BYTE USBCDC_intfStatus(BYTE intfNum, WORD* bytesSent, WORD* bytesReceived);
00165 
00166 /*
00167 Returns how many bytes are in the buffer are received and ready to be read.
00168 */
00169 BYTE USBCDC_bytesInUSBBuffer(BYTE intfNum);
00170 
00171 
00172 /*----------------------------------------------------------------------------
00173 Event-Handling routines
00174 +----------------------------------------------------------------------------*/
00175 
00176 /*
00177 This event indicates that data has been received for interface intfNum, but no data receive operation is underway.
00178 returns TRUE to keep CPU awake
00179 */
00180 BYTE USBCDC_handleDataReceived(BYTE intfNum);
00181 
00182 /*
00183 This event indicates that a send operation on interface intfNum has just been completed.
00184 returns TRUE to keep CPU awake
00185 */
00186 BYTE USBCDC_handleSendCompleted(BYTE intfNum);
00187 
00188 /*
00189 This event indicates that a receive operation on interface intfNum has just been completed.
00190 returns TRUE to keep CPU awake
00191 */
00192 BYTE USBCDC_handleReceiveCompleted(BYTE intfNum);
00193 
00194 
00195 /*----------------------------------------------------------------------------
00196 These functions is to be used ONLY by USB stack, and not by application
00197 +----------------------------------------------------------------------------*/
00198 
00202 VOID usbGetLineCoding(VOID);
00203 
00207 VOID usbSetLineCoding(VOID);
00208 
00212 VOID usbSetControlLineState(VOID);
00213 
00217 VOID Handler_SetLineCoding(VOID);
00218 
00219 
00220 #ifdef __cplusplus
00221 }
00222 #endif
00223 #endif //_UsbCdc_H_

Generated on Fri Dec 17 2010 12:09:22 for Multi-cell Lithium-Ion Battery Manager System using MSP430 and BQ76PL536 by  doxygen 1.7.1