git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3260 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
8f5830dad8
commit
339cbbd60e
|
@ -33,6 +33,10 @@
|
|||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name CDC specific messages.
|
||||
* @{
|
||||
*/
|
||||
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
|
||||
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
|
||||
#define CDC_SET_COMM_FEATURE 0x02
|
||||
|
@ -52,7 +56,12 @@
|
|||
#define CDC_GET_RINGER_PARMS 0x31
|
||||
#define CDC_SET_OPERATION_PARMS 0x32
|
||||
#define CDC_GET_OPERATION_PARMS 0x33
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Line Control bit definitions.
|
||||
* @{
|
||||
*/
|
||||
#define LC_STOP_1 0
|
||||
#define LC_STOP_1P5 1
|
||||
#define LC_STOP_2 2
|
||||
|
@ -62,6 +71,7 @@
|
|||
#define LC_PARITY_EVEN 2
|
||||
#define LC_PARITY_MARK 3
|
||||
#define LC_PARITY_SPACE 4
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
|
@ -74,22 +84,22 @@
|
|||
/**
|
||||
* @brief Endpoint number for bulk IN.
|
||||
*/
|
||||
#if !defined(DATA_REQUEST_EP) || defined(__DOXYGEN__)
|
||||
#define DATA_REQUEST_EP 1
|
||||
#if !defined(USB_CDC_DATA_REQUEST_EP) || defined(__DOXYGEN__)
|
||||
#define USB_CDC_DATA_REQUEST_EP 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Endpoint number for interrupt IN.
|
||||
*/
|
||||
#if !defined(INTERRUPT_REQUEST_EP) || defined(__DOXYGEN__)
|
||||
#define INTERRUPT_REQUEST_EP 2
|
||||
#if !defined(USB_CDC_INTERRUPT_REQUEST_EP) || defined(__DOXYGEN__)
|
||||
#define USB_CDC_INTERRUPT_REQUEST_EP 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Endpoint number for bulk OUT.
|
||||
*/
|
||||
#if !defined(DATA_AVAILABLE_EP) || defined(__DOXYGEN__)
|
||||
#define DATA_AVAILABLE_EP 3
|
||||
#if !defined(USB_CDC_DATA_AVAILABLE_EP) || defined(__DOXYGEN__)
|
||||
#define USB_CDC_DATA_AVAILABLE_EP 3
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ static uint32_t pm_alloc(USBDriver *usbp, size_t size) {
|
|||
|
||||
next = usbp->pmnext;
|
||||
usbp->pmnext += size;
|
||||
chDbgAssert(usbp->pmnext > USB_PMA_SIZE, "pm_alloc(), #1", "PMA overflow");
|
||||
chDbgAssert(usbp->pmnext <= USB_PMA_SIZE, "pm_alloc(), #1", "PMA overflow");
|
||||
return next;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ static void inotify(GenericQueue *qp) {
|
|||
emptied, then a whole packet is loaded in the queue.*/
|
||||
if (chIQIsEmptyI(&sdup->iqueue)) {
|
||||
|
||||
n = usbReadPacketI(sdup->config->usbp, DATA_AVAILABLE_EP,
|
||||
n = usbReadPacketI(sdup->config->usbp, USB_CDC_DATA_AVAILABLE_EP,
|
||||
sdup->iqueue.q_buffer, SERIAL_USB_BUFFERS_SIZE);
|
||||
if (n != USB_ENDPOINT_BUSY) {
|
||||
chIOAddFlagsI(sdup, IO_INPUT_AVAILABLE);
|
||||
|
@ -146,7 +146,7 @@ static void onotify(GenericQueue *qp) {
|
|||
/* If there is any data in the output queue then it is sent within a
|
||||
single packet and the queue is emptied.*/
|
||||
n = chOQGetFullI(&sdup->oqueue);
|
||||
w = usbWritePacketI(sdup->config->usbp, DATA_REQUEST_EP,
|
||||
w = usbWritePacketI(sdup->config->usbp, USB_CDC_DATA_REQUEST_EP,
|
||||
sdup->oqueue.q_buffer, n);
|
||||
if (w != USB_ENDPOINT_BUSY) {
|
||||
chIOAddFlagsI(sdup, IO_OUTPUT_EMPTY);
|
||||
|
@ -211,10 +211,10 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) {
|
|||
"sduStart(), #1",
|
||||
"invalid state");
|
||||
sdup->config = config;
|
||||
usbStart(config->usbp, &config->usb_config);
|
||||
config->usbp->param = sdup;
|
||||
sdup->state = SDU_READY;
|
||||
chSysUnlock();
|
||||
usbStart(config->usbp, &config->usb_config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -361,7 +361,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
|
||||
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -372,7 +372,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_ENABLE_CHECKS FALSE
|
||||
#define CH_DBG_ENABLE_CHECKS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -384,7 +384,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_ENABLE_ASSERTS FALSE
|
||||
#define CH_DBG_ENABLE_ASSERTS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -395,7 +395,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_ENABLE_TRACE FALSE
|
||||
#define CH_DBG_ENABLE_TRACE TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -409,7 +409,7 @@
|
|||
* @p panic_msg variable set to @p NULL.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_ENABLE_STACK_CHECK FALSE
|
||||
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -421,7 +421,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_FILL_THREADS FALSE
|
||||
#define CH_DBG_FILL_THREADS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,7 +114,7 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
|
|||
USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class
|
||||
Interface). */
|
||||
/* Endpoint 2 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (INTERRUPT_REQUEST_EP|0x80, /* bEndpointAddress. */
|
||||
USB_DESC_ENDPOINT (USB_CDC_INTERRUPT_REQUEST_EP|0x80,
|
||||
0x03, /* bmAttributes (Interrupt). */
|
||||
0x0008, /* wMaxPacketSize. */
|
||||
0xFF), /* bInterval. */
|
||||
|
@ -130,12 +130,12 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
|
|||
4.7). */
|
||||
0x00), /* iInterface. */
|
||||
/* Endpoint 3 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (DATA_AVAILABLE_EP, /* bEndpointAddress. */
|
||||
USB_DESC_ENDPOINT (USB_CDC_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00), /* bInterval. */
|
||||
/* Endpoint 1 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (DATA_REQUEST_EP|0x80, /* bEndpointAddress. */
|
||||
USB_DESC_ENDPOINT (USB_CDC_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00) /* bInterval. */
|
||||
|
@ -282,9 +282,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
Note, this callback is invoked from an ISR so I-Class functions
|
||||
must be used.*/
|
||||
chSysLockFromIsr();
|
||||
usbInitEndpointI(usbp, DATA_REQUEST_EP, &ep1config);
|
||||
usbInitEndpointI(usbp, INTERRUPT_REQUEST_EP, &ep2config);
|
||||
usbInitEndpointI(usbp, DATA_AVAILABLE_EP, &ep3config);
|
||||
usbInitEndpointI(usbp, USB_CDC_DATA_REQUEST_EP, &ep1config);
|
||||
usbInitEndpointI(usbp, USB_CDC_INTERRUPT_REQUEST_EP, &ep2config);
|
||||
usbInitEndpointI(usbp, USB_CDC_DATA_AVAILABLE_EP, &ep3config);
|
||||
chSysUnlockFromIsr();
|
||||
return;
|
||||
case USB_EVENT_SUSPEND:
|
||||
|
|
Loading…
Reference in New Issue