mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
[sam] fixed CDC com issue in Arduino IDE
cherry pick from 96e8db0299c58fdb4dffcceace27a8b0e38c5d6f Conflicts: hardware/arduino/sam/cores/arduino/USB/USBDesc.h hardware/arduino/sam/system/libsam/source/uotghs_device.c hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt
This commit is contained in:
parent
221c10842e
commit
7b157efa7a
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#define CDC_SERIAL_BUFFER_SIZE 64
|
#define CDC_SERIAL_BUFFER_SIZE 64
|
||||||
|
|
||||||
|
/* For information purpose only since RTS is not always handled by the terminal application */
|
||||||
#define CDC_LINESTATE_DTR 0x01 // Data Terminal Ready
|
#define CDC_LINESTATE_DTR 0x01 // Data Terminal Ready
|
||||||
#define CDC_LINESTATE_RTS 0x02 // Ready to Send
|
#define CDC_LINESTATE_RTS 0x02 // Ready to Send
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ size_t Serial_::write(uint8_t c)
|
|||||||
// TODO - ZE - check behavior on different OSes and test what happens if an
|
// TODO - ZE - check behavior on different OSes and test what happens if an
|
||||||
// open connection isn't broken cleanly (cable is yanked out, host dies
|
// open connection isn't broken cleanly (cable is yanked out, host dies
|
||||||
// or locks up, or host virtual serial port hangs)
|
// or locks up, or host virtual serial port hangs)
|
||||||
if (_usbLineInfo.lineState == CDC_LINESTATE_READY)
|
if (_usbLineInfo.lineState > 0)
|
||||||
{
|
{
|
||||||
int r = USBD_Send(CDC_TX,&c,1);
|
int r = USBD_Send(CDC_TX,&c,1);
|
||||||
|
|
||||||
@ -240,7 +241,7 @@ Serial_::operator bool()
|
|||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (_usbLineInfo.lineState == CDC_LINESTATE_READY)
|
if (_usbLineInfo.lineState > 0)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -503,9 +503,12 @@ void Keyboard_::releaseAll(void)
|
|||||||
|
|
||||||
size_t Keyboard_::write(uint8_t c)
|
size_t Keyboard_::write(uint8_t c)
|
||||||
{
|
{
|
||||||
uint8_t p = press(c); // Keydown
|
uint8_t p = 0;
|
||||||
uint8_t r = release(c); // Keyup
|
|
||||||
return (p); // just return the result of press() since release() almost always returns 1
|
p = press(c); // Keydown
|
||||||
|
release(c); // Keyup
|
||||||
|
|
||||||
|
return (p); // Just return the result of press() since release() almost always returns 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2010, Peter Barrett
|
// Copyright (c) 2010, Peter Barrett
|
||||||
**
|
/*
|
||||||
** Permission to use, copy, modify, and/or distribute this software for
|
** Permission to use, copy, modify, and/or distribute this software for
|
||||||
** any purpose with or without fee is hereby granted, provided that the
|
** any purpose with or without fee is hereby granted, provided that the
|
||||||
** above copyright notice and this permission notice appear in all copies.
|
** above copyright notice and this permission notice appear in all copies.
|
||||||
@ -86,8 +86,6 @@ const DeviceDescriptor USB_DeviceDescriptor =
|
|||||||
const DeviceDescriptor USB_DeviceDescriptorA =
|
const DeviceDescriptor USB_DeviceDescriptorA =
|
||||||
D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
//==================================================================
|
//==================================================================
|
||||||
|
|
||||||
@ -361,7 +359,7 @@ static bool USBD_SendDescriptor(Setup& setup)
|
|||||||
desc_length = *desc_addr;
|
desc_length = *desc_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_CORE(printf("=> USBD_SendDescriptor : desc_addr=%x desc_length=%d\r\n", desc_addr, desc_length);)
|
TRACE_CORE(printf("=> USBD_SendDescriptor : desc_addr=%p desc_length=%d\r\n", desc_addr, desc_length);)
|
||||||
USBD_SendControl(0, desc_addr, desc_length);
|
USBD_SendControl(0, desc_addr, desc_length);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright (c) 2010, Peter Barrett
|
// Copyright (c) 2010, Peter Barrett
|
||||||
/*
|
/*
|
||||||
** Permission to use, copy, modify, and/or distribute this software for
|
** Permission to use, copy, modify, and/or distribute this software for
|
||||||
@ -238,7 +237,7 @@ typedef struct
|
|||||||
IADDescriptor iad; // Only needed on compound device
|
IADDescriptor iad; // Only needed on compound device
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
InterfaceDescriptor cif; //
|
InterfaceDescriptor cif;
|
||||||
CDCCSInterfaceDescriptor header;
|
CDCCSInterfaceDescriptor header;
|
||||||
CMFunctionalDescriptor callManagement; // Call Management
|
CMFunctionalDescriptor callManagement; // Call Management
|
||||||
ACMFunctionalDescriptor controlManagement; // ACM
|
ACMFunctionalDescriptor controlManagement; // ACM
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
|
// Copyright (c) 2010, Peter Barrett
|
||||||
|
/*
|
||||||
/* Copyright (c) 2011, Peter Barrett
|
|
||||||
**
|
|
||||||
** Permission to use, copy, modify, and/or distribute this software for
|
** Permission to use, copy, modify, and/or distribute this software for
|
||||||
** any purpose with or without fee is hereby granted, provided that the
|
** any purpose with or without fee is hereby granted, provided that the
|
||||||
** above copyright notice and this permission notice appear in all copies.
|
** above copyright notice and this permission notice appear in all copies.
|
||||||
@ -16,10 +14,12 @@
|
|||||||
** SOFTWARE.
|
** SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __USBDESC_H__
|
||||||
|
#define __USBDESC_H__
|
||||||
|
|
||||||
#define CDC_ENABLED
|
#define CDC_ENABLED
|
||||||
#define HID_ENABLED
|
#define HID_ENABLED
|
||||||
|
|
||||||
|
|
||||||
#ifdef CDC_ENABLED
|
#ifdef CDC_ENABLED
|
||||||
#define CDC_INTERFACE_COUNT 2
|
#define CDC_INTERFACE_COUNT 2
|
||||||
#define CDC_ENPOINT_COUNT 3
|
#define CDC_ENPOINT_COUNT 3
|
||||||
@ -61,3 +61,4 @@
|
|||||||
#define IMANUFACTURER 1
|
#define IMANUFACTURER 1
|
||||||
#define IPRODUCT 2
|
#define IPRODUCT 2
|
||||||
|
|
||||||
|
#endif /* __USBDESC_H__ */
|
||||||
|
@ -25,7 +25,6 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
Mouse.move(1, 0, 0);
|
Mouse.move(1, 0, 0);
|
||||||
|
|
||||||
if (Serial.available() > 0)
|
if (Serial.available() > 0)
|
||||||
|
@ -26,44 +26,30 @@ extern void UDD_WaitOUT(void) ;
|
|||||||
extern void UDD_ClearIN(void);
|
extern void UDD_ClearIN(void);
|
||||||
extern void UDD_ClearOUT(void);
|
extern void UDD_ClearOUT(void);
|
||||||
extern uint32_t UDD_WaitForINOrOUT(void);
|
extern uint32_t UDD_WaitForINOrOUT(void);
|
||||||
|
|
||||||
extern void UDD_ClearRxFlag(unsigned char bEndpoint);
|
extern void UDD_ClearRxFlag(unsigned char bEndpoint);
|
||||||
|
|
||||||
|
|
||||||
extern uint32_t UDD_ReceivedSetupInt(void);
|
extern uint32_t UDD_ReceivedSetupInt(void);
|
||||||
extern void UDD_ClearSetupInt(void);
|
extern void UDD_ClearSetupInt(void);
|
||||||
|
|
||||||
extern uint32_t UDD_ReadWriteAllowed(uint32_t ep);
|
extern uint32_t UDD_ReadWriteAllowed(uint32_t ep);
|
||||||
|
|
||||||
|
|
||||||
extern uint32_t UDD_FifoByteCount(uint32_t ep);
|
extern uint32_t UDD_FifoByteCount(uint32_t ep);
|
||||||
extern uint8_t UDD_FifoFree(void);
|
extern uint8_t UDD_FifoFree(void);
|
||||||
|
|
||||||
extern void UDD_ReleaseRX(uint32_t ep);
|
extern void UDD_ReleaseRX(uint32_t ep);
|
||||||
extern void UDD_ReleaseTX(uint32_t ep);
|
extern void UDD_ReleaseTX(uint32_t ep);
|
||||||
extern uint8_t UDD_FrameNumber(void);
|
extern uint8_t UDD_FrameNumber(void);
|
||||||
|
|
||||||
extern uint8_t UDD_GetConfiguration(void);
|
extern uint8_t UDD_GetConfiguration(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len);
|
extern uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len);
|
||||||
extern void UDD_Send8(uint32_t ep, uint8_t data );
|
extern void UDD_Send8(uint32_t ep, uint8_t data );
|
||||||
extern uint8_t UDD_Recv8(uint32_t ep);
|
extern uint8_t UDD_Recv8(uint32_t ep);
|
||||||
extern void UDD_Recv(uint32_t ep, uint8_t* data, uint32_t len);
|
extern void UDD_Recv(uint32_t ep, uint8_t* data, uint32_t len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern void UDD_InitEndpoints(const uint32_t* eps_table, const uint32_t ul_eps_table_size);
|
extern void UDD_InitEndpoints(const uint32_t* eps_table, const uint32_t ul_eps_table_size);
|
||||||
|
|
||||||
extern void UDD_InitControl(int end);
|
extern void UDD_InitControl(int end);
|
||||||
|
|
||||||
extern uint32_t UDD_Init(void);
|
extern uint32_t UDD_Init(void);
|
||||||
extern void UDD_InitEP( uint32_t ul_ep, uint32_t ul_ep_cfg );
|
extern void UDD_InitEP( uint32_t ul_ep, uint32_t ul_ep_cfg );
|
||||||
|
|
||||||
extern void UDD_Attach(void);
|
extern void UDD_Attach(void);
|
||||||
extern void UDD_Detach(void);
|
extern void UDD_Detach(void);
|
||||||
|
|
||||||
extern void UDD_SetStack(void (*pf_isr)(void));
|
extern void UDD_SetStack(void (*pf_isr)(void));
|
||||||
extern void UDD_SetAddress(uint32_t addr);
|
extern void UDD_SetAddress(uint32_t addr);
|
||||||
extern void UDD_Stall(void);
|
extern void UDD_Stall(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user