Merge pull request #2 from keithauxmos/feature/configurable_usb_res_rate_shuchita

fixed typo of comments
This commit is contained in:
shuchitak
2020-02-28 09:42:34 +00:00
committed by GitHub
4 changed files with 23 additions and 17 deletions

View File

@@ -0,0 +1,16 @@
// Copyright (c) 2017-2020, XMOS Ltd, All rights reserved
#ifndef __XUA_API_H__
#define __XUA_API_H__
extern void set_usb_to_device_rate(uint32_t rate);
extern void set_device_to_usb_rate(uint32_t rate);
extern void set_usb_to_device_bit_res(uint32_t rate);
extern void set_device_to_usb_bit_res(uint32_t rate);
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();
extern uint32_t get_device_to_usb_bit_res();
#endif //__XUA_API_H__

View File

@@ -7,6 +7,7 @@
#include "interrupt.h"
#include "xua_commands.h"
#include "xud.h"
#include "xua_usb_params_funcs.h"
#ifdef NATIVE_DSD
#include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */
@@ -17,12 +18,6 @@
#endif
#define MAX(x,y) ((x)>(y) ? (x) : (y))
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();
extern uint32_t get_device_to_usb_bit_res();
#endif
/* TODO use SLOTSIZE to potentially save memory */
/* Note we could improve on this, for one subslot is set to 4 */
@@ -165,7 +160,7 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS;
void handle_audio_request(chanend c_mix_out)
{
int space_left;
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES)
g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3;
g_curSubSlot_In = get_device_to_usb_bit_res() >> 3;
#endif

View File

@@ -29,6 +29,8 @@
#include "dsd_support.h"
#endif
#include "xua_usb_params_funcs.h"
#ifndef __XC__
/* Support for xCORE channels in C */
#define null 0
@@ -65,13 +67,6 @@ extern void device_reboot(void);
#include "xua_hid.h"
#endif
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();
extern uint32_t get_device_to_usb_bit_res();
#endif
unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active
/* Global volume and mute tables */
@@ -344,7 +339,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
}
#endif
#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution
@@ -352,7 +347,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution
const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
int i=0;
for(i=0;i<num_of_usb_descriptor_freq;i++)
{

View File

@@ -2367,7 +2367,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
#endif
#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
#define AS_INTERFACE_BYTES (7)
#define INTERFACE_DESCRIPTOR_BYTES (9)
#define AS_FORMAT_TYPE_BYTES (17)