forked from PAWPAW-Mirror/lib_xua
Level meter LED code fixed up
This commit is contained in:
@@ -194,7 +194,7 @@ static inline int badParity(unsigned x)
|
|||||||
void VendorLedRefresh(unsigned levelData[]);
|
void VendorLedRefresh(unsigned levelData[]);
|
||||||
unsigned g_inputLevelData[NUM_USB_CHAN_IN];
|
unsigned g_inputLevelData[NUM_USB_CHAN_IN];
|
||||||
extern int samples_to_host_inputs[NUM_USB_CHAN_IN];
|
extern int samples_to_host_inputs[NUM_USB_CHAN_IN];
|
||||||
extern int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
extern int samples_to_host_inputs_buff[NUM_USB_CHAN_IN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int VendorAudCoreReqs(unsigned cmd, chanend c);
|
int VendorAudCoreReqs(unsigned cmd, chanend c);
|
||||||
@@ -326,17 +326,24 @@ void clockGen (streaming chanend c_spdif_rx, chanend ?c_adat_rx, out port p, cha
|
|||||||
for(int i = 0; i< NUM_USB_CHAN_IN; i++)
|
for(int i = 0; i< NUM_USB_CHAN_IN; i++)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
|
/* Read level data */
|
||||||
//g_inputLevelData[i] = samples_to_host_inputs[i];
|
//g_inputLevelData[i] = samples_to_host_inputs[i];
|
||||||
asm("ldw %0, %1[%2]":"=r"(tmp):"r"(samples_to_host_inputs),"r"(i));
|
asm volatile("ldw %0, %1[%2]":"=r"(tmp):"r"((const int *)samples_to_host_inputs),"r"(i));
|
||||||
g_inputLevelData[i] = tmp;
|
g_inputLevelData[i] = tmp;
|
||||||
|
|
||||||
|
/* Reset level data */
|
||||||
//samples_to_host_inputs[i] = 0;
|
//samples_to_host_inputs[i] = 0;
|
||||||
asm("stw %0, %1[%2]"::"r"(0),"r"(samples_to_host_inputs),"r"(i));
|
asm volatile("stw %0, %1[%2]"::"r"(0),"r"((const int *)samples_to_host_inputs),"r"(i));
|
||||||
|
|
||||||
/* Guard against host polling slower than timer and missing peaks */
|
/* Guard against host polling slower than timer and missing peaks */
|
||||||
if(g_inputLevelData[i] > samples_to_host_inputs_buff[i])
|
asm volatile("ldw %0, %1[%2]":"=r"(tmp):"r"((const int *)samples_to_host_inputs_buff),"r"(i));
|
||||||
|
|
||||||
|
if (g_inputLevelData[i] > tmp)
|
||||||
|
//if(g_inputLevelData[i] > samples_to_host_inputs_buff[i])
|
||||||
{
|
{
|
||||||
samples_to_host_inputs_buff[i] = g_inputLevelData[i];
|
//samples_to_host_inputs_buff[i] = g_inputLevelData[i];
|
||||||
|
asm volatile("stw %0, %1[%2]"::"r"(tmp),"r"((const int *)samples_to_host_inputs),"r"(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ xc_ptr samples_to_host_inputs_ptr;
|
|||||||
|
|
||||||
#ifdef LEVEL_METER_LEDS
|
#ifdef LEVEL_METER_LEDS
|
||||||
int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
||||||
|
xc_ptr samples_to_host_inputs_buff_ptr;
|
||||||
#endif
|
#endif
|
||||||
static int samples_from_host_streams[NUM_USB_CHAN_OUT]; /* Peak samples for audio stream from host */
|
static int samples_from_host_streams[NUM_USB_CHAN_OUT]; /* Peak samples for audio stream from host */
|
||||||
|
|
||||||
@@ -414,8 +415,8 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
|||||||
//val = samples_to_host_inputs_buff[index];
|
//val = samples_to_host_inputs_buff[index];
|
||||||
//samples_to_host_inputs_buff[index] = 0;
|
//samples_to_host_inputs_buff[index] = 0;
|
||||||
/* Access funcs used to avoid disjointness check */
|
/* Access funcs used to avoid disjointness check */
|
||||||
read_via_xc_ptr_indexed(val, samples_to_host_inputs_buff, index);
|
read_via_xc_ptr_indexed(val, samples_to_host_inputs_buff_ptr, index);
|
||||||
write_via_xc_ptr_indexed(samples_to_host_inputs_buff, index, 0);
|
write_via_xc_ptr_indexed(samples_to_host_inputs_buff_ptr, index, 0);
|
||||||
#else
|
#else
|
||||||
/* We dont have a level LEDs process, so reset ourselves */
|
/* We dont have a level LEDs process, so reset ourselves */
|
||||||
//val = samples_to_host_inputs[index];
|
//val = samples_to_host_inputs[index];
|
||||||
@@ -711,6 +712,9 @@ void mixer(chanend c_mix_in, chanend c_mix_out, chanend c_mix_ctl)
|
|||||||
samples_to_device_map = array_to_xc_ptr((samples_to_device_map_array,unsigned[]));
|
samples_to_device_map = array_to_xc_ptr((samples_to_device_map_array,unsigned[]));
|
||||||
|
|
||||||
samples_to_host_inputs_ptr = array_to_xc_ptr((samples_to_host_inputs, unsigned[]));
|
samples_to_host_inputs_ptr = array_to_xc_ptr((samples_to_host_inputs, unsigned[]));
|
||||||
|
#ifdef LEVEL_METER_LEDS
|
||||||
|
samples_to_host_inputs_buff_ptr = array_to_xc_ptr((samples_to_host_inputs, unsigned[]));
|
||||||
|
#endif
|
||||||
samples_mixer_outputs_ptr = array_to_xc_ptr((samples_mixer_outputs, unsigned[]));
|
samples_mixer_outputs_ptr = array_to_xc_ptr((samples_mixer_outputs, unsigned[]));
|
||||||
|
|
||||||
#if MAX_MIX_COUNT >0
|
#if MAX_MIX_COUNT >0
|
||||||
|
|||||||
Reference in New Issue
Block a user