Dear Fabrice,
Seems to be at least one person has solved it successfuly.
https://www.xcore.com/viewtopic.php?t=8110
I have read this topic 10 times but could not get how to do this. I asked the person in private message, but got no answer.
Dear Fabrice,
Dear Ross,
Code: Select all
#include "usbaudio20.h"
#define INT_EP
...
void buffer(
..
#ifdef INT_EP
chanend ?c_ep_int, chanend ?c_clk_int, // c_clk_int - interrupt channnel
#endif
...
#ifdef INT_EP
XUD_ep ep_int = XUD_InitEp(c_ep_int); // c_ep_int - Interrupt Endpoint
#endif
...
#ifdef INT_EP
/* Interrupt processing. Volume was changed on Device */
case inuint_byref(c_clk_int, u_tmp): //read interrupt request
chkct(c_clk_int, XS1_CT_END);
/* Check if we have interrupt pending.
* Note, this his means we can loose interrupts... */
if(!g_intFlag)
{
g_intFlag = 1;
g_intData[2] = u_tmp; // hope it's a number of channel
g_intData[3] = FU_VOLUME_CONTROL;
g_intData[5] = FU_USBOUT;
XUD_SetReady_In(ep_int, g_intData, 6);
}
break;
/* Interrupt EP data sent, clear flag */
case XUD_SetData_Select(c_ep_int, ep_int, result):
{
g_intFlag = 0;
break;
}
#endif
Exactly! Works for me. External ASRC chip is a nice option. No need in any "source select" switch, 192 kHz support, pain free implementation, +1 free XMOS core, and I can mix USB + SPDIF.
Yes, I do send it every time volume knob is rotated. Then I need to make sure I did not lose any request when all these operations processed.but here MaximLiadov, in your USBBufferXC you have 2 "case" statements.
The first one is originally triggered by the clockgen code sending 1byte+CT_END on the chanend c_clk_int.
this informs the XUD that a 6 byte record is ready to be sent out to the host with XUD_SetReady_In(ep_int, g_intData, 6);
The second case is triggered by XUD when the host acknowledge the reception on the Interrupt record, via chanend c_ep_int;
but somewhere in your application code, you need to trigger the first case by sending u_temp+CTEND to c_clk_int when your front panel volume is changed, did you do that ?
Code: Select all
if(!g_intFlag)
{
...
XUD_SetReady_In(ep_int, g_intData, 6);
}
else
printf("loose interrupt\n");
I actively use global memory around project, but this sounds unreal for my current level.another possibility is to use the SOF interruption (in usbbuffer) to call XUD_SetReady_In(ep_int, g_intData, 6) upon volume change (checking a global memory location on tile1) so you don't need to care about c_clk_int channel anymore :)
It would be nice to have just one master fader in OS. Is it possible to implement? Having 3 faders and updating all them is just a mess to be honest. I cannot find where is this in project. Any help would be much appriciated.the comment about "we can loose interrupt" just means that the code is written in a way that we may send multiple XUD_SetReady_In(ep_int, g_intData, 6) without having received XUD acknowledgement. in your case, if you consider the front-panel volume knob being the "master" then no problem with that.
That's a mistake, thanks for spotting. Actually it doesn't matter since the underlying code only really cares about ISO or not. I will fix though, to avoid confusion.