replaced old versions of cdcacm

This commit is contained in:
Oleg Mazurov 2013-04-03 12:59:35 -06:00
parent ed04516c18
commit feda989245
2 changed files with 29 additions and 0 deletions

View file

@ -28,6 +28,7 @@ bControlIface(0),
bDataIface(0), bDataIface(0),
bNumEP(1), bNumEP(1),
qNextPollTime(0), qNextPollTime(0),
ready(false),
bPollEnable(false) { bPollEnable(false) {
for (uint8_t i = 0; i < ACM_MAX_ENDPOINTS; i++) { for (uint8_t i = 0; i < ACM_MAX_ENDPOINTS; i++) {
epInfo[i].epAddr = 0; epInfo[i].epAddr = 0;
@ -173,6 +174,8 @@ uint8_t ACM::Init(uint8_t parent, uint8_t port, bool lowspeed) {
goto FailOnInit; goto FailOnInit;
USBTRACE("ACM configured\r\n"); USBTRACE("ACM configured\r\n");
ready = true;
//bPollEnable = true; //bPollEnable = true;

View file

@ -89,6 +89,16 @@ e-mail : support@circuitsathome.com
#define CDC_GET_LINE_PARMS 0x35 #define CDC_GET_LINE_PARMS 0x35
#define CDC_DIAL_DIGITS 0x36 #define CDC_DIAL_DIGITS 0x36
//Class-Specific Notification Codes
#define NETWORK_CONNECTION 0x00
#define RESPONSE_AVAILABLE 0x01
#define AUX_JACK_HOOK_STATE 0x08
#define RING_DETECT 0x09
#define SERIAL_STATE 0x20
#define CALL_STATE_CHANGE 0x28
#define LINE_STATE_CHANGE 0x29
#define CONNECTION_SPEED_CHANGE 0x2a
// CDC Functional Descriptor Structures // CDC Functional Descriptor Structures
typedef struct { typedef struct {
@ -122,6 +132,16 @@ typedef struct {
uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16) uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16)
} LINE_CODING; } LINE_CODING;
typedef struct
{
uint8_t bmRequestType; // 0xa1 for class-specific notifications
uint8_t bNotification;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
uint16_t bmState; //UART state bitmap for SERIAL_STATE, other notifications variable length
} CLASS_NOTIFICATION;
class ACM; class ACM;
class CDCAsyncOper { class CDCAsyncOper {
@ -149,6 +169,7 @@ protected:
uint8_t bNumEP; // total number of EP in the configuration uint8_t bNumEP; // total number of EP in the configuration
uint32_t qNextPollTime; // next poll time uint32_t qNextPollTime; // next poll time
bool bPollEnable; // poll enable flag bool bPollEnable; // poll enable flag
bool ready; //device ready indicator
EpInfo epInfo[ACM_MAX_ENDPOINTS]; EpInfo epInfo[ACM_MAX_ENDPOINTS];
@ -164,6 +185,7 @@ public:
uint8_t GetLineCoding(LINE_CODING *dataptr); uint8_t GetLineCoding(LINE_CODING *dataptr);
uint8_t SetControlLineState(uint8_t state); uint8_t SetControlLineState(uint8_t state);
uint8_t SendBreak(uint16_t duration); uint8_t SendBreak(uint16_t duration);
uint8_t GetNotif( uint16_t *bytes_rcvd, uint8_t *dataptr );
// Methods for recieving and sending data // Methods for recieving and sending data
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr); uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
@ -178,6 +200,10 @@ public:
return bAddress; return bAddress;
}; };
virtual bool isReady() {
return ready;
};
// UsbConfigXtracter implementation // UsbConfigXtracter implementation
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep); virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
}; };