forked from PAWPAW-Mirror/lib_xua
Added missing audiohub_adat.h
This commit is contained in:
48
lib_xua/src/core/audiohub/audiohub_adat.h
Normal file
48
lib_xua/src/core/audiohub/audiohub_adat.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma unsafe arrays
|
||||
static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samplesFromHost[], int smux, int handshake)
|
||||
{
|
||||
|
||||
/* Do some re-arranging for SMUX.. */
|
||||
unsafe
|
||||
{
|
||||
unsigned * unsafe samplesFromHostAdat = &samplesFromHost[ADAT_TX_INDEX];
|
||||
|
||||
/* Note, when smux == 1 this loop just does a straight 1:1 copy */
|
||||
//if(smux != 1)
|
||||
{
|
||||
int adatSampleIndex = adatCounter;
|
||||
for(int i = 0; i < (8/smux); i++)
|
||||
{
|
||||
adatSamples[adatSampleIndex] = samplesFromHostAdat[i];
|
||||
adatSampleIndex += smux;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
adatCounter++;
|
||||
|
||||
if(adatCounter == smux)
|
||||
{
|
||||
|
||||
#ifdef ADAT_TX_USE_SHARED_BUFF
|
||||
unsafe
|
||||
{
|
||||
/* Wait for ADAT core to be done with buffer */
|
||||
/* Note, we are "running ahead" of the ADAT core */
|
||||
inuint(c_adat_out);
|
||||
|
||||
/* Send buffer pointer over to ADAT core */
|
||||
volatile unsigned * unsafe samplePtr = &adatSamples;
|
||||
outuint(c_adat_out, (unsigned) samplePtr);
|
||||
}
|
||||
#else
|
||||
#pragma loop unroll
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
outuint(c_adat_out, samplesFromHost[ADAT_TX_INDEX + i]);
|
||||
}
|
||||
#endif
|
||||
adatCounter = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user