This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320C6745: C674x DSPLIB, DSPF_sp_fftSPxSP C source

Part Number: TMS320C6745

Tool/software: TI C/C++ Compiler

Hi, 

In my audio application i have a main DSP task  (the system's highest priority task), which is McAsp interrupt driven every 16 audio frames @ 48khz. I specify that i don't use any OS.

I need to provide a lower priority task Y to compute the fft of a block of samples. This task must be at lower priority with respect to the main audio task but at higher priority than the background tasks. 

In the DSPLIB i see that the function DSPF_sp_fftSPxSP is not interruptible and does not have an optimized C source. So my question is: how can i perform fft in the task Y in a safe way and with a decently optimized code base?

Best regards. 

  • Part Number: TMS320C6745

    Hi,

    I am using TMS320C6745, DSPLIB_3_4_0_0

    i need to perform fft in a background task, but the DSPF_sp_fftSPxSP function is not interruptible and can not  be safely used in background in my application.

    DSPLIB wiki says that for each function there is an optimized C version which in this case should be DSPF_sp_fftSPxSP.c or DSPF_sp_fftSPxSP_opt.c but i can't find those files.

    Where can i find an optimized C version of DSPF_sp_fftSPxSP?

    Best regards.

  • We only provide natural C and assembly implementation of the DSPF_sp_fftSPxSP  in the DSPLIB. We do provide a optimized C version of the function in the C66x DSPLIB that you can use as reference and port it over to C674x:

    DSPF_sp_fftSPxSP_opt.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /* ======================================================================= */
    /* DSPF_sp_fftSPxSP_opt.c -- Forward FFT with Mixed Radix */
    /* Intrinsic C Implementation */
    /* */
    /* Rev 0.0.1 */
    /* */
    /* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ */
    /* */
    /* */
    /* Redistribution and use in source and binary forms, with or without */
    /* modification, are permitted provided that the following conditions */
    /* are met: */
    /* */
    /* Redistributions of source code must retain the above copyright */
    /* notice, this list of conditions and the following disclaimer. */
    /* */
    /* Redistributions in binary form must reproduce the above copyright */
    /* notice, this list of conditions and the following disclaimer in the */
    /* documentation and/or other materials provided with the */
    /* distribution. */
    /* */
    /* Neither the name of Texas Instruments Incorporated nor the names of */
    /* its contributors may be used to endorse or promote products derived */
    /* from this software without specific prior written permission. */
    /* */
    /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
    /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
    /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
    /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
    /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
    /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
    /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
    /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
    /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
    /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
    /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
    /* */
    /* ======================================================================= */
    #pragma CODE_SECTION(DSPF_sp_fftSPxSP_opt, ".text:Intrinsic");
    #include "DSPF_sp_fftSPxSP_opt.h"
    #ifdef __TI_COMPILER_VERSION__
    #include "c6x.h"
    #endif
    #ifdef _LITTLE_ENDIAN
    void DSPF_sp_fftSPxSP_opt (int N, float *ptr_x, float *ptr_w, float *ptr_y,
    unsigned char *brev, int n_min, int offset, int n_max)
    {
    int i, j, k, l1, l2, h2, predj, tw_offset, stride, fft_jmp, radix;
    float yt2, yt3, yt6, yt7;
    float xt1_0, yt2_0, xt1_1, yt2_1, xt2_0, yt1_0, xt2_1, yt1_1;
    float * restrict x, * restrict x2, * restrict w;
    float * restrict y0, * restrict y1, * restrict y2, * restrict y3;
    __float2_t xh21_0_xh20_0, xh21_1_xh20_1, xh1_0_xh0_0, xh1_1_xh0_1;
    __float2_t xl21_0_xl20_0, xl21_1_xl20_1, xl1_0_xl0_0, xl1_1_xl0_1;
    __float2_t yt0_0_xt0_0, yt0_1_xt0_1, yt1_0_xt1_0;
    __float2_t yt1_1_xt1_1, yt2_0_xt2_0, yt2_1_xt2_1;
    __float2_t x_1o_x_0o, xl1_1o_xl1_0o, x_3o_x_2o, xl1_3o_xl1_2o;
    __float2_t xh2_1o_xh2_0o, xl2_1o_xl2_0o, xh2_3o_xh2_2o, xl2_3o_xl2_2o;
    __float2_t x_l1_10, x_l1_32, x_l2_10, x_l2_32, x_h2_10, x_h2_32;
    __float2_t co10_si10, co20_si20, co30_si30, co11_si11, co21_si21, co31_si31;
    __float2_t x_10, x_32, x_54, x_76, yt_10, yt_32, yt_54, yt_76;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Thank you, clear answer.

    Just one clarification: if i well understood, if i use the assembly dspf_sp_fft (not interruptible) on a background task, it will take to unpredictable delays on incoming hardware isrs. Is this true or there is a hope that i can still use the assembly version? If this is true, is it possible to have a worst case estimate of the delay cycles?

    Best regards