Problem solved with the help of 'AN00103'.
New issue !
I want to put a 'dsd_indicator' to show if we run in dsd native or not.
The 'dsd_indicator' is declared to output on port 32A.
As show :
Code: Select all
port32A.h
#ifndef _PORT32A_OUT_
#define _PORT32A_OUT_
/* Bit defs */
#define P32A_USB_RST 0x01 /* ULPI rst line */
#define P32A_COD_RST 0x02 /* Codec rst line */
#define P32A_CLK_SEL 0x04 /* MClk Select line */
#define P32A_LED_A 0x08 /* LED A */
#define P32A_DSD_IND 0x10 /* DSD Indicator */
#define P32A_LED_B 0x20 /* LED B */
#endif
For now, it works when I playback a dsd file. It illuminate a led connected to 'P32A_DSD_IND' and then when I playback a file other than dsd the led extinguished.
But I want also to extinguish the led when I have no playback and here is my issue. I tried when using 'UserAudioStreamStop()' and it didn't work.
Code: Select all
audio.xc
/* Main Audio I/O loop */
while (1)
{
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
if(dsdMode == DSD_MODE_NATIVE)
{
asm("peek %0, res[%1]":"=r"(x):"r"(XS1_PORT_32A));
x |= P32A_DSD_IND;
asm("out res[%0], %1"::"r"(XS1_PORT_32A),"r"(x));
}
else
{
asm("peek %0, res[%1]":"=r"(x):"r"(XS1_PORT_32A));
x &= (~P32A_DSD_IND);
x |= P32A_LED_A;
asm("out res[%0], %1"::"r"(XS1_PORT_32A),"r"(x));
}
#endif
Code: Select all
audiostream.xc
void UserAudioStreamStop(void)
{
int x;
/* Peek at current port value using port 32A resource ID */
asm("peek %0, res[%1]":"=r"(x):"r"(XS1_PORT_32A));
// x &= (~P32A_LED_B);
x &= (~P32A_DSD_IND);
/* Output to port */
asm("out res[%0], %1"::"r"(XS1_PORT_32A),"r"(x));
}
If you have any suggestions to help me doing it, thanks.