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.

question about the dsp.lib in my application(C6416)

If I inderstand correctly, some datas in the routines of the dsp.lib(c6416 I used) are defined in "const" type, while the data I want to compute is variable. How can I do in this case?

In details:I use the USB interface, store the data from USB host in SDRAM. and let the DSP compute the datas(number is 6400 each time). Each time, the 6400 datas is different from its last time. For example: get the maximum and minimum in the 6400 datas.

Hope get your suggestions

Best Regards

  • There should be no cases in which data in a library is typed as "const" when it is actually variable. If you have found a case of this, please post the specific function call and the specific data variable that would cause the problem.

    It is possible that the location of the "const" keyword in your investigation has made the data seem unusable but it may actually be useful to you exactly as it is. From the C Compiler User's Guide, there is the following:

    spru187o said:

    The placement of the const keyword within a definition is important. For example, the first statement below defines a constant pointer p to a variable int. The second statement defines a variable pointer q to a constant int:

    int * const p = &x;
    const int * q = &x;

    There is a very subtle difference between the two lines above, but in the first case the pointer is "const" and the data is variable, while in the second case the pointer is variable and the data is "const".

    spru187o said:

    int open (const char * path , unsigned flags , int file_descriptor );

    Also, the use of the "const" keyword in the argument list of a function call, like the one above, does not make the data array be fixed or constant. This use of "const char * path" forces the compiler to use the pointer path without changing any of the data to which the pointer "path" is pointing. This is very helpful for compiler optimizations and it makes it clear to you, the user of the function, that the data will not be modified by the "open" function.

    The data can still change in the array outside of functions like this. But it is very common to force the processing function to recognize the data as an input array that should not be modified by the processing function.

  • Hi RandyP:

         Thanks for your detailed explaination. You are right, my location of the "const" is wrong, and made the data unvariable.

    Best Regards