From 5a89ff85110f381501940a05db76f25294dcc784 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 17:11:51 +0100 Subject: [PATCH 01/15] Control iAP EA Protocol Native Transport #define --- module_usb_audio/devicedefines.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index 69a77662..0d8565e9 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -902,6 +902,11 @@ #undef IAP_INT_EP #endif +/* IAP EA Native Transport */ +#if defined(IAP_EA_NATIVE) && (IAP_EA_NATIVE == 0) +#undef IAP_EA_NATIVE +#endif + /* Endpoint addresses enums */ enum USBEndpointNumber_In { From f99e17d8780a15b9ce4ea8677a2fb5d0dbf71cb8 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 17:12:29 +0100 Subject: [PATCH 02/15] Define iAP EA Protocol Native transport EP numbers --- module_usb_audio/devicedefines.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index 0d8565e9..c656db6f 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -927,6 +927,9 @@ enum USBEndpointNumber_In ENDPOINT_NUMBER_IN_IAP_INT, #endif ENDPOINT_NUMBER_IN_IAP, +#ifdef IAP_EA_NATIVE + ENDPOINT_NUMBER_IN_IAP_EA_NATIVE, +#endif #endif ENDPOINT_COUNT_IN /* End marker */ }; @@ -940,6 +943,9 @@ enum USBEndpointNumber_Out #endif #ifdef IAP ENDPOINT_NUMBER_OUT_IAP, +#ifdef IAP_EA_NATIVE + ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE, +#endif #endif ENDPOINT_COUNT_OUT /* End marker */ }; From ec845dfddcb772d083f80e032772789a66b4d46c Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 17:25:58 +0100 Subject: [PATCH 03/15] Added iAP EA Native Transport interface and EPs --- module_usb_audio/endpoint0/descriptors.h | 103 ++++++++++++++++++++--- 1 file changed, 91 insertions(+), 12 deletions(-) diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index 631164c9..f2f57a4f 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -12,6 +12,19 @@ #include "usbaudiocommon.h" #include "usb_std_descriptors.h" +#ifdef IAP_EA_NATIVE +/* + * FIXME currently this will not build if IAP_EA_NATIVE_PROTOCOL_NAME is not defined in iap_conf.h, + * would be nice if a default string was used instead, and a warning issued. + * + * Could get a default define by including the following line, but iap2.h cannot currently be included from C + */ +//#include "iap2.h" /* Defines iAP EA Native Transport protocol name */ +#ifdef __iap_conf_h_exists__ +#include "iap_conf.h" +#endif +#endif + #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x #define APPEND_PRODUCT_STR_A2(x) PRODUCT_STR_A2 " "#x @@ -172,6 +185,7 @@ typedef struct #error NUM_USB_CHAN > 18 #endif STR_TABLE_ENTRY(iAPInterfaceStr); + STR_TABLE_ENTRY(iAP_EANative_InterfaceStr); } StringDescTable_t; StringDescTable_t g_strTable = @@ -587,6 +601,7 @@ StringDescTable_t g_strTable = #error NUM_USB_CHAN > 18 #endif .iAPInterfaceStr = "iAP Interface", + .iAP_EANative_InterfaceStr = IAP_EA_NATIVE_PROTOCOL_NAME, }; @@ -609,6 +624,9 @@ enum USBInterfaceNumber #endif #if defined(IAP) && (IAP != 0) INTERFACE_NUMBER_IAP, +#if defined(IAP_EA_NATIVE) && (IAP_EA_NATIVE != 0) + INTERFACE_NUMBER_IAP_EA_NATIVE, +#endif #endif #if defined(HID_CONTROLS) && (HID_CONTROLS != 0) INTERFACE_NUMBER_HID, @@ -625,19 +643,21 @@ enum USBInterfaceNumber #endif /* Endpoint address defines */ -#define ENDPOINT_ADDRESS_IN_CONTROL (ENDPOINT_NUMBER_IN_CONTROL | 0x80) -#define ENDPOINT_ADDRESS_IN_FEEDBACK (ENDPOINT_NUMBER_IN_FEEDBACK | 0x80) -#define ENDPOINT_ADDRESS_IN_AUDIO (ENDPOINT_NUMBER_IN_AUDIO | 0x80) -#define ENDPOINT_ADDRESS_IN_INTERRUPT (ENDPOINT_NUMBER_IN_INTERRUPT | 0x80) -#define ENDPOINT_ADDRESS_IN_MIDI (ENDPOINT_NUMBER_IN_MIDI | 0x80) -#define ENDPOINT_ADDRESS_IN_HID (ENDPOINT_NUMBER_IN_HID | 0x80) -#define ENDPOINT_ADDRESS_IN_IAP_INT (ENDPOINT_NUMBER_IN_IAP_INT | 0x80) -#define ENDPOINT_ADDRESS_IN_IAP (ENDPOINT_NUMBER_IN_IAP | 0x80) +#define ENDPOINT_ADDRESS_IN_CONTROL (ENDPOINT_NUMBER_IN_CONTROL | 0x80) +#define ENDPOINT_ADDRESS_IN_FEEDBACK (ENDPOINT_NUMBER_IN_FEEDBACK | 0x80) +#define ENDPOINT_ADDRESS_IN_AUDIO (ENDPOINT_NUMBER_IN_AUDIO | 0x80) +#define ENDPOINT_ADDRESS_IN_INTERRUPT (ENDPOINT_NUMBER_IN_INTERRUPT | 0x80) +#define ENDPOINT_ADDRESS_IN_MIDI (ENDPOINT_NUMBER_IN_MIDI | 0x80) +#define ENDPOINT_ADDRESS_IN_HID (ENDPOINT_NUMBER_IN_HID | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP_INT (ENDPOINT_NUMBER_IN_IAP_INT | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP (ENDPOINT_NUMBER_IN_IAP | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE (ENDPOINT_NUMBER_IN_IAP_EA_NATIVE | 0x80) -#define ENDPOINT_ADDRESS_OUT_CONTROL (ENDPOINT_NUMBER_OUT_CONTROL) -#define ENDPOINT_ADDRESS_OUT_AUDIO (ENDPOINT_NUMBER_OUT_AUDIO) -#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI) -#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP) +#define ENDPOINT_ADDRESS_OUT_CONTROL (ENDPOINT_NUMBER_OUT_CONTROL) +#define ENDPOINT_ADDRESS_OUT_AUDIO (ENDPOINT_NUMBER_OUT_AUDIO) +#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI) +#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP) +#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE) /***** Device Descriptors *****/ @@ -919,6 +939,12 @@ typedef struct #ifdef IAP_INT_EP USB_Descriptor_Endpoint_t iAP_Interrupt_Endpoint; #endif +#ifdef IAP_EA_NATIVE + USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt0; + USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt1; + USB_Descriptor_Endpoint_t iAP_EANatvieTransport_Out_Endpoint; + USB_Descriptor_Endpoint_t iAP_EANativeTransport_In_Endpoint; +#endif #endif #ifdef HID_CONTROLS @@ -1839,6 +1865,59 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x08, /* 6 bInterval : (2^(bInterval-1))/8 ms. Must be between 4 and 32ms (field size 1 bytes) */ }, #endif +#ifdef IAP_EA_NATIVE + /* Zero bandwidth alternative 0 */ + /* iAP EA Native Transport Interface descriptor */ + .iAP_EANativeTransport_Interface_Alt0 = + { + .bLength = sizeof(USB_Descriptor_Interface_t), + .bDescriptorType = USB_DESCTYPE_INTERFACE, + .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x00, + .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, + .bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 21-2) */ + .bInterfaceProtocol = 0x01, + .iInterface = offsetof(StringDescTable_t, iAP_EANative_InterfaceStr)/sizeof(char *), + }, + + /* Alternative 1 */ + /* iAP EA Native Transport Interface descriptor */ + .iAP_EANativeTransport_Interface_Alt1 = + { + .bLength = sizeof(USB_Descriptor_Interface_t), + .bDescriptorType = USB_DESCTYPE_INTERFACE, + .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE, + .bAlternateSetting = 0x01, + .bNumEndpoints = 0x02, + .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, + .bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 21-1) */ + .bInterfaceProtocol = 0x01, + .iInterface = offsetof(StringDescTable_t, iAP_EANative_InterfaceStr)/sizeof(char *), + }, + + /* iAP EA Native Transport Bulk OUT Endpoint Descriptor */ + .iAP_Out_Endpoint = + { + 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ + 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ + ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ + 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ + 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ + 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ + }, + + /* iAP EA Native Transport Bulk IN Endpoint Descriptor */ + .iAP_In_Endpoint = + { + 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ + 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ + ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ + 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ + 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ + 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ + }, +#endif #endif /* IAP */ #ifdef HID_CONTROLS From 46a31e7475c68605353904504ef420403eba6255 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 18:35:43 +0100 Subject: [PATCH 04/15] Use correct struct names for iAP EA Native Transport EPs --- module_usb_audio/endpoint0/descriptors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index f2f57a4f..3c1c035f 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -942,7 +942,7 @@ typedef struct #ifdef IAP_EA_NATIVE USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt0; USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt1; - USB_Descriptor_Endpoint_t iAP_EANatvieTransport_Out_Endpoint; + USB_Descriptor_Endpoint_t iAP_EANativeTransport_Out_Endpoint; USB_Descriptor_Endpoint_t iAP_EANativeTransport_In_Endpoint; #endif #endif @@ -1897,7 +1897,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }, /* iAP EA Native Transport Bulk OUT Endpoint Descriptor */ - .iAP_Out_Endpoint = + .iAP_EANativeTransport_Out_Endpoint = { 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ @@ -1908,7 +1908,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }, /* iAP EA Native Transport Bulk IN Endpoint Descriptor */ - .iAP_In_Endpoint = + .iAP_EANativeTransport_In_Endpoint = { 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ From 87641ac724635dd7cf31897a075abaab5580cf3d Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 18:42:06 +0100 Subject: [PATCH 05/15] Improved consistency of iAP EA Native Transport interface string name --- module_usb_audio/endpoint0/descriptors.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index 3c1c035f..111a7673 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -185,7 +185,7 @@ typedef struct #error NUM_USB_CHAN > 18 #endif STR_TABLE_ENTRY(iAPInterfaceStr); - STR_TABLE_ENTRY(iAP_EANative_InterfaceStr); + STR_TABLE_ENTRY(iAP_EANativeTransport_InterfaceStr); } StringDescTable_t; StringDescTable_t g_strTable = @@ -601,7 +601,7 @@ StringDescTable_t g_strTable = #error NUM_USB_CHAN > 18 #endif .iAPInterfaceStr = "iAP Interface", - .iAP_EANative_InterfaceStr = IAP_EA_NATIVE_PROTOCOL_NAME, + .iAP_EANativeTransport_InterfaceStr = IAP_EA_NATIVE_PROTOCOL_NAME, }; @@ -1878,7 +1878,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, .bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 21-2) */ .bInterfaceProtocol = 0x01, - .iInterface = offsetof(StringDescTable_t, iAP_EANative_InterfaceStr)/sizeof(char *), + .iInterface = offsetof(StringDescTable_t, iAP_EANativeTransport_InterfaceStr)/sizeof(char *), }, /* Alternative 1 */ @@ -1893,7 +1893,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, .bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 21-1) */ .bInterfaceProtocol = 0x01, - .iInterface = offsetof(StringDescTable_t, iAP_EANative_InterfaceStr)/sizeof(char *), + .iInterface = offsetof(StringDescTable_t, iAP_EANativeTransport_InterfaceStr)/sizeof(char *), }, /* iAP EA Native Transport Bulk OUT Endpoint Descriptor */ From 1bbee4b977b1c9519a1c0db07db9d34a0cc39e83 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Fri, 13 Jun 2014 18:47:10 +0100 Subject: [PATCH 06/15] IAP_EA_NATIVE -> IAP_EA_NATIVE_TRANS --- module_usb_audio/devicedefines.h | 12 ++-- module_usb_audio/endpoint0/descriptors.h | 72 ++++++++++++------------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index c656db6f..ff82e572 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -903,8 +903,8 @@ #endif /* IAP EA Native Transport */ -#if defined(IAP_EA_NATIVE) && (IAP_EA_NATIVE == 0) -#undef IAP_EA_NATIVE +#if defined(IAP_EA_NATIVE_TRANS) && (IAP_EA_NATIVE_TRANS == 0) +#undef IAP_EA_NATIVE_TRANS #endif /* Endpoint addresses enums */ @@ -927,8 +927,8 @@ enum USBEndpointNumber_In ENDPOINT_NUMBER_IN_IAP_INT, #endif ENDPOINT_NUMBER_IN_IAP, -#ifdef IAP_EA_NATIVE - ENDPOINT_NUMBER_IN_IAP_EA_NATIVE, +#ifdef IAP_EA_NATIVE_TRANS + ENDPOINT_NUMBER_IN_IAP_EA_NATIVE_TRANS, #endif #endif ENDPOINT_COUNT_IN /* End marker */ @@ -943,8 +943,8 @@ enum USBEndpointNumber_Out #endif #ifdef IAP ENDPOINT_NUMBER_OUT_IAP, -#ifdef IAP_EA_NATIVE - ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE, +#ifdef IAP_EA_NATIVE_TRANS + ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS, #endif #endif ENDPOINT_COUNT_OUT /* End marker */ diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index 111a7673..6725a9db 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -12,9 +12,9 @@ #include "usbaudiocommon.h" #include "usb_std_descriptors.h" -#ifdef IAP_EA_NATIVE +#ifdef IAP_EA_NATIVE_TRANS /* - * FIXME currently this will not build if IAP_EA_NATIVE_PROTOCOL_NAME is not defined in iap_conf.h, + * FIXME currently this will not build if IAP_EA_NATIVE_TRANS_PROTOCOL_NAME is not defined in iap_conf.h, * would be nice if a default string was used instead, and a warning issued. * * Could get a default define by including the following line, but iap2.h cannot currently be included from C @@ -600,8 +600,8 @@ StringDescTable_t g_strTable = #if (NUM_USB_CHAN_IN > 18) #error NUM_USB_CHAN > 18 #endif - .iAPInterfaceStr = "iAP Interface", - .iAP_EANativeTransport_InterfaceStr = IAP_EA_NATIVE_PROTOCOL_NAME, + .iAPInterfaceStr = "iAP Interface", + .iAP_EANativeTransport_InterfaceStr = IAP_EA_NATIVE_TRANS_PROTOCOL_NAME, }; @@ -624,8 +624,8 @@ enum USBInterfaceNumber #endif #if defined(IAP) && (IAP != 0) INTERFACE_NUMBER_IAP, -#if defined(IAP_EA_NATIVE) && (IAP_EA_NATIVE != 0) - INTERFACE_NUMBER_IAP_EA_NATIVE, +#if defined(IAP_EA_NATIVE_TRANS) && (IAP_EA_NATIVE_TRANS != 0) + INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS, #endif #endif #if defined(HID_CONTROLS) && (HID_CONTROLS != 0) @@ -643,21 +643,21 @@ enum USBInterfaceNumber #endif /* Endpoint address defines */ -#define ENDPOINT_ADDRESS_IN_CONTROL (ENDPOINT_NUMBER_IN_CONTROL | 0x80) -#define ENDPOINT_ADDRESS_IN_FEEDBACK (ENDPOINT_NUMBER_IN_FEEDBACK | 0x80) -#define ENDPOINT_ADDRESS_IN_AUDIO (ENDPOINT_NUMBER_IN_AUDIO | 0x80) -#define ENDPOINT_ADDRESS_IN_INTERRUPT (ENDPOINT_NUMBER_IN_INTERRUPT | 0x80) -#define ENDPOINT_ADDRESS_IN_MIDI (ENDPOINT_NUMBER_IN_MIDI | 0x80) -#define ENDPOINT_ADDRESS_IN_HID (ENDPOINT_NUMBER_IN_HID | 0x80) -#define ENDPOINT_ADDRESS_IN_IAP_INT (ENDPOINT_NUMBER_IN_IAP_INT | 0x80) -#define ENDPOINT_ADDRESS_IN_IAP (ENDPOINT_NUMBER_IN_IAP | 0x80) -#define ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE (ENDPOINT_NUMBER_IN_IAP_EA_NATIVE | 0x80) +#define ENDPOINT_ADDRESS_IN_CONTROL (ENDPOINT_NUMBER_IN_CONTROL | 0x80) +#define ENDPOINT_ADDRESS_IN_FEEDBACK (ENDPOINT_NUMBER_IN_FEEDBACK | 0x80) +#define ENDPOINT_ADDRESS_IN_AUDIO (ENDPOINT_NUMBER_IN_AUDIO | 0x80) +#define ENDPOINT_ADDRESS_IN_INTERRUPT (ENDPOINT_NUMBER_IN_INTERRUPT | 0x80) +#define ENDPOINT_ADDRESS_IN_MIDI (ENDPOINT_NUMBER_IN_MIDI | 0x80) +#define ENDPOINT_ADDRESS_IN_HID (ENDPOINT_NUMBER_IN_HID | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP_INT (ENDPOINT_NUMBER_IN_IAP_INT | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP (ENDPOINT_NUMBER_IN_IAP | 0x80) +#define ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_IN_IAP_EA_NATIVE_TRANS | 0x80) -#define ENDPOINT_ADDRESS_OUT_CONTROL (ENDPOINT_NUMBER_OUT_CONTROL) -#define ENDPOINT_ADDRESS_OUT_AUDIO (ENDPOINT_NUMBER_OUT_AUDIO) -#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI) -#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP) -#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE) +#define ENDPOINT_ADDRESS_OUT_CONTROL (ENDPOINT_NUMBER_OUT_CONTROL) +#define ENDPOINT_ADDRESS_OUT_AUDIO (ENDPOINT_NUMBER_OUT_AUDIO) +#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI) +#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP) +#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS) /***** Device Descriptors *****/ @@ -939,7 +939,7 @@ typedef struct #ifdef IAP_INT_EP USB_Descriptor_Endpoint_t iAP_Interrupt_Endpoint; #endif -#ifdef IAP_EA_NATIVE +#ifdef IAP_EA_NATIVE_TRANS USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt0; USB_Descriptor_Interface_t iAP_EANativeTransport_Interface_Alt1; USB_Descriptor_Endpoint_t iAP_EANativeTransport_Out_Endpoint; @@ -1865,14 +1865,14 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x08, /* 6 bInterval : (2^(bInterval-1))/8 ms. Must be between 4 and 32ms (field size 1 bytes) */ }, #endif -#ifdef IAP_EA_NATIVE +#ifdef IAP_EA_NATIVE_TRANS /* Zero bandwidth alternative 0 */ /* iAP EA Native Transport Interface descriptor */ .iAP_EANativeTransport_Interface_Alt0 = { .bLength = sizeof(USB_Descriptor_Interface_t), .bDescriptorType = USB_DESCTYPE_INTERFACE, - .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE, + .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS, .bAlternateSetting = 0x00, .bNumEndpoints = 0x00, .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, @@ -1887,7 +1887,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= { .bLength = sizeof(USB_Descriptor_Interface_t), .bDescriptorType = USB_DESCTYPE_INTERFACE, - .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE, + .bInterfaceNumber = INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS, .bAlternateSetting = 0x01, .bNumEndpoints = 0x02, .bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC, @@ -1899,23 +1899,23 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= /* iAP EA Native Transport Bulk OUT Endpoint Descriptor */ .iAP_EANativeTransport_Out_Endpoint = { - 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ - 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ - ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ - 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ - 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ - 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ + 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ + 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ + ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ + 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ + 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ + 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ }, /* iAP EA Native Transport Bulk IN Endpoint Descriptor */ .iAP_EANativeTransport_In_Endpoint = { - 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ - 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ - ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ - 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ - 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ - 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ + 0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ + 0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */ + ENDPOINT_ADDRESS_IN_IAP_EA_NATIVE_TRANS, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */ + 0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */ + 0x0200, //TODO check this /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/ + 0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */ }, #endif #endif /* IAP */ From 012f4fbba3cd3d83c8b6641e478d7e36ea756a55 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Wed, 18 Jun 2014 10:57:29 +0100 Subject: [PATCH 07/15] Avoid error on non iAP EAP builds --- module_usb_audio/endpoint0/descriptors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index 6725a9db..ccb92a1d 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -601,8 +601,9 @@ StringDescTable_t g_strTable = #error NUM_USB_CHAN > 18 #endif .iAPInterfaceStr = "iAP Interface", +#ifdef IAP_EA_NATIVE_TRANS .iAP_EANativeTransport_InterfaceStr = IAP_EA_NATIVE_TRANS_PROTOCOL_NAME, - +#endif }; /* Interface numbers enum */ From a84ed67cd50967ec35c0ae50c15b254549558b0a Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:12:19 +0100 Subject: [PATCH 08/15] Added define for the number of alternative settings on the iAP EA Native Transport interface --- module_usb_audio/devicedefines.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index ff82e572..bfaa908c 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -907,6 +907,22 @@ #undef IAP_EA_NATIVE_TRANS #endif +#if defined(IAP_EA_NATIVE_TRANS) || defined(__DOXYGEN__) +/** + * @brief Number of supported EA Native Interface Alternative settings. + * + * Only 1 supported + */ +#ifndef IAP_EA_NATIVE_TRANS_ALT_COUNT + #define IAP_EA_NATIVE_TRANS_ALT_COUNT 1 +#endif + +#if (IAP_EA_NATIVE_TRANS_ALT_COUNT > 1) + /* Only 1 supported */ + #error +#endif +#endif + /* Endpoint addresses enums */ enum USBEndpointNumber_In { From cbe78f355c6733f969dc0fa07be951f6110c48ee Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:14:24 +0100 Subject: [PATCH 09/15] iAP EA Native Transport Eps added to epTypeTables --- module_usb_audio/main.xc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index 5559f4ad..bac09ed6 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -180,7 +180,10 @@ XUD_EpType epTypeTableOut[ENDPOINT_COUNT_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_EN XUD_EPTYPE_BUL, /* MIDI */ #endif #ifdef IAP - XUD_EPTYPE_BUL /* iAP */ + XUD_EPTYPE_BUL, /* iAP */ +#ifdef IAP_EA_NATIVE_TRANS + XUD_EPTYPE_BUL, /* EA Native Transport */ +#endif #endif }; @@ -201,6 +204,9 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB #ifdef IAP_INT_EP XUD_EPTYPE_BUL | XUD_STATUS_ENABLE, #endif +#ifdef IAP_EA_NATIVE_TRANS + XUD_EPTYPE_BUL | XUD_STATUS_ENABLE, +#endif #endif }; From 201c899f237c458120d65ce43bc50004e5fd7f30 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:22:51 +0100 Subject: [PATCH 10/15] EP0 changed to use switch statement when handling USB_SET_INTERFACE requests --- module_usb_audio/endpoint0/endpoint0.c | 182 +++++++++++++------------ 1 file changed, 96 insertions(+), 86 deletions(-) diff --git a/module_usb_audio/endpoint0/endpoint0.c b/module_usb_audio/endpoint0/endpoint0.c index cbc9d77c..ce16785b 100755 --- a/module_usb_audio/endpoint0/endpoint0.c +++ b/module_usb_audio/endpoint0/endpoint0.c @@ -268,102 +268,112 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, /* Over-riding USB_StandardRequests implementation */ if(sp.bRequest == USB_SET_INTERFACE) { - /* Check for audio stream from host start/stop */ - if(sp.wIndex == 1) /* Output interface */ + switch (sp.wIndex) { - /* Check the alt is in range */ - if(sp.wValue <= OUTPUT_FORMAT_COUNT) - { - /* Alt 0 is stream stop */ - /* Only send change if we need to */ - if((sp.wValue > 0) && (g_curStreamAlt_Out != sp.wValue)) + /* Check for audio stream from host start/stop */ + case INTERFACE_NUMBER_AUDIO_OUTPUT: + /* Check the alt is in range */ + if(sp.wValue <= OUTPUT_FORMAT_COUNT) { - g_curStreamAlt_Out = sp.wValue; - - /* Send format of data onto buffering */ - outuint(c_audioControl, SET_STREAM_FORMAT_OUT); - outuint(c_audioControl, g_dataFormat_Out[sp.wValue-1]); /* Data format (PCM/DSD) */ - - if(g_curUsbSpeed == XUD_SPEED_HS) + /* Alt 0 is stream stop */ + /* Only send change if we need to */ + if((sp.wValue > 0) && (g_curStreamAlt_Out != sp.wValue)) { - outuint(c_audioControl, NUM_USB_CHAN_OUT); /* Channel count */ - outuint(c_audioControl, g_subSlot_Out_HS[sp.wValue-1]); /* Subslot */ - outuint(c_audioControl, g_sampRes_Out_HS[sp.wValue-1]); /* Resolution */ - } - else - { - outuint(c_audioControl, NUM_USB_CHAN_OUT_FS); /* Channel count */ - outuint(c_audioControl, g_subSlot_Out_FS[sp.wValue-1]); /* Subslot */ - outuint(c_audioControl, g_sampRes_Out_FS[sp.wValue-1]); /* Resolution */ - } + g_curStreamAlt_Out = sp.wValue; - /* Handshake */ - chkct(c_audioControl, XS1_CT_END); + /* Send format of data onto buffering */ + outuint(c_audioControl, SET_STREAM_FORMAT_OUT); + outuint(c_audioControl, g_dataFormat_Out[sp.wValue-1]); /* Data format (PCM/DSD) */ + + if(g_curUsbSpeed == XUD_SPEED_HS) + { + outuint(c_audioControl, NUM_USB_CHAN_OUT); /* Channel count */ + outuint(c_audioControl, g_subSlot_Out_HS[sp.wValue-1]); /* Subslot */ + outuint(c_audioControl, g_sampRes_Out_HS[sp.wValue-1]); /* Resolution */ + } + else + { + outuint(c_audioControl, NUM_USB_CHAN_OUT_FS); /* Channel count */ + outuint(c_audioControl, g_subSlot_Out_FS[sp.wValue-1]); /* Subslot */ + outuint(c_audioControl, g_sampRes_Out_FS[sp.wValue-1]); /* Resolution */ + } + + /* Handshake */ + chkct(c_audioControl, XS1_CT_END); + } } - } + break; + case INTERFACE_NUMBER_AUDIO_INPUT: + /* Check the alt is in range */ + if(sp.wValue <= INPUT_FORMAT_COUNT) + { + /* Alt 0 is stream stop */ + /* Only send change if we need to */ + if((sp.wValue > 0) && (g_curStreamAlt_In != sp.wValue)) + { + g_curStreamAlt_In = sp.wValue; + + /* Send format of data onto buffering */ + outuint(c_audioControl, SET_STREAM_FORMAT_IN); + outuint(c_audioControl, g_dataFormat_In[sp.wValue-1]); /* Data format (PCM/DSD) */ + + if(g_curUsbSpeed == XUD_SPEED_HS) + { + outuint(c_audioControl, NUM_USB_CHAN_IN); /* Channel count */ + outuint(c_audioControl, g_subSlot_In_HS[sp.wValue-1]); /* Subslot */ + outuint(c_audioControl, g_sampRes_In_HS[sp.wValue-1]); /* Resolution */ + } + else + { + outuint(c_audioControl, NUM_USB_CHAN_IN_FS); /* Channel count */ + outuint(c_audioControl, g_subSlot_In_FS[sp.wValue-1]); /* Subslot */ + outuint(c_audioControl, g_sampRes_In_FS[sp.wValue-1]); /* Resolution */ + } + + /* Handshake */ + chkct(c_audioControl, XS1_CT_END); + } + } + break; + { + + default: + /* Unhandled interface */ + break; } - else if(sp.wIndex == 2) /* Input interface */ + + if ((sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) || (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT)) { - /* Check the alt is in range */ - if(sp.wValue <= INPUT_FORMAT_COUNT) - { - /* Alt 0 is stream stop */ - /* Only send change if we need to */ - if((sp.wValue > 0) && (g_curStreamAlt_In != sp.wValue)) - { - g_curStreamAlt_In = sp.wValue; - - /* Send format of data onto buffering */ - outuint(c_audioControl, SET_STREAM_FORMAT_IN); - outuint(c_audioControl, g_dataFormat_In[sp.wValue-1]); /* Data format (PCM/DSD) */ - - if(g_curUsbSpeed == XUD_SPEED_HS) - { - outuint(c_audioControl, NUM_USB_CHAN_IN); /* Channel count */ - outuint(c_audioControl, g_subSlot_In_HS[sp.wValue-1]); /* Subslot */ - outuint(c_audioControl, g_sampRes_In_HS[sp.wValue-1]); /* Resolution */ - } - else - { - outuint(c_audioControl, NUM_USB_CHAN_IN_FS); /* Channel count */ - outuint(c_audioControl, g_subSlot_In_FS[sp.wValue-1]); /* Subslot */ - outuint(c_audioControl, g_sampRes_In_FS[sp.wValue-1]); /* Resolution */ - } - - /* Handshake */ - chkct(c_audioControl, XS1_CT_END); - } - } - } #if (NUM_USB_CHAN_OUT > 0) && (NUM_USB_CHAN_IN > 0) - /* Check for stream start stop on output and input audio interfaces */ - if(sp.wValue && !g_interfaceAlt[1] && !g_interfaceAlt[2]) - { - /* If start and input AND output not currently running */ - UserAudioStreamStart(); - } - else if(((sp.wIndex == 1) && (!sp.wValue)) && g_interfaceAlt[1] && (!g_interfaceAlt[2])) - { - /* if output stop and output running and input not running */ - UserAudioStreamStop(); - } - else if(((sp.wIndex == 2) && (!sp.wValue)) && g_interfaceAlt[2] && (!g_interfaceAlt[1])) - { - /* if input stop and input running and output not running */ - UserAudioStreamStop(); - } + /* Check for stream start stop on output and input audio interfaces */ + if(sp.wValue && !g_interfaceAlt[1] && !g_interfaceAlt[2]) + { + /* If start and input AND output not currently running */ + UserAudioStreamStart(); + } + else if(((sp.wIndex == 1) && (!sp.wValue)) && g_interfaceAlt[1] && (!g_interfaceAlt[2])) + { + /* if output stop and output running and input not running */ + UserAudioStreamStop(); + } + else if(((sp.wIndex == 2) && (!sp.wValue)) && g_interfaceAlt[2] && (!g_interfaceAlt[1])) + { + /* if input stop and input running and output not running */ + UserAudioStreamStop(); + } #elif (NUM_USB_CHAN_OUT > 0) || (NUM_USB_CHAN_IN > 0) - if(sp.wValue && (!g_interfaceAlt[1])) - { - /* if start and not currently running */ - UserAudioStreamStart(); - } - else if (!sp.wValue && g_interfaceAlt[1]) - { - /* if stop and currently running */ - UserAudioStreamStop(); - } + if(sp.wValue && (!g_interfaceAlt[1])) + { + /* if start and not currently running */ + UserAudioStreamStart(); + } + else if (!sp.wValue && g_interfaceAlt[1]) + { + /* if stop and currently running */ + UserAudioStreamStop(); + } #endif + } } /* if(sp.bRequest == SET_INTERFACE) */ break; /* BMREQ_H2D_STANDARD_INT */ From 0870c3edc8b430eb22e01df6f69466cb2b928749 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:24:21 +0100 Subject: [PATCH 11/15] Additional chanend passed to Endpoint0 for iAP EA Native Transport support --- module_usb_audio/endpoint0/endpoint0.c | 2 +- module_usb_audio/endpoint0/endpoint0.h | 5 ++++- module_usb_audio/main.xc | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/module_usb_audio/endpoint0/endpoint0.c b/module_usb_audio/endpoint0/endpoint0.c index ce16785b..e1591a55 100755 --- a/module_usb_audio/endpoint0/endpoint0.c +++ b/module_usb_audio/endpoint0/endpoint0.c @@ -159,7 +159,7 @@ const unsigned g_dataFormat_In[INPUT_FORMAT_COUNT] = {STREAM_FORMAT_INPUT_1_DATA /* Endpoint 0 function. Handles all requests to the device */ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend c_mix_ctl, chanend c_clk_ctl) + chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl) { USB_SetupPacket_t sp; XUD_ep ep0_out = XUD_InitEp(c_ep0_out); diff --git a/module_usb_audio/endpoint0/endpoint0.h b/module_usb_audio/endpoint0/endpoint0.h index be2171fa..778d0937 100644 --- a/module_usb_audio/endpoint0/endpoint0.h +++ b/module_usb_audio/endpoint0/endpoint0.h @@ -14,8 +14,11 @@ * \param c_clk_ctl Optional chanend to be connected to the clockgen thread if * present. * \param c_usb_test Optional chanend to be connected to XUD if test modes required. + * + * \param c_EANativeTransport_ctrl Optional chanend to be connected to EA Native + * endpoint manager if present */ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl, - chanend ?c_mix_ctl,chanend ?c_clk_ctl); + chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl); #endif diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index bac09ed6..57db3a29 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -260,6 +260,12 @@ void usb_audio_core(chanend c_mix_out #ifndef MIXER #define c_mix_ctl null +#endif + +#ifdef IAP_EA_NATIVE_TRANS + chan c_EANativeTransport_ctrl; +#else +#define c_EANativeTransport_ctrl null #endif par @@ -326,7 +332,7 @@ void usb_audio_core(chanend c_mix_out /* Endpoint 0 Core */ { thread_speed(); - Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, null); + Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, null, c_EANativeTransport_ctrl); } /* Decoupling core */ From 73b2e5f27e41534499fcfc7917d3a51d7eadfa9e Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:25:32 +0100 Subject: [PATCH 12/15] Endpoint0 now sends notification that the EA Native Transport interface alternative setting has changed --- module_usb_audio/endpoint0/endpoint0.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module_usb_audio/endpoint0/endpoint0.c b/module_usb_audio/endpoint0/endpoint0.c index e1591a55..cfd28db4 100755 --- a/module_usb_audio/endpoint0/endpoint0.c +++ b/module_usb_audio/endpoint0/endpoint0.c @@ -335,8 +335,24 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, } } break; +#ifdef IAP_EA_NATIVE_TRANS + case INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS: + /* Check the alt is in range */ + if (sp.wValue <= IAP_EA_NATIVE_TRANS_ALT_COUNT) //FIXME is this check required? + /* Alt 0 is EA Protocol stop */ + /* Only send change if we need to */ + //TODO if ((sp.wValue > 0) && g_eaNativeTransportAlt != sp.wValue))? { + //TODO g_eaNativeTransportAlt = sp.wValue;? + /* Send selected Alt interface number onto EA Native EP manager */ + outuint(c_EANativeTransport_ctrl, sp.wValue); + + /* Handshake */ + chkct(c_EANativeTransport_ctrl, XS1_CT_END); + } + break; +#endif default: /* Unhandled interface */ break; From cff84f1786d78d19b177cecc15cbf82170f4c62f Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 29 Jul 2014 15:26:16 +0100 Subject: [PATCH 13/15] iAP EA Native Transport endpoint manager core added to tile 0 --- module_usb_audio/main.xc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index 57db3a29..53ab6737 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -243,6 +243,9 @@ void usb_audio_core(chanend c_mix_out #endif #ifdef IAP , chanend c_iap +#ifdef IAP_EA_NATIVE_TRANS +, chanend c_ea_data +#endif #endif #ifdef MIXER , chanend c_mix_ctl @@ -344,6 +347,17 @@ void usb_audio_core(chanend c_mix_out #endif ); } + +#if defined(IAP_EA_NATIVE_TRANS) + /* EA Native Transport Endpoint manager */ + { + thread_speed(); + iAP2_EANativeTransport_EPManager( + c_xud_out[ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS], + c_xud_in[ENDPOINT_NUMBER_IN_IAP_EA_NATIVE_TRANS], + c_EANativeTransport_ctrl, c_ea_data); + } +#endif //: } } @@ -405,6 +419,9 @@ int main() #endif #ifdef IAP chan c_iap; +#ifdef IAP_EA_NATIVE_TRANS + chan c_ea_data; +#endif #endif #ifdef SU1_ADC_ENABLE chan c_adc; @@ -432,6 +449,9 @@ int main() #endif #ifdef IAP , c_iap +#ifdef IAP_EA_NATIVE_TRANS + , c_ea_data +#endif #endif #ifdef MIXER , c_mix_ctl From 2c9d4c239bcec2d738ead8e4b177e1e5c9dd42ac Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Wed, 30 Jul 2014 13:34:13 +0100 Subject: [PATCH 14/15] Updated define names in line with changes to sc_mfi --- module_usb_audio/endpoint0/descriptors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index ccb92a1d..ef2ad025 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -602,7 +602,7 @@ StringDescTable_t g_strTable = #endif .iAPInterfaceStr = "iAP Interface", #ifdef IAP_EA_NATIVE_TRANS - .iAP_EANativeTransport_InterfaceStr = IAP_EA_NATIVE_TRANS_PROTOCOL_NAME, + .iAP_EANativeTransport_InterfaceStr = IAP2_EA_NATIVE_TRANS_PROTOCOL_NAME, #endif }; From 193ae6eaff2db5f0ee20a973206424b3dce132ca Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Wed, 30 Jul 2014 19:32:55 +0100 Subject: [PATCH 15/15] Mask Alt settings value before sending to iAP EA Native code (clean up short sent via channel) --- module_usb_audio/endpoint0/endpoint0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module_usb_audio/endpoint0/endpoint0.c b/module_usb_audio/endpoint0/endpoint0.c index cfd28db4..92840187 100755 --- a/module_usb_audio/endpoint0/endpoint0.c +++ b/module_usb_audio/endpoint0/endpoint0.c @@ -346,7 +346,8 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, //TODO g_eaNativeTransportAlt = sp.wValue;? /* Send selected Alt interface number onto EA Native EP manager */ - outuint(c_EANativeTransport_ctrl, sp.wValue); + unsigned int altSetting = (0x0000FFFF & sp.wValue); // sp.wValue is an unsigned short + outuint(c_EANativeTransport_ctrl, altSetting); /* Handshake */ chkct(c_EANativeTransport_ctrl, XS1_CT_END);