Conflicted merge from develop

This commit is contained in:
xross
2022-10-13 16:10:17 +01:00
4 changed files with 24 additions and 31 deletions

View File

@@ -7,6 +7,8 @@ UNRELEASED
* CHANGED: Define ADAT_RX renamed to XUA_ADAT_RX_EN
* CHANGED: Define ADAT_TX renamed to XUA_ADAT_TX_EN
* CHANGED: Define SPDIF_RX renamed to XUA_SPDIF_RX_EN
* CHANGED: Define SELF_POWERED changed to XUA_POWERMODE and associated
defines
* CHANGED: Drive strength of I2S clock lines upped to 8mA on xCORE.ai
* CHANGED: ADC datalines sampled on falling edge of clock in TDM mode
* CHANGED: Improved startup behaviour of TDM clocks

View File

@@ -957,43 +957,32 @@
/* Power */
#define XUA_POWERMODE_SELF (0)
#define XUA_POWERMODE_BUS (1)
/**
* @brief Report as self to the host when enabled, else reports as bus-powered. This affects descriptors
* and XUD usage.
* @brief Report as self or bus powered device. This affects descriptors
* and XUD usage and is important for USB compliance
*
* Default: 0 (Disabled)
* Default: XUA_POWERMODE_BUS
*/
#ifndef SELF_POWERED
#define SELF_POWERED (0)
#endif
/* Tidy-up historical ifndef usage */
#if defined(SELF_POWERED) && (SELF_POWERED==0)
#undef SELF_POWERED
#ifndef XUA_POWERMODE
#define XUA_POWERMODE XUA_POWERMODE_BUS
#endif
/**
* @brief Power drawn from the host (in mA x 2)
*
* Default: 0 when SELF_POWERED enabled else 250 (500mA)
* Default: 0 when self-powered, else 250 (500mA)
*/
#ifdef SELF_POWERED
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
/* Default to taking no power from the bus in self-powered mode */
#ifndef BMAX_POWER
#define BMAX_POWER 0
#ifndef _XUA_BMAX_POWER
#define _XUA_BMAX_POWER (0)
#endif
#else
/* Default to taking 500mA from the bus in bus-powered mode */
#ifndef BMAX_POWER
#define BMAX_POWER 250
#endif
#endif
#ifndef XUD_PWR_CFG
#ifdef SELF_POWERED
#define XUD_PWR_CFG XUD_PWR_SELF
#else
#define XUD_PWR_CFG XUD_PWR_BUS
#ifndef _XUA_BMAX_POWER
#define _XUA_BMAX_POWER (250)
#endif
#endif

View File

@@ -806,12 +806,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
.bNumInterfaces = INTERFACE_COUNT,
.bConfigurationValue = 0x01,
.iConfiguration = 0x00,
#ifdef SELF_POWERED
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
.bmAttributes = 192,
#else
.bmAttributes = 128,
#endif
.bMaxPower = BMAX_POWER,
.bMaxPower = _XUA_BMAX_POWER,
},
.Audio_InterfaceAssociation =
@@ -2239,12 +2239,12 @@ unsigned char cfgDesc_Null[] =
0x01, /* 4 bNumInterface: Number of interfaces*/
0x01, /* 5 bConfigurationValue */
0x00, /* 6 iConfiguration */
#ifdef SELF_POWERED
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
192, /* 7 bmAttributes */
#else
128,
#endif
BMAX_POWER, /* 8 bMaxPower */
_XUA_BMAX_POWER, /* 8 bMaxPower */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
@@ -2399,12 +2399,12 @@ unsigned char cfgDesc_Audio1[] =
NUM_INTERFACES_A1, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/
0x01, /* ID of this configuration */
0x00, /* Unused */
#ifdef SELF_POWERED
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
192, /* 7 bmAttributes */
#else
128, /* 7 bmAttributes */
#endif
BMAX_POWER, /* 8 bMaxPower */
_XUA_BMAX_POWER, /* 8 bMaxPower */
/* Standard AC interface descriptor */
0x09,

View File

@@ -310,9 +310,11 @@ VENDOR_REQUESTS_PARAMS_DEC_
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
/* USB interface core */
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, XUD_PWR_CFG);
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
}
{