Platform/ECM3532/DSP/hw/sensor_drv/fft_composite/src/fft.c
//Performs fft of all 3 components. Input is in de-interleaved arrays: sensor_x[], sensor_y[] and sensor_z[].
//FFT output temporarily stored in temporary buffer and then DMA'ed to IOMEM buffer at "offset"
//offset --> Iomemoffset in bytes.
//length --> Total FFT frame length for all 3 components = (512 * 3 * 2), each components is 512 uint16 type.
Performs fft of all 3 components.
Performs fft of all 3 components .
void doFFTOnSensorData(uint16_t offset, uint16_t length)
{
    uint16_t dataoffset;
    volatile void * iomemaddr = 0;
    iomemaddr = getSharedMemoryAddress(offset);
    dataoffset = (uint16_t)iomemaddr;
#ifdef FFT_WITH_WINDOWING
    TRACE("Hamming window on sensor data\n\r");
#endif
    TRACE("FFT on sensor data\n\r");
    const CFX_FFT_TABLE* table; 
    table = cfx_fft_tables[6];
    cfx_fft_r_stagescaling_Process((fix*)&sensor_x[0], (fix*)&temp_fftX[0], N_FFT, table); 
    TRACE("X[0]= %d \n\r", temp_fftX[0]);
    dma_xmem_to_iomem(iomemaddr , (void *)&temp_fftX[0], length / 3);
    dataoffset += length / 6;
    iomemaddr = (volatile void *)dataoffset;
    cfx_fft_r_stagescaling_Process((fix*)&sensor_y[0], (fix*)&temp_fftX[0], N_FFT, table); 
    TRACE("Y[0]=%d\n\r", temp_fftX[0]);
    dma_xmem_to_iomem(iomemaddr , (void*)&temp_fftX[0], length / 3);
    dataoffset += length / 6;
    iomemaddr = (volatile void *)dataoffset;
    cfx_fft_r_stagescaling_Process((fix*)&sensor_z[0], (fix*)&temp_fftX[0], N_FFT, table); 
    TRACE("Z[0]=%d\n\r", temp_fftX[0]);
    dma_xmem_to_iomem(iomemaddr , (void*)&temp_fftX[0], length / 3);
    resetArrayIndex();
}
void doFFTOnSensorData ( uint16_t offset , uint16_t length ) { uint16_t dataoffset ; volatile void * iomemaddr = 0 ; iomemaddr = getSharedMemoryAddress ( offset ) ; dataoffset = ( uint16_t ) iomemaddr ; #ifdef FFT_WITH_WINDOWING TRACE ( " \n \r " ) ; #endif TRACE ( " \n \r " ) ; const CFX_FFT_TABLE * table ; table = cfx_fft_tables [ 6 ] ; cfx_fft_r_stagescaling_Process ( ( fix * ) & sensor_x [ 0 ] , ( fix * ) & temp_fftX [ 0 ] , N_FFT , table ) ; TRACE ( " \n \r " , temp_fftX [ 0 ] ) ; dma_xmem_to_iomem ( iomemaddr , ( void * ) & temp_fftX [ 0 ] , length / 3 ) ; dataoffset += length / 6 ; iomemaddr = ( volatile void * ) dataoffset ; cfx_fft_r_stagescaling_Process ( ( fix * ) & sensor_y [ 0 ] , ( fix * ) & temp_fftX [ 0 ] , N_FFT , table ) ; TRACE ( " \n \r " , temp_fftX [ 0 ] ) ; dma_xmem_to_iomem ( iomemaddr , ( void * ) & temp_fftX [ 0 ] , length / 3 ) ; dataoffset += length / 6 ; iomemaddr = ( volatile void * ) dataoffset ; cfx_fft_r_stagescaling_Process ( ( fix * ) & sensor_z [ 0 ] , ( fix * ) & temp_fftX [ 0 ] , N_FFT , table ) ; TRACE ( " \n \r " , temp_fftX [ 0 ] ) ; dma_xmem_to_iomem ( iomemaddr , ( void * ) & temp_fftX [ 0 ] , length / 3 ) ; resetArrayIndex ( ) ; }
Performs fft of all 3 components.
Performs fft of all 3 components .
//dataoffset = offset; //Perform FFT of sensor data //variable for twiddle factors //fft //TRACE("X-component DMA:\n\r"); //iomemaddr += (length / 3) / 2; //fft //TRACE("Y-component DMA:\n\r"); //iomemaddr += (length / 3) / 2; //fft //TRACE("Z-component DMA:\n\r");