Important update: Arm Announces End of Life Timeline for Mbed. This site will be archived in July 2026. Read the full announcement.
Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Usb audio protocol
Topic last updated 21 Aug 2011, by
Philips Philips.
0
replies

I will start with the Audio Device Class Custom User Module
<<code>>
/*----------------------------------------------------------------------------
* U S B - K e r n e l
*----------------------------------------------------------------------------
* Name: ADCUSER.C
* Purpose: Audio Device Class Custom User Module
* Version: V1.10
*----------------------------------------------------------------------------
* This software is supplied "AS IS" without any warranties, express,
* implied or statutory, including but not limited to the implied
* warranties of fitness for purpose, satisfactory quality and
* noninfringement. Keil extends you a royalty-free right to reproduce
* and distribute executable files created using this software for use
* on NXP Semiconductors LPC family microcontroller devices only. Nothing
* else gives you the right to use this software.
*
* Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
*---------------------------------------------------------------------------*/
#include "type.h"
#include "usb.h"
#include "audio.h"
#include "usbcfg.h"
#include "usbcore.h"
#include "adcuser.h"
#include "usbaudio.h"
uint16_t VolCur = 0x0100; /* Volume Current Value */
const uint16_t VolMin = 0x0000; /* Volume Minimum Value */
const uint16_t VolMax = 0x0100; /* Volume Maximum Value */
const uint16_t VolRes = 0x0004; /* Volume Resolution */
/*
* Audio Device Class Interface Get Request Callback
* Called automatically on ADC Interface Get Request
* Parameters: None (global SetupPacket and EP0Buf)
* Return Value: TRUE - Success, FALSE - Error
*/
uint32_t ADC_IF_GetRequest (void) {
/*
Interface = SetupPacket.wIndex.WB.L;
EntityID = SetupPacket.wIndex.WB.H;
Request = SetupPacket.bRequest;
Value = SetupPacket.wValue.W;
...
*/
if (SetupPacket.wIndex.W == 0x0200) {
/* Feature Unit: Interface = 0, ID = 2 */
if (SetupPacket.wValue.WB.L == 0) {
/* Master Channel */
switch (SetupPacket.wValue.WB.H) {
case AUDIO_MUTE_CONTROL:
switch (SetupPacket.bRequest) {
case AUDIO_REQUEST_GET_CUR:
EP0Buf[0] = Mute;
return (TRUE);
}
break;
case AUDIO_VOLUME_CONTROL:
switch (SetupPacket.bRequest) {
case AUDIO_REQUEST_GET_CUR:
*((__packed uint16_t *)EP0Buf) = VolCur;
return (TRUE);
case AUDIO_REQUEST_GET_MIN:
*((__packed uint16_t *)EP0Buf) = VolMin;
return (TRUE);
case AUDIO_REQUEST_GET_MAX:
*((__packed uint16_t *)EP0Buf) = VolMax;
return (TRUE);
case AUDIO_REQUEST_GET_RES:
*((__packed uint16_t *)EP0Buf) = VolRes;
return (TRUE);
}
break;
}
}
}
return (FALSE); /* Not Supported */
}
/*
* Audio Device Class Interface Set Request Callback
* Called automatically on ADC Interface Set Request
* Parameters: None (global SetupPacket and EP0Buf)
* Return Value: TRUE - Success, FALSE - Error
*/
uint32_t ADC_IF_SetRequest (void) {
/*
Interface = SetupPacket.wIndex.WB.L;
EntityID = SetupPacket.wIndex.WB.H;
Request = SetupPacket.bRequest;
Value = SetupPacket.wValue.W;
...
*/
if (SetupPacket.wIndex.W == 0x0200) {
/* Feature Unit: Interface = 0, ID = 2 */
if (SetupPacket.wValue.WB.L == 0) {
/* Master Channel */
switch (SetupPacket.wValue.WB.H) {
case AUDIO_MUTE_CONTROL:
switch (SetupPacket.bRequest) {
case AUDIO_REQUEST_SET_CUR:
Mute = EP0Buf[0];
return (TRUE);
}
break;
case AUDIO_VOLUME_CONTROL:
switch (SetupPacket.bRequest) {
case AUDIO_REQUEST_SET_CUR:
VolCur = *((__packed uint16_t *)EP0Buf);
return (TRUE);
}
break;
}
}
}
return (FALSE); /* Not Supported */
}
/*
* Audio Device Class EndPoint Get Request Callback
* Called automatically on ADC EndPoint Get Request
* Parameters: None (global SetupPacket and EP0Buf)
* Return Value: TRUE - Success, FALSE - Error
*/
uint32_t ADC_EP_GetRequest (void) {
//if (SetupPacket.wIndex.W.L == EndPoint3)
/*
EndPoint = SetupPacket.wIndex.WB.L;
Request = SetupPacket.bRequest;
Value = SetupPacket.wValue.W;
...
*/
return (FALSE); /* Not Supported */
}
/*
* Audio Device Class EndPoint Set Request Callback
* Called automatically on ADC EndPoint Set Request
* Parameters: None (global SetupPacket and EP0Buf)
* Return Value: TRUE - Success, FALSE - Error
*/
uint32_t ADC_EP_SetRequest (void) {
/*
EndPoint = SetupPacket.wIndex.WB.L;
Request = SetupPacket.bRequest;
Value = SetupPacket.wValue.W;
...
*/
return (FALSE); /* Not Supported */
}
<</code>>
It has ADC_EP_GetRequest which is the endpoint request, but I have not found any example code, so no clue as to what I should do.
From reading the internet, I think what is missing from this code is the ADC_Init ADC Audio Initialization,ADC_DataIn ADC DATA In Callback,ADC_DataOut ADC DATA Out Callback. But no example for these so no clue what I should do here as well.
I found some reference to this in updated code, but not keil code, CooCox code in a H file.
http://coocox.cn/show_comp.php?id=ddab5a61-1ec5-11e0-9f00-001fd0695df3
<<code>>
/*****************************************************************************
* U S B - A D C - C O M P O N E N T
****************************************************************************/
/**
* @file : ADC_CALLBACK.h
* @brief : USB Audio Device Class Call Back Definitions
* @version : 1.1
* @date : 13. Mar. 2011
* @author : CooCox
****************************************************************************/
#ifndef __ADC_CALLBACK_H__
#define __ADC_CALLBACK_H__
#include "usb_enumerate.h"
/***********************************************************************
* USB ADC call back function definition
**********************************************************************/
typedef uint32_t (PFN_AUDIO_INIT_CALLBACK) (void *dev);
typedef uint32_t (PFN_AUDIO_READ_CALLBACK) (void *dev, uint8_t *rbuf, uint32_t rlen);
typedef uint32_t (PFN_AUDIO_WRITE_CALLBACK) (void *dev, uint8_t *wbuf, uint32_t wlen);
/**
* @brief USB ADC Structure
*/
typedef struct
{
USB_ENU_Dev usb_enu;
PFN_AUDIO_INIT_CALLBACK *Audio_Init;
PFN_AUDIO_READ_CALLBACK *Audio_Read;
PFN_AUDIO_WRITE_CALLBACK *Audio_write;
PFN_AUDIO_INIT_CALLBACK *Audio_DeInit;
void *Audio_device;
uint16_t VolCur; /* Volume Current Value */
uint16_t VolMin; /* Volume Minimum Value */
uint16_t VolMax; /* Volume Maximum Value */
uint16_t VolRes; /* Volume Resolution */
uint8_t Mute;
} USBADC_Dev;
/***********************************************************************
* extern API of this component
**********************************************************************/
extern uint32_t Audio_Read (USBADC_Dev *dev, uint8_t *rbuf, uint32_t *len);
extern uint32_t Audio_Write (USBADC_Dev *dev, uint8_t *wbuf, uint32_t len);
extern void Audio_Init (USBADC_Dev *dev);
extern void Audio_Connect(USBADC_Dev *dev,uint32_t con);
extern uint8_t Audio_Configurated(USBADC_Dev *dev);
extern void Audio_Event(USBADC_Dev *dev);
#endif /* __ADC_CALLBACK_H__ */
<</code>>
From reading Microphone Array Support in Windows Vista guide http://msdn.microsoft.com/en-us/windows/hardware/gg462985
it talks about the GET_MEM request, which is done with the bRequest, which gives reference to the ADCuser..
So I am stuck on what needs to be done with ADCUSER file because I have no example code, and missing code.
Next is the usbuser.c
<<code>>
/*----------------------------------------------------------------------------
* U S B - K e r n e l
*----------------------------------------------------------------------------
* Name: usbuser.c
* Purpose: USB Custom User Module
* Version: V1.20
*----------------------------------------------------------------------------
* This software is supplied "AS IS" without any warranties, express,
* implied or statutory, including but not limited to the implied
* warranties of fitness for purpose, satisfactory quality and
* noninfringement. Keil extends you a royalty-free right to reproduce
* and distribute executable files created using this software for use
* on NXP Semiconductors LPC family microcontroller devices only. Nothing
* else gives you the right to use this software.
*
* Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
*---------------------------------------------------------------------------*/
#include "type.h"
#include "usb.h"
#include "usbcfg.h"
#include "usbhw.h"
#include "usbcore.h"
#include "usbuser.h"
#include "usbaudio.h"
/*
* USB Power Event Callback
* Called automatically on USB Power Event
* Parameter: power: On(TRUE)/Off(FALSE)
*/
#if USB_POWER_EVENT
void USB_Power_Event (uint32_t power) {
}
#endif
/*
* USB Reset Event Callback
* Called automatically on USB Reset Event
*/
#if USB_RESET_EVENT
void USB_Reset_Event (void) {
USB_ResetCore();
}
#endif
/*
* USB Suspend Event Callback
* Called automatically on USB Suspend Event
*/
#if USB_SUSPEND_EVENT
void USB_Suspend_Event (void) {
}
#endif
/*
* USB Resume Event Callback
* Called automatically on USB Resume Event
*/
#if USB_RESUME_EVENT
void USB_Resume_Event (void) {
}
#endif
/*
* USB Remote Wakeup Event Callback
* Called automatically on USB Remote Wakeup Event
*/
#if USB_WAKEUP_EVENT
void USB_WakeUp_Event (void) {
}
#endif
/*
* USB Start of Frame Event Callback
* Called automatically on USB Start of Frame Event
*/
#if USB_SOF_EVENT
void USB_SOF_Event (void) {
#if USB_DMA == 0
if (USB_ReadEP(0x03, (BYTE *)&DataBuf[DataIn])) {
/* Data Available */
DataIn += P_S; /* Update Data In Index */
DataIn &= B_S - 1; /* Adjust Data In Index */
if (((DataIn - DataOut) & (B_S - 1)) == (B_S/2)) {
DataRun = 1; /* Data Stream running */
}
} else {
/* No Data */
DataRun = 0; /* Data Stream not running */
DataOut = DataIn; /* Initialize Data Indexes */
}
#endif
}
#endif
/*
* USB Error Event Callback
* Called automatically on USB Error Event
* Parameter: error: Error Code
*/
#if USB_ERROR_EVENT
void USB_Error_Event (uint32_t error) {
}
#endif
/*
* USB Set Configuration Event Callback
* Called automatically on USB Set Configuration Request
*/
#if USB_CONFIGURE_EVENT
void USB_Configure_Event (void) {
if (USB_Configuration) { /* Check if USB is configured */
/* add your code here */
}
}
#endif
/*
* USB Set Interface Event Callback
* Called automatically on USB Set Interface Request
*/
#if USB_INTERFACE_EVENT
void USB_Interface_Event (void) {
}
#endif
/*
* USB Set/Clear Feature Event Callback
* Called automatically on USB Set/Clear Feature Request
*/
#if USB_FEATURE_EVENT
void USB_Feature_Event (void) {
}
#endif
#define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
/* USB Endpoint Events Callback Pointers */
void (* const USB_P_EP[16]) (uint32_t event) = {
P_EP(0),
P_EP(1),
P_EP(2),
P_EP(3),
P_EP(4),
P_EP(5),
P_EP(6),
P_EP(7),
P_EP(8),
P_EP(9),
P_EP(10),
P_EP(11),
P_EP(12),
P_EP(13),
P_EP(14),
P_EP(15),
};
/*
* USB Endpoint 1 Event Callback
* Called automatically on USB Endpoint 1 Event
* Parameter: event
*/
void USB_EndPoint1 (uint32_t event) {
}
/*
* USB Endpoint 2 Event Callback
* Called automatically on USB Endpoint 2 Event
* Parameter: event
*/
void USB_EndPoint2 (uint32_t event) {
}
/*
* USB Endpoint 3 Event Callback
* Called automatically on USB Endpoint 3 Event
* Parameter: event
*/
void USB_EndPoint3 (uint32_t event) {
#if USB_DMA
USB_DMA_DESCRIPTOR DD;
if (event & USB_EVT_IN_DMA_EOT) {
/* End of Transfer */
if (USB_DMA_BufAdr(0x03) != ((uint32_t)DataBuf + 2*DataIn)) {
/* Data Available */
DataIn += P_C*P_S; /* Update Data In Index */
DataIn &= B_S - 1; /* Adjust Data In Index */
if (((DataIn - DataOut) & (B_S - 1)) == (B_S/2)) {
DataRun = 1; /* Data Stream running */
}
} else {
/* No Data */
DataRun = 0; /* Data Stream not running */
DataOut = DataIn; /* Initialize Data Indexes */
}
}
if (event & (USB_EVT_IN_DMA_EOT) | (USB_EVT_IN_DMA_NDR)) {
/* End of Transfer or New Descriptor Request */
DD.BufAdr = (uint32_t)DataBuf + 2*DataIn; /* DMA Buffer Address */
DD.BufLen = P_C; /* DMA Packet Count */
DD.MaxSize = 0; /* Must be 0 for Iso Transfer */
DD.InfoAdr = (uint32_t)InfoBuf; /* Packet Info Buffer Address */
DD.Cfg.Val = 0; /* Initial DMA Configuration */
DD.Cfg.Type.IsoEP = 1; /* Iso Endpoint */
USB_DMA_Setup (0x03, &DD); /* Setup DMA */
USB_DMA_Enable(0x03); /* Enable DMA */
}
#else
event = event;
#endif
}
/*
* USB Endpoint 4 Event Callback
* Called automatically on USB Endpoint 4 Event
* Parameter: event
*/
void USB_EndPoint4 (uint32_t event) {
}
/*
* USB Endpoint 5 Event Callback
* Called automatically on USB Endpoint 5 Event
* Parameter: event
*/
void USB_EndPoint5 (uint32_t event) {
}
/*
* USB Endpoint 6 Event Callback
* Called automatically on USB Endpoint 6 Event
* Parameter: event
*/
void USB_EndPoint6 (uint32_t event) {
}
/*
* USB Endpoint 7 Event Callback
* Called automatically on USB Endpoint 7 Event
* Parameter: event
*/
void USB_EndPoint7 (uint32_t event) {
}
/*
* USB Endpoint 8 Event Callback
* Called automatically on USB Endpoint 8 Event
* Parameter: event
*/
void USB_EndPoint8 (uint32_t event) {
}
/*
* USB Endpoint 9 Event Callback
* Called automatically on USB Endpoint 9 Event
* Parameter: event
*/
void USB_EndPoint9 (uint32_t event) {
}
/*
* USB Endpoint 10 Event Callback
* Called automatically on USB Endpoint 10 Event
* Parameter: event
*/
void USB_EndPoint10 (uint32_t event) {
}
/*
* USB Endpoint 11 Event Callback
* Called automatically on USB Endpoint 11 Event
* Parameter: event
*/
void USB_EndPoint11 (uint32_t event) {
}
/*
* USB Endpoint 12 Event Callback
* Called automatically on USB Endpoint 12 Event
* Parameter: event
*/
void USB_EndPoint12 (uint32_t event) {
}
/*
* USB Endpoint 13 Event Callback
* Called automatically on USB Endpoint 13 Event
* Parameter: event
*/
void USB_EndPoint13 (uint32_t event) {
}
/*
* USB Endpoint 14 Event Callback
* Called automatically on USB Endpoint 14 Event
* Parameter: event
*/
void USB_EndPoint14 (uint32_t event) {
}
/*
* USB Endpoint 15 Event Callback
* Called automatically on USB Endpoint 15 Event
* Parameter: event
*/
void USB_EndPoint15 (uint32_t event) {
}
<</code>>
Now from this reference I have found some code I should use for the usbuser.c.. to do with the Endpoint events and Start of frame events, this is not to do with audio code but for CDC, but I think the code may be pretty close to what is needed
How to enable and use DMA for USB bulk IN endpoints http://www.keil.com/forum/18098/
<<code>>
void SendDataToHost()
{
USB_DMA_DESCRIPTOR DD;
DD.BufAdr = (unsigned int)pStartBufAddr; /* DMA Buffer Address */
DD.BufLen = 256; /* DMA Packet-size */
DD.MaxSize = 64; /* 64Byte for bulk-transfer */
//DD.Cfg.Type.IsoEP = 0;
//DD.Cfg.Type.ATLE = 0;
DD.Cfg.Val = 0; /* Initial DMA Desc Configuration */
USB_DMA_Setup (CDC_DEP_IN, &DD); /* Register DD */
/* ************* ZLP **********/
DD.BufLen = 0; // Zero-Length
DD.MaxSize = 64;
DD.Cfg.Val = 0; // Clear config parameters
DD.Cfg.Type.Link = 1; // link this DD after above first DD <-------- Add this line
USB_DMA_Setup (CDC_DEP_IN, &DD); /* Register DD */
USB_DMA_Enable(CDC_DEP_IN); /* Enable DMA */
LPC_USB->USBDMARSet = 1 << EPAdr(CDC_DEP_IN);
<</code>>
not sure what else needs to be done here.. but from the RealView Real-Time Library RL-USB User Guide... which is a guide for the keil code I am using, not a very complete guide but it does give some clue what should be done with the usbcfg files and using the configuration Wizard to enable the DMA Transfer Endpoints In and Endpoints Out, and USB Event Handlers, Endpoint Events.
The Descriptors I think I understand from the FiFi SDR it is a Fichtenfieldday project lots of code http://o28.sischa.net/fifisdr/trac look very fun, But it is so much different than the keil code because it is using FreeRTOS http://www.freertos.org/
<<code>>
/* USB device library for LPC1700 Cortex-M3 microcontrollers
*
* Copyright 2010 DF9DQ
*
* This file is part of the FiFi-SDR project <http://www.ov-lennestadt.de/fifisdr>
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Boot1700-USB. If not, see <http://www.gnu.org/licenses/>.
*/
/* Contains the application specific descriptors and strings */
#include <stdlib.h>
#include "usbdesc.h"
#include "init.h"
/* Array containing all descriptors in sequence:
* Device, Configuration, Interface, Endpoint (2x)
*/
const uint8_t usb_descriptors[] =
{
/* Device Descriptor */
USBD_SIZE_DEVICE, /* bLength */
USBD_DEVICE, /* bDescriptorType */
LE(0x0110), /* bcdUSB 1.10 */
USBC_BASE, /* bDeviceClass BASE */
0, /* bDeviceSubClass (none) */
0, /* bDeviceProtocol (none) */
64, /* bMaxPacketSize0 64 */
LE(0x16C0), /* idVendor 0x16C0 */
LE(0x05DC), /* idProduct 0x05DC */
LE(0x0100), /* bcdDevice 1.00 */
1, /* iManufacturer */
2, /* iProduct */
USB_SERIAL_STRING, /* iSerialNumber */
1, /* bNumConfigurations 1 */
/* Configuration Descriptor */
USBD_SIZE_CONFIGURATION, /* bLength */
USBD_CONFIGURATION, /* bDescriptorType */
LE( /* wTotalLength */
USBD_SIZE_CONFIGURATION +
USBD_SIZE_INTERFACE +
USBD_SIZE_INTERFACE +
USBD_SIZE_AUDIO_ST_HEADER(1) +
USBD_SIZE_AUDIO_ST_INPUT_TERMINAL +
USBD_SIZE_AUDIO_ST_OUTPUT_TERMINAL +
USBD_SIZE_AUDIO_ST_FEATURE_UNIT(2,1) +
USBD_SIZE_INTERFACE +
USBD_SIZE_INTERFACE +
7 +
14 +
USBD_SIZE_ENDPOINT +
7
),
3, /* bNumInterfaces 3 */
1, /* bConfigurationValue 1 */
0, /* iConfiguration (none) */
0xC0, /* bmAttributes bus-powered */
200/2, /* bMaxPower 400 mA */
/* Softrock-40 Interface */
USBD_SIZE_INTERFACE, /* bLength */
USBD_INTERFACE, /* bDescriptorType */
0, /* bInterfaceNumber #0 */
0, /* bAlternateSetting 0 */
0, /* bNumEndpoints 0 */
USBC_BASE, /* bInterfaceClass */
0, /* bInterfaceSubClass */
0, /* bInterfaceProtocol */
6, /* iInterface "SoftRock SDR" */
/* Standard AudioControl Interface */
USBD_SIZE_INTERFACE, /* bLength */
USBD_INTERFACE, /* bDescriptorType */
1, /* bInterfaceNumber #1 */
0, /* bAlternateSetting 0 */
0, /* bNumEndpoints 0 */
USBC_AUDIO, /* bInterfaceClass AUDIO */
USBCS_AUDIO_AUDIOCONTROL, /* bInterfaceSubClass AUDIOCONTROL */
0, /* bInterfaceProtocol */
0, /* iInterface (none) */
/* Class-Specific AC Interface Header */
USBD_SIZE_AUDIO_ST_HEADER(1),
USBD_CS_INTERFACE,
USBD_AUDIO_ST_HEADER, /* bDescriptorSubtype HEADER */
LE(0x0100), /* bcdADC 1.0 */
LE( /* wTotalLength */
USBD_SIZE_AUDIO_ST_HEADER(1) +
USBD_SIZE_AUDIO_ST_INPUT_TERMINAL +
USBD_SIZE_AUDIO_ST_OUTPUT_TERMINAL +
USBD_SIZE_AUDIO_ST_FEATURE_UNIT(2,1)
),
1, /* bInCollection 1 */
2, /* baInterfaceNr(1) #2 */
/* Input Terminal */
USBD_SIZE_AUDIO_ST_INPUT_TERMINAL,
USBD_CS_INTERFACE,
USBD_AUDIO_ST_INPUT_TERMINAL, /* bDescriptorSubtype INPUT_TERMINAL */
1, /* bTerminalID ID=1 */
LE(0x0201), /* wTerminalType Microphone */
0, /* bAssocTerminal no association */
2, /* bNrChannels 2 */
LE(0x0003), /* wChannelConfig Front L+R */
7, /* iChannelNames "I" "Q" */
0, /* iTerminal (no string) */
/* Output Terminal */
USBD_SIZE_AUDIO_ST_OUTPUT_TERMINAL,
USBD_CS_INTERFACE,
USBD_AUDIO_ST_OUTPUT_TERMINAL, /* bDescriptorSubtype OUTPUT_TERMINAL */
3, /* bTerminalID ID=3 */
LE(0x0101), /* wTerminalType USB Streaming */
0, /* bAssocTerminal no association */
2, /* bSourceID ID=2 */
0, /* iTerminal (none) */
/* Feature Unit */
USBD_SIZE_AUDIO_ST_FEATURE_UNIT(2,1),
USBD_CS_INTERFACE,
USBD_AUDIO_ST_FEATURE_UNIT, /* bDescriptorSubtype FEATURE_UNIT */
2, /* bUnitID ID=2 */
1, /* bSourceID Terminal #1 */
1, /* bControlSize n = 1 Byte/channel */
0x03, /* bmaControls(0) Master: Mute+Volume */
0x00, /* bmaControls(0) */
0x00, /* bmaControls(0) */
9, /* iFeature "Preamp" */
/* Standard AudioStreaming Interface (alternate setting #0) */
USBD_SIZE_INTERFACE, /* bLength */
USBD_INTERFACE, /* bDescriptorType */
2, /* bInterfaceNumber #2 */
0, /* bAlternateSetting 0 */
0, /* bNumEndPoints no endpoints */
USBC_AUDIO, /* bInterfaceClass AUDIO */
USBCS_AUDIO_AUDIOSTREAMING, /* bInterfaceSubClass AUDIOSTREAMING */
0, /* bInterfaceProtocol */
5, /* iInterface "UDA1361 Capture" */
/* Standard AudioStreaming Interface (alternate setting #1) */
USBD_SIZE_INTERFACE, /* bLength */
USBD_INTERFACE, /* bDescriptorType */
2, /* bInterfaceNumber #2 */
1, /* bAlternateSetting 1 */
1, /* bNumEndPoints 1 data endpoint */
USBC_AUDIO, /* bInterfaceClass AUDIO */
USBCS_AUDIO_AUDIOSTREAMING, /* bInterfaceSubClass AUDIOSTREAMING */
0, /* bInterfaceProtocol */
5, /* iInterface "UDA1361 Capture" */
/* Audio Stream Audio Class */
7,
USBD_CS_INTERFACE,
1, /* bDescriptorSubtype AS_GENERAL, */
3, /* bTerminalLink #3 */
1, /* bDelay 1 */
LE(0x0001), /* wFormatTag PCM */
/* Format Type Audio */
14,
USBD_CS_INTERFACE,
2, /* bDescriptorSubtype FORMAT_TYPE */
1, /* bFormatType TYPE_I */
2, /* bNrChannels 2 */
#if AUDIO_SAMPLES == 16
2, /* bSubFrameSize 2 */
16, /* bBitResolution 16 */
#endif
#if AUDIO_SAMPLES == 32
4, /* bSubFrameSize 4 */
32, /* bBitResolution 32 */
#endif
2, /* bSamFreqType 2 frequencies */
0x80,0xBB,0x00, /* 48 kHz */
0x00,0x77,0x01, /* 96 kHz */
/* Audio streaming IN endpoint */
USBD_SIZE_ENDPOINT, /* bLength */
USBD_ENDPOINT, /* bDescriptorType */
0x83, /* bEndpointAddress Logical EP 3 IN */
0x05, /* bmAttributes isochronous, async, */
/* data */
LE(USB_ISOC_SIZE), /* wMaxPacketSize (init.h) */
1, /* bInterval */
0, /* bRefresh */
0, /* bSyncAddress */
/* Class specific audio endpoint */
7,
USBD_CS_ENDPOINT,
1, /* bDescriptorSubtype EP_GENERAL */
1, /* bmAttributes Sample rate control */
0, /* bLockDelayUnits */
LE(0), /* wLockDelay */
/* --- String Descriptors --- */
/* String 0 contains the language codes */
4, USBD_STRING,
LE(0x0409), /* English */
/* #1: Device idVendor */
8, USBD_STRING,
'O', 0,
'2', 0,
'8', 0,
/* #2: Device idProduct */
18, USBD_STRING,
'F', 0,
'i', 0,
'F', 0,
'i', 0,
'-', 0,
'S', 0,
'D', 0,
'R', 0,
/* #3: Device idSerial. Only a dummy! */
4, USBD_STRING,
'1', 0,
/* #4: */
38, USBD_STRING,
'F', 0,
'i', 0,
'F', 0,
'i', 0,
'-', 0,
'S', 0,
'D', 0,
'R', 0,
' ', 0,
'S', 0,
'o', 0,
'u', 0,
'n', 0,
'd', 0,
'c', 0,
'a', 0,
'r', 0,
'd', 0,
/* #5: */
32, USBD_STRING,
'U', 0,
'D', 0,
'A', 0,
'1', 0,
'3', 0,
'6', 0,
'1', 0,
' ', 0,
'E', 0,
'i', 0,
'n', 0,
'g', 0,
'a', 0,
'n', 0,
'g', 0,
/* #6: */
26, USBD_STRING,
'S', 0,
'o', 0,
'f', 0,
't', 0,
'R', 0,
'o', 0,
'c', 0,
'k', 0,
' ', 0,
'S', 0,
'D', 0,
'R', 0,
/* #7: */
4, USBD_STRING,
'I', 0,
/* #8: */
4, USBD_STRING,
'Q', 0,
/* #9: */
14, USBD_STRING,
'P', 0,
'r', 0,
'e', 0,
'a', 0,
'm', 0,
'p', 0,
/* End of descriptors */
0
};
<</code>>
this is the microsoft USBTelephony-v091 guide, which is where I learned more about the descriptors..
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/USBTelephony-v091.doc
from a post on keil USB Audio class support for multiple audio streams http://www.keil.com/forum/14686/
this is going back to usb requests and descriptors but this did help me some http://www.beyondlogic.org/usbnutshell/usb6.shtml
Not sure if you would of guess it yet but I am trying to write code for a usb Bi derectional I think is the microsoft words as such, to get the mbed to act as a usb soundcard with both microphone in and speaker out and maybe I will move onto the next stage and other things I will like to do:)
You might think I should of posted this on keil perharps, but my code will be posted on here not keil.
I will start with the Audio Device Class Custom User Module
It has ADC_EP_GetRequest which is the endpoint request, but I have not found any example code, so no clue as to what I should do.
From reading the internet, I think what is missing from this code is the ADC_Init ADC Audio Initialization,ADC_DataIn ADC DATA In Callback,ADC_DataOut ADC DATA Out Callback. But no example for these so no clue what I should do here as well.
I found some reference to this in updated code, but not keil code, CooCox code in a H file.
http://coocox.cn/show_comp.php?id=ddab5a61-1ec5-11e0-9f00-001fd0695df3
From reading Microphone Array Support in Windows Vista guide http://msdn.microsoft.com/en-us/windows/hardware/gg462985
it talks about the GET_MEM request, which is done with the bRequest, which gives reference to the ADCuser..
So I am stuck on what needs to be done with ADCUSER file because I have no example code, and missing code.
Next is the usbuser.c
Now from this reference I have found some code I should use for the usbuser.c.. to do with the Endpoint events and Start of frame events, this is not to do with audio code but for CDC, but I think the code may be pretty close to what is needed
How to enable and use DMA for USB bulk IN endpoints http://www.keil.com/forum/18098/
not sure what else needs to be done here.. but from the RealView Real-Time Library RL-USB User Guide... which is a guide for the keil code I am using, not a very complete guide but it does give some clue what should be done with the usbcfg files and using the configuration Wizard to enable the DMA Transfer Endpoints In and Endpoints Out, and USB Event Handlers, Endpoint Events.
The Descriptors I think I understand from the FiFi SDR it is a Fichtenfieldday project lots of code http://o28.sischa.net/fifisdr/trac look very fun, But it is so much different than the keil code because it is using FreeRTOS http://www.freertos.org/
this is the microsoft USBTelephony-v091 guide, which is where I learned more about the descriptors..
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/USBTelephony-v091.doc
from a post on keil USB Audio class support for multiple audio streams http://www.keil.com/forum/14686/
this is going back to usb requests and descriptors but this did help me some http://www.beyondlogic.org/usbnutshell/usb6.shtml
Not sure if you would of guess it yet but I am trying to write code for a usb Bi derectional I think is the microsoft words as such, to get the mbed to act as a usb soundcard with both microphone in and speaker out and maybe I will move onto the next stage and other things I will like to do:)
You might think I should of posted this on keil perharps, but my code will be posted on here not keil.