forked from PAWPAW-Mirror/lib_xua
Merge branch 'smart_mic_plus'
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
||||||
NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl));
|
NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl));
|
||||||
|
|
||||||
int AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
||||||
NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl));
|
NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl));
|
||||||
|
|
||||||
int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_SetupPacket_t, sp), chanend c_audioControl,
|
||||||
|
|||||||
@@ -102,21 +102,6 @@ void FeedbackStabilityDelay()
|
|||||||
t when timerafter(time + delay):> void;
|
t when timerafter(time + delay):> void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned longMul(unsigned a, unsigned b, int prec)
|
|
||||||
{
|
|
||||||
unsigned x,y;
|
|
||||||
unsigned ret;
|
|
||||||
|
|
||||||
// {x, y} = lmul(a, b, 0, 0);
|
|
||||||
asm("lmul %0, %1, %2, %3, %4, %5":"=r"(x),"=r"(y):"r"(a),"r"(b),"r"(0),"r"(0));
|
|
||||||
|
|
||||||
|
|
||||||
ret = (x << (32-prec) | (y >> prec));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Original feedback implementation */
|
/* Original feedback implementation */
|
||||||
unsafe
|
unsafe
|
||||||
@@ -132,6 +117,18 @@ static void setG_curSamFreqMultiplier(unsigned x)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (OUTPUT_VOLUME_CONTROL == 1) || (INPUT_VOLUME_CONTROL == 1)
|
#if (OUTPUT_VOLUME_CONTROL == 1) || (INPUT_VOLUME_CONTROL == 1)
|
||||||
|
static unsigned longMul(unsigned a, unsigned b, int prec)
|
||||||
|
{
|
||||||
|
unsigned x,y;
|
||||||
|
unsigned ret;
|
||||||
|
|
||||||
|
// {x, y} = lmul(a, b, 0, 0);
|
||||||
|
asm("lmul %0, %1, %2, %3, %4, %5":"=r"(x),"=r"(y):"r"(a),"r"(b),"r"(0),"r"(0));
|
||||||
|
|
||||||
|
ret = (x << (32-prec) | (y >> prec));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update master volume i.e. i.e update weights for all channels */
|
/* Update master volume i.e. i.e update weights for all channels */
|
||||||
static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
||||||
{
|
{
|
||||||
@@ -1160,16 +1157,16 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp
|
|||||||
|
|
||||||
|
|
||||||
/* Handles the Audio Class 1.0 specific requests */
|
/* Handles the Audio Class 1.0 specific requests */
|
||||||
int AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, chanend c_audioControl, chanend ?c_mix_ctl, chanend ?c_clk_ctl
|
XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, chanend c_audioControl, chanend ?c_mix_ctl, chanend ?c_clk_ctl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned char buffer[128];
|
#if (OUTPUT_VOLUME_CONTROL == 1) || (INPUT_VOLUME_CONTROL == 1)
|
||||||
|
unsigned char buffer[68];
|
||||||
unsigned unitID;
|
unsigned unitID;
|
||||||
XUD_Result_t result;
|
XUD_Result_t result;
|
||||||
|
|
||||||
/* Inspect request */
|
/* Inspect request */
|
||||||
/* Note we could check sp.bmRequestType.Direction if we wanted to be really careful */
|
/* Note we could check sp.bmRequestType.Direction if we wanted to be really careful */
|
||||||
#if (OUTPUT_VOLUME_CONTROL == 1) || (INPUT_VOLUME_CONTROL == 1)
|
|
||||||
switch(sp.bRequest)
|
switch(sp.bRequest)
|
||||||
{
|
{
|
||||||
case UAC_B_REQ_SET_CUR:
|
case UAC_B_REQ_SET_CUR:
|
||||||
@@ -1282,7 +1279,7 @@ int AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
return XUD_DoGetRequest(ep0_out, ep0_in, buffer, 2, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, buffer, 2, sp.wLength);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return XUD_RES_ERR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in,
|
|||||||
#if (NUM_USB_CHAN_IN > 0)
|
#if (NUM_USB_CHAN_IN > 0)
|
||||||
unsigned bufferIn = 1;
|
unsigned bufferIn = 1;
|
||||||
#endif
|
#endif
|
||||||
unsigned remnant = 0;
|
//unsigned remnant = 0;
|
||||||
unsigned sofCount = 0;
|
unsigned sofCount = 0;
|
||||||
unsigned freqChange = 0;
|
unsigned freqChange = 0;
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in,
|
|||||||
* to stabilise (i.e. sofCount == 128 to fire) */
|
* to stabilise (i.e. sofCount == 128 to fire) */
|
||||||
sofCount = 1;
|
sofCount = 1;
|
||||||
clocks = 0;
|
clocks = 0;
|
||||||
remnant = 0;
|
//remnant = 0;
|
||||||
clockcounter = 0;
|
clockcounter = 0;
|
||||||
mod_from_last_time = 0;
|
mod_from_last_time = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user