#include "drv/global.h"
|
#include "f2f.h"
|
|
|
|
static float rx_channel[PHY_NUM_INPUTS][NUM_SAMPLES];
|
static float tx_channel[PHY_NUM_OUTPUTS][NUM_SAMPLES];
|
|
|
extern int sport0a_buf[2][NUM_SAMPLES*2];
|
extern int sport0b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport1a_buf[2][NUM_SAMPLES*2];
|
extern int sport1b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport2a_buf[2][NUM_SAMPLES*2];
|
extern int sport2b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport3a_buf[2][NUM_SAMPLES*2];
|
extern int sport3b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport4a_buf[2][NUM_SAMPLES*2];
|
extern int sport4b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport5a_buf[2][NUM_SAMPLES*2];
|
extern int sport5b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport6a_buf[2][NUM_SAMPLES*2];
|
extern int sport6b_buf[2][NUM_SAMPLES*2];
|
|
extern int sport7a_buf[2][NUM_SAMPLES*2];
|
extern int sport7b_buf[2][NUM_SAMPLES*2];
|
|
|
float* rx_channel_ptr[]={
|
rx_channel[0],rx_channel[1],rx_channel[2],rx_channel[3]
|
,rx_channel[4],rx_channel[5],rx_channel[6],rx_channel[7]
|
#if PHY_NUM_INPUTS>8
|
,rx_channel[8],rx_channel[9],rx_channel[10] ,rx_channel[11]
|
,rx_channel[12],rx_channel[13] ,rx_channel[14] ,rx_channel[15]
|
#endif
|
};
|
float* tx_channel_ptr[]={
|
tx_channel[0] ,tx_channel[1] ,tx_channel[2] ,tx_channel[3]
|
,tx_channel[4] ,tx_channel[5] ,tx_channel[6] ,tx_channel[7]
|
#if PHY_NUM_INPUTS>8
|
,tx_channel[8] ,tx_channel[9] ,tx_channel[10] ,tx_channel[11]
|
,tx_channel[12] ,tx_channel[13] ,tx_channel[14] ,tx_channel[15]
|
#endif
|
};
|
|
// Structures to hold floating point data for each AD1939
|
//ad1939_float_data fBlockA;
|
|
inline void floatData(float *output, const int *input, unsigned int instep, unsigned int length)
|
{
|
int i;
|
|
for(i = 0; i < length; i++)
|
{
|
output[i] = __builtin_conv_RtoF(input[instep*i]);
|
}
|
}
|
|
|
// Unoptimized function to convert the outgoing floating-point data to 1.31 fixed-point format.
|
inline void fixData(int *output, const float *input, unsigned int outstep, unsigned int length)
|
{
|
int i;
|
|
for(i = 0; i < length; i++)
|
{
|
output[outstep*i] = __builtin_conv_FtoR(input[i]);
|
}
|
}
|
|
|
|
|
void input_fflush(const unsigned int blockIndex)
|
{
|
// Float ADC data from
|
#ifndef DEMO_BOARD
|
floatData(get_rx_channel(4), sport1a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(5), sport1a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(6), sport1b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(7), sport1b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(0), sport3a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(1), sport3a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(2), sport3b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(3), sport3b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
#if PHY_NUM_INPUTS>8
|
floatData(get_rx_channel(9), sport5a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(8), sport5a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(11), sport5b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(10), sport5b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(13), sport7a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(12), sport7a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(15), sport7b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(14), sport7b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
#endif
|
#else
|
floatData(get_rx_channel(0), sport1a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(1), sport1a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(2), sport1b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(3), sport1b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(4), sport3a_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(5), sport3a_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
|
floatData(get_rx_channel(6), sport3b_buf[blockIndex]+0, 2, NUM_SAMPLES);
|
floatData(get_rx_channel(7), sport3b_buf[blockIndex]+1, 2, NUM_SAMPLES);
|
#endif
|
}
|
|
|
|
|
void output_fflush(const unsigned int blockIndex)
|
{
|
#ifndef DEMO_BOARD
|
fixData(sport0a_buf[blockIndex]+0, get_rx_channel(1), 2, NUM_SAMPLES);
|
fixData(sport0a_buf[blockIndex]+1, get_rx_channel(0), 2, NUM_SAMPLES);
|
|
fixData(sport0b_buf[blockIndex]+0, get_rx_channel(3), 2, NUM_SAMPLES);
|
fixData(sport0b_buf[blockIndex]+1, get_rx_channel(2), 2, NUM_SAMPLES);
|
|
fixData(sport2a_buf[blockIndex]+0, get_rx_channel(5), 2, NUM_SAMPLES);
|
fixData(sport2a_buf[blockIndex]+1, get_rx_channel(4), 2, NUM_SAMPLES);
|
|
fixData(sport2b_buf[blockIndex]+0, get_rx_channel(7), 2, NUM_SAMPLES);
|
fixData(sport2b_buf[blockIndex]+1, get_rx_channel(6), 2, NUM_SAMPLES);
|
#if PHY_NUM_INPUTS>8
|
fixData(sport4a_buf[blockIndex]+0, get_rx_channel(9), 2, NUM_SAMPLES);
|
fixData(sport4a_buf[blockIndex]+1, get_rx_channel(8), 2, NUM_SAMPLES);
|
|
fixData(sport4b_buf[blockIndex]+0, get_rx_channel(11), 2, NUM_SAMPLES);
|
fixData(sport4b_buf[blockIndex]+1, get_rx_channel(10), 2, NUM_SAMPLES);
|
|
fixData(sport6a_buf[blockIndex]+0, get_rx_channel(13), 2, NUM_SAMPLES);
|
fixData(sport6a_buf[blockIndex]+1, get_rx_channel(12), 2, NUM_SAMPLES);
|
|
fixData(sport6b_buf[blockIndex]+0, get_rx_channel(15), 2, NUM_SAMPLES);
|
fixData(sport6b_buf[blockIndex]+1, get_rx_channel(14), 2, NUM_SAMPLES);
|
#endif
|
#else
|
fixData(sport0a_buf[blockIndex]+0, get_rx_channel(0), 2, NUM_SAMPLES);
|
fixData(sport0a_buf[blockIndex]+1, get_rx_channel(1), 2, NUM_SAMPLES);
|
|
fixData(sport0b_buf[blockIndex]+0, get_rx_channel(2), 2, NUM_SAMPLES);
|
fixData(sport0b_buf[blockIndex]+1, get_rx_channel(3), 2, NUM_SAMPLES);
|
|
fixData(sport2a_buf[blockIndex]+0, get_rx_channel(4), 2, NUM_SAMPLES);
|
fixData(sport2a_buf[blockIndex]+1, get_rx_channel(5), 2, NUM_SAMPLES);
|
|
fixData(sport2b_buf[blockIndex]+0, get_rx_channel(6), 2, NUM_SAMPLES);
|
fixData(sport2b_buf[blockIndex]+1, get_rx_channel(7), 2, NUM_SAMPLES);
|
#endif
|
}
|