Conflicted merge stable -> master

This commit is contained in:
Ross Owen
2016-04-05 14:45:41 +01:00
12 changed files with 64 additions and 105 deletions

View File

@@ -156,7 +156,8 @@
<option id = "com.xmos.xc.compiler.option.include.paths.75459587" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/.settings}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/clocking}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/endpoint0}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/hostactive}&quot;' />
@@ -280,7 +281,8 @@
<option id = "com.xmos.c.compiler.option.include.paths.26873840" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/.settings}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/clocking}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/endpoint0}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/hostactive}&quot;' />
@@ -410,7 +412,8 @@
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/.settings}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/audiostream}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/clocking}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/endpoint0}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_audio/hostactive}&quot;' />

View File

@@ -1098,7 +1098,7 @@ chanend ?c_config, chanend ?c
null,
p_dsd_clk,
#endif
divide, dsdMode);
divide, curSamFreq, dsdMode);
}
else
#endif
@@ -1122,7 +1122,7 @@ chanend ?c_config, chanend ?c
p_bclk,
#endif
#endif
divide, dsdMode);
divide, curSamFreq, dsdMode);
}

View File

@@ -43,7 +43,7 @@ void ConfigAudioPortsWrapper(
port p_lrclk,
port p_bclk,
#endif
unsigned int divide, unsigned int dsdMode)
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode)
{
ConfigAudioPorts(
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
@@ -56,5 +56,5 @@ unsigned int divide, unsigned int dsdMode)
#endif
p_lrclk,
p_bclk,
divide);
divide, curSamFreq);
}

View File

@@ -26,7 +26,7 @@ void ConfigAudioPorts(
in port p_bclk,
#endif
#endif
unsigned int divide);
unsigned int divide, unsigned int curSamFreq);
#else
void ConfigAudioPorts(
@@ -49,7 +49,7 @@ void ConfigAudioPorts(
port p_bclk,
#endif
#endif
unsigned int divide);
unsigned int divide, unsigned int curSamFreq);
#endif /* __XC__*/
@@ -74,7 +74,7 @@ void ConfigAudioPortsWrapper(
in port p_bclk,
#endif
#endif
unsigned int divide, unsigned int dsdMode);
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
#else
void ConfigAudioPortsWrapper(
@@ -90,7 +90,7 @@ void ConfigAudioPortsWrapper(
port p_lrclk,
port p_bclk,
#endif
unsigned int divide, unsigned int dsdMode);
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
#endif /* __XC__*/

View File

@@ -28,7 +28,7 @@ void ConfigAudioPorts(
in port p_bclk,
#endif
#endif
unsigned int divide)
unsigned int divide, unsigned curSamFreq)
{
#if !defined(CODEC_MASTER)
/* Note this call to stop_clock() will pause forever if the port clocking the clock-block is not low.
@@ -116,6 +116,18 @@ unsigned int divide)
/* Clock bclk clock-block from bclk pin */
configure_clock_src(clk_audio_bclk, p_bclk);
/* Do some clocking shifting to get data in the valid window */
/* E.g. Only shift when running at 88.2+ kHz TDM slave */
int bClkDelay_fall = 0;
if(curSamFreq * I2S_CHANS_PER_FRAME * 32 >= 20000000)
{
/* 18 * 2ns = 36ns. This results in a -4ns (36 - 40) shift at 96KHz and -8ns (36 - 44) at 88.4KHz */
bClkDelay_fall = 18;
}
set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall);
#if (I2S_CHANS_DAC != 0)
/* Clock I2S output data ports from b-clock clock block */
for(int i = 0; i < I2S_WIRES_DAC; i++)

View File

@@ -2,16 +2,16 @@
#define __interrupt_h__
#define store_args0(c) \
asm("kentsp 19; stw %0, sp[1]; krestsp 19"::"r"(c));
asm("kentsp 20; stw %0, sp[1]; krestsp 20"::"r"(c));
#define store_args1(c,x) \
asm("kentsp 20; stw %0, sp[1]; stw %1, sp[2]; krestsp 20"::"r"(c),"r"(x));
#define store_args2(c,x0,x1) \
asm("kentsp 21; stw %0, sp[1];" \
asm("kentsp 22; stw %0, sp[1];" \
"stw %1, sp[2];" \
"stw %2, sp[3];" \
" krestsp 21"::"r"(c),"r"(x0),"r"(x1));
" krestsp 22"::"r"(c),"r"(x0),"r"(x1));
#define store_args3(c,x0,x1,x2) \
asm("kentsp 22; stw %0, sp[1];" \
@@ -20,63 +20,6 @@
"stw %3, sp[4];" \
" krestsp 22"::"r"(c),"r"(x0),"r"(x1),"r"(x2));
#define store_args4(c,x0,x1,x2,x3) \
asm("kentsp 23; stw %4, sp[1];" \
"stw %0, sp[2];" \
"stw %1, sp[3];" \
"stw %2, sp[4];" \
"stw %3, sp[5];" \
" krestsp 23"::"r"(c),"r"(x0),"r"(x1),"r"(x2),"r"(x3));
#define store_args5(c,x0,x1,x2,x3,x4) \
asm("kentsp 24;" \
"stw %4, sp[1];" \
"stw %5, sp[2];" \
"stw %0, sp[3];" \
"stw %1, sp[4];" \
"stw %2, sp[5];" \
"stw %3, sp[6];" \
" krestsp 24"::"r"(c),"r"(x0),"r"(x1),"r"(x2),"r"(x3),"r"(x4));
#define store_args6(c,x0,x1,x2,x3,x4,x5) \
asm("kentsp 25;" \
"stw %4, sp[1];" \
"stw %5, sp[2];" \
"stw %6, sp[3];" \
"stw %0, sp[4];" \
"stw %1, sp[5];" \
"stw %2, sp[6];" \
"stw %3, sp[7];" \
" krestsp 25"::"r"(c),"r"(x0),"r"(x1),"r"(x2),"r"(x3),"r"(x4),"r"(x5));
#define store_args7(c,x0,x1,x2,x3,x4,x5,x6) \
asm("kentsp 26;" \
"stw %4, sp[1];" \
"stw %5, sp[2];" \
"stw %6, sp[3];" \
"stw %7, sp[4];" \
"stw %0, sp[5];" \
"stw %1, sp[6];" \
"stw %2, sp[7];" \
"stw %3, sp[8];" \
" krestsp 26"::"r"(c),"r"(x0),"r"(x1),"r"(x2),"r"(x3),"r"(x4),"r"(x5),"r"(x6));
#define store_args8(c,x0,x1,x2,x3,x4,x5,x6,x7) \
asm("kentsp 27;" \
"stw %4, sp[1];" \
"stw %5, sp[2];" \
"stw %6, sp[3];" \
"stw %7, sp[4];" \
"stw %8, sp[5];" \
"stw %0, sp[6];" \
"stw %1, sp[7];" \
"stw %2, sp[8];" \
"stw %3, sp[9];" \
" krestsp 27"::"r"(c),"r"(x0),"r"(x1),"r"(x2),"r"(x3),"r"(x4),"r"(x5),"r"(x6),"r"(x7));
#define load_args0(f) \
"ldw r0, sp[1]\n"
@@ -95,22 +38,6 @@
"ldw r2, sp[3]\n" \
"ldw r3, sp[4]\n"
#define load_argsn(f, args) \
".linkset __"#f"_handler_arg0, "#args"-2\n"\
"ldw r0, sp[" "__"#f"_handler_arg0" "]\n" \
".linkset __"#f"_handler_arg1, "#args"-1\n"\
"ldw r1, sp[" "__"#f"_handler_arg1" "]\n" \
".linkset __"#f"_handler_arg2, "#args"-0\n"\
"ldw r2, sp[" "__"#f"_handler_arg2" "]\n" \
".linkset __"#f"_handler_arg3, "#args"+1\n"\
"ldw r3, sp[" "__"#f"_handler_arg3" "]\n"
#define load_args4(f) load_argsn(f,4)
#define load_args5(f) load_argsn(f,5)
#define load_args6(f) load_argsn(f,6)
#define load_args7(f) load_argsn(f,7)
#define load_args8(f) load_argsn(f,8)
#define save_state(f,args) \
".linkset __"#f"_handler_r0_save, "#args"+12\n" \
"stw r0, sp[" "__"#f"_handler_r0_save" "]\n" \
@@ -156,13 +83,13 @@
".align 4\n" \
"__" #f "_handler:\n" \
"ENTSP_lu6 0\n" \
"kentsp " #args " + 19\n" \
"kentsp " #args "/2*2 + 20\n" \
"__kent:" \
save_state(f,args) \
load_args ## args (f) \
"bl " #f "\n" \
restore_state(f,args) \
"krestsp " #args " + 19 \n" \
"krestsp " #args "/2*2 + 20 \n" \
"__kret:\n" \
"kret\n");
@@ -174,7 +101,7 @@
"__" #f "_kernel_stack:\n" \
" .space " #nstackwords ", 0\n" \
"__" #f "_kernel_stack_end:\n" \
" .space 2\n"\
" .space 4\n"\
" .text\n"); \
do_interrupt_handler(f, args)
@@ -186,7 +113,5 @@
asm("setc res[%0], 0xa; eeu res[%0]"::"r"(c)); \
asm("setsr (((0) & ~(((1 << 0x1) - 1) << 0x1)) | (((1) << 0x1) & (((1 << 0x1) - 1) << 0x1)))");
#endif