xpd: Cleaned up whitespace

This commit is contained in:
Ross Owen
2023-03-15 13:00:39 +00:00
parent 7e3ae59acc
commit e2c36a9a95
11 changed files with 145 additions and 145 deletions

View File

@@ -1,7 +1,7 @@
// Copyright 2022-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
/* Tests that routing of mixer outputs behaves as expected
/* Tests that routing of mixer outputs behaves as expected
*
* "Outputs" from the device are to the USB host of one of the various audio interaces supported.
@@ -18,7 +18,7 @@
* each of the M mixer units is as follows:
*
* MIXER[0]:
* USB_FROM_HOST[0] -> MIXER[0].INPUT[0]
* USB_FROM_HOST[0] -> MIXER[0].INPUT[0]
* USB_FROM_HOST[1] -> MIXER[0].INPUT[1]
* ...
USB_TO_HOST[0] -> MIXER[0].INPUT[NUM_USB_CHAN_OUT]
@@ -26,7 +26,7 @@
...
* MIXER[MAX_MIX_COUNT-1]:
* USB_FROM_HOST[0] -> MIXER[MAX_MIX_COUNT-1].INPUT[0]
* USB_FROM_HOST[0] -> MIXER[MAX_MIX_COUNT-1].INPUT[0]
* USB_FROM_HOST[1] -> MIXER[MAX_MIX_COUNT-1].INPUT[1]
* ...
*
@@ -47,7 +47,7 @@
#include "assert.h"
#include "random.h"
#ifndef TEST_ITERATIONS
#ifndef TEST_ITERATIONS
#define TEST_ITERATIONS (100)
#endif
@@ -72,7 +72,7 @@ void UpdateModel(uint32_t modelOut[CHANNEL_MAP_AUD_SIZE], uint32_t modelMixerOut
src -= NUM_USB_CHAN_OUT;
SET_CHANNEL(sample, src);
}
else
else
{
SET_SOURCE(sample, SRC_HOST);
SET_CHANNEL(sample, src);
@@ -83,19 +83,19 @@ void UpdateModel(uint32_t modelOut[CHANNEL_MAP_AUD_SIZE], uint32_t modelMixerOut
case SET_SAMPLES_TO_DEVICE_MAP:
modelOut[dst] = sample;
break;
case SET_SAMPLES_TO_HOST_MAP:
modelIn[dst] = sample;
break;
default:
assert(0);
break;
}
}
/* This task configures the routing and maintains a model of the expected routing output
* it provides this to the Fake AudioHub and Fake Decouple tasks such that they can self check
/* This task configures the routing and maintains a model of the expected routing output
* it provides this to the Fake AudioHub and Fake Decouple tasks such that they can self check
*/
void stim(chanend c_stim_ah, chanend c_stim_de, chanend c_mix_ctl)
{
@@ -147,7 +147,7 @@ void stim(chanend c_stim_ah, chanend c_stim_de, chanend c_mix_ctl)
/* Make a random update to the routing - route a random source to a random destination */
unsigned map = testCmd[random_get_random_number(rg) % (sizeof(testCmd)/sizeof(testCmd[0]))];
unsigned dst = random_get_random_number(rg) % CHANNEL_MAP_AUD_SIZE; // TODO this should be CHANNEL_MAP_USB_SIZE for SET_SAMPLES_TO_HOST_MAP
unsigned src = random_get_random_number(rg) % (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
unsigned src = random_get_random_number(rg) % (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
switch(map)
{
@@ -160,7 +160,7 @@ void stim(chanend c_stim_ah, chanend c_stim_de, chanend c_mix_ctl)
/* Update the mixer */
SendTrigger(c_stim_ah, 1);
UpdateMixerOutputRouting(c_mix_ctl, map, dst, src);
UpdateMixerOutputRouting(c_mix_ctl, map, dst, src);
break;
case SET_SAMPLES_TO_HOST_MAP:
@@ -169,10 +169,10 @@ void stim(chanend c_stim_ah, chanend c_stim_de, chanend c_mix_ctl)
debug_printf(" from %d", src);
PrintSourceString(src);
debug_printf("\n");
/* Update the mixer */
SendTrigger(c_stim_ah, 1);
UpdateMixerOutputRouting(c_mix_ctl, map, dst, src);
UpdateMixerOutputRouting(c_mix_ctl, map, dst, src);
break;
default:
@@ -191,10 +191,10 @@ void stim(chanend c_stim_ah, chanend c_stim_de, chanend c_mix_ctl)
/* Send kill messages to Fake AudioHub & Fake Decouple */
outct(c_stim_ah, XS1_CT_END);
inct(c_stim_ah);
outct(c_stim_de, XS1_CT_END);
inct(c_stim_de);
printstrln("PASS");
exit(0);
}
@@ -211,7 +211,7 @@ int main()
{
Fake_XUA_Buffer_Decouple(c_dec_mix, c_stim_de);
Fake_XUA_AudioHub(c_mix_aud, c_stim_ah);
/* Mixer from lib_xua */
mixer(c_dec_mix, c_mix_aud, c_mix_ctl);

View File

@@ -6,7 +6,7 @@
/* A limitation of the design is that the number of routable output destinations cannot be larger than NUM_USB_CHAN_OUT.
* This is due to the transfer samples from Mixer to AudioHub tasks being in blocks of NUM_USB_CHAN_OUT.
* This is not normally an issue - since every physical output interface channel on the device is normally derived from a
* This is not normally an issue - since every physical output interface channel on the device is normally derived from a
* USB channel from the host, but it certainly is a restriction.
*/
#define CHANNEL_MAP_AUD_SIZE NUM_USB_CHAN_OUT
@@ -14,7 +14,7 @@
#define CHANNEL_MAP_USB_SIZE NUM_USB_CHAN_IN
/* Number of channel sources, the channel ordering is as follows
* i.e.
* i.e.
* [0:NUM_USB_CHAN_OUT-1] : Channels from USB Host
* [NUM_USB_CHAN_OUT:NUM_USB_CHAN_IN-1] : Channels from Audio Interfaces
* [NUM_USB_CHAN_N:MAX_MIX_COUNT-1] : Channels from Mixers
@@ -59,7 +59,7 @@ void SendTrigger(chanend c_stim_ah, int count)
uint32_t CreateSample(uint32_t modelMixerOutput[], int src)
{
uint32_t sample = 0;
if(src == (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT))
{
SET_SOURCE(sample, SRC_OFF);
@@ -75,7 +75,7 @@ uint32_t CreateSample(uint32_t modelMixerOutput[], int src)
src -= NUM_USB_CHAN_OUT;
SET_CHANNEL(sample, src);
}
else
else
{
SET_SOURCE(sample, SRC_HOST);
SET_CHANNEL(sample, src);
@@ -177,7 +177,7 @@ void SendExpected(chanend c_stim_ah, chanend c_stim_de, uint32_t modelOut[], uin
outuint(c_stim_ah, SET_EXPECTED);
for(int i = 0; i < CHANNEL_MAP_AUD_SIZE; i++)
{
{
outuint(c_stim_ah, modelOut[i]);
}
@@ -187,7 +187,7 @@ void SendExpected(chanend c_stim_ah, chanend c_stim_de, uint32_t modelOut[], uin
/* Send expected to Decouple */
outuint(c_stim_de, SET_EXPECTED);
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
{
{
outuint(c_stim_de, modelIn[i]);
}
@@ -204,7 +204,7 @@ extern unsigned samplesIn[2][NUM_USB_CHAN_IN];
#include "xua_audiohub_st.h"
int Fake_XUA_AudioHub(chanend c_mix_aud, chanend c_stim)
{
{
int readBuffNo = 0;
unsigned underflowWord = 0;
uint32_t expectedOut[NUM_USB_CHAN_OUT];
@@ -222,35 +222,35 @@ int Fake_XUA_AudioHub(chanend c_mix_aud, chanend c_stim)
while(!ct)
{
select
{
case testct_byref(c_stim, ct):
if(!ct)
{
cmd = inuint(c_stim);
cmd = inuint(c_stim);
switch(cmd)
{
case SET_EXPECTED:
for(int j = 0; j < NUM_USB_CHAN_OUT; j++)
{
expectedOut[j] = inuint(c_stim);
}
}
debug_printf("AudioHub:\n");
CheckBlock(samplesOut, expectedOut, NUM_USB_CHAN_OUT);
/* Handshake back */
outuint(c_stim, 0);
break;
case TRIGGER:
/* This will populate samplesOut and send out samplesIn[readBuffNo] */
unsigned command = DoSampleTransfer(c_mix_aud, readBuffNo, underflowWord);
break;
default:
printstr("ERROR: bad cmd in Fake_XUA_AudioHub: ");
printintln(cmd);
@@ -268,7 +268,7 @@ int Fake_XUA_AudioHub(chanend c_mix_aud, chanend c_stim)
}
int Fake_XUA_Buffer_Decouple(chanend c_dec_mix, chanend c_stim)
{
{
uint32_t expectedSamplesIn[NUM_USB_CHAN_IN];
unsigned samplesIn[NUM_USB_CHAN_IN];
unsigned ct;
@@ -292,21 +292,21 @@ int Fake_XUA_Buffer_Decouple(chanend c_dec_mix, chanend c_stim)
{
samplesIn[i] = inuint(c_dec_mix);
}
break;
case testct_byref(c_stim, ct):
if(!ct)
{
inuint(c_stim); // TODO don't really need this
inuint(c_stim); // TODO don't really need this
/* Get expected */
for(int j = 0; j < NUM_USB_CHAN_IN; j++)
{
expectedSamplesIn[j] = inuint(c_stim);
}
}
debug_printf("Decouple:\n");
CheckBlock(samplesIn, expectedSamplesIn, NUM_USB_CHAN_IN);
@@ -316,7 +316,7 @@ int Fake_XUA_Buffer_Decouple(chanend c_dec_mix, chanend c_stim)
break;
}
}
outct(c_stim, XS1_CT_END);
inct(c_stim);
return 0;