@ -36,66 +36,71 @@
# include <string.h>
/* Enable C linkage for C++ Compilers: */
# if defined(__cplusplus)
extern " C " {
# endif
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
# define REQ_GetLineEncoding 0x21
# define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
# define REQ_SetLineEncoding 0x20
# define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
# define REQ_SetControlLineState 0x22
# define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint .
*/
# define NOTIF_SerialState 0x20
# define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host , to indicate that the DTR line state should be high .
*/
# define C ONTROL_LINE_OUT_DTR (1 << 0)
# define C DC_C ONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host , to indicate that theRTS line state should be high .
*/
# define C ONTROL_LINE_OUT_RTS (1 << 1)
# define C DC_C ONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host , to indicate that the DCD line state is currently high .
*/
# define C ONTROL_LINE_IN_DCD (1 << 0)
# define C DC_C ONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host , to indicate that the DSR line state is currently high .
*/
# define C ONTROL_LINE_IN_DSR (1 << 1)
# define C DC_C ONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host , to indicate that the BREAK line state is currently high .
*/
# define C ONTROL_LINE_IN_BREAK (1 << 2)
# define C DC_C ONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host , to indicate that the RING line state is currently high .
*/
# define C ONTROL_LINE_IN_RING (1 << 3)
# define C DC_C ONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port .
*/
# define C ONTROL_LINE_IN_FRAMEERROR (1 << 4)
# define C DC_C ONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port .
*/
# define C ONTROL_LINE_IN_PARITYERROR (1 << 5)
# define C DC_C ONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port .
*/
# define C ONTROL_LINE_IN_OVERRUNERROR (1 << 6)
# define C DC_C ONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads , thus cannot be represented accurately by
@ -116,19 +121,19 @@
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
OneStopBit = 0 , /**< Each frame contains one stop bit */
OneAndAHalfStopBits = 1 , /**< Each frame contains one and a half stop bits */
TwoStopBits = 2 , /**< Each frame contains two stop bits */
CDC_LINEENCODING_ OneStopBit = 0 , /**< Each frame contains one stop bit */
CDC_LINEENCODING_ OneAndAHalfStopBits = 1 , /**< Each frame contains one and a half stop bits */
CDC_LINEENCODING_ TwoStopBits = 2 , /**< Each frame contains two stop bits */
} ;
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
Parity_None = 0 , /**< No parity bit mode on each frame */
Parity_Odd = 1 , /**< Odd parity bit mode on each frame */
Parity_Even = 2 , /**< Even parity bit mode on each frame */
Parity_Mark = 3 , /**< Mark parity bit mode on each frame */
Parity_Space = 4 , /**< Space parity bit mode on each frame */
CDC_PARITY_None = 0 , /**< No parity bit mode on each frame */
CDC_PARITY_Odd = 1 , /**< Odd parity bit mode on each frame */
CDC_PARITY_Even = 2 , /**< Even parity bit mode on each frame */
CDC_PARITY_Mark = 3 , /**< Mark parity bit mode on each frame */
CDC_PARITY_Space = 4 , /**< Space parity bit mode on each frame */
} ;
/* Type Defines: */
@ -171,7 +176,6 @@
void EVENT_USB_CDC_ControLineStateChanged ( void ) ATTR_WEAK ATTR_ALIAS ( USB_CDC_Event_Stub ) ; ;
# endif
void USB_CDC_USBTask ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
bool USB_CDC_ConfigureEndpoints ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
void USB_CDC_ProcessControlPacket ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
void USB_CDC_USBTask ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
@ -184,5 +188,10 @@
uint16_t USB_CDC_BytesReceived ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
uint8_t USB_CDC_ReceiveByte ( USB_ClassInfo_CDC_t * CDCInterfaceInfo ) ;
void USB_CDC_SendSerialLineStateChanged ( USB_ClassInfo_CDC_t * CDCInterfaceInfo , uint16_t LineStateMask ) ;
/* Disable C linkage for C++ Compilers: */
# if defined(__cplusplus)
}
# endif
# endif