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.

Declaration is incompatible with previous "WriteSample"

Other Parts Discussed in Thread: TMS320C6748

Hi,

 

I tried some codes from website of Univ. of Texas, which relates to generate sine wave with TMS320C6748.

The codes are as follows:

********************************************************

float sine_val;

void isrAudio(void) {  

         .........................

         WriteSample(sine_val,sine_val);   

}

void WriteSample(float left,float right) {    

      int32_t ileft  = (int32_t) left;    

      int32_t iright = (int32_t)right;   

      int32_t dataOut32;

     dataOut32 = (iright << 16) | (ileft & 0x0000ffff);  

       while(!CHKBIT(MCASP->SRCTL11, XRDY)){}

       MCASP->XBUF11 = dataOut32; 

}

*********************************************************

After I built the project, an error comes out and says that "Declaration is incompatible with previous "WriteSample" ".

I don't know how to solve this problem.

Thanks in advance!

 

Best regards,

PP

  • Please declare prototype for WriteSample before invocation  else compiler will assume a prototype and when it encounters real fucntion defintion it will complain that declaration and definition mismatch. Modify your code as:

    float sine_val;

    /* Declare prototype for WriteSample */

    void WriteSample(float left,float right);

    void isrAudio(void) {  

             .........................

             WriteSample(sine_val,sine_val);   

    }

    void WriteSample(float left,float right) {    

          int32_t ileft  = (int32_t) left;    

          int32_t iright = (int32_t)right;   

          int32_t dataOut32;

         dataOut32 = (iright << 16) | (ileft & 0x0000ffff);  

           while(!CHKBIT(MCASP->SRCTL11, XRDY)){}

           MCASP->XBUF11 = dataOut32; 

    }