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.

Re: Using MIC_IN as input source on PSP audio sample with OMAP-L137 EVM

Hi,

Related to this question,,

I think for controling aic31, we can use SIO_Ctrl() ,,,but it does't work.

I write

 int p;
 p = ICodec_InputDest_MICIN;
stat = SIO_ctrl(inStream, Aic31_AC_IOCTL_SELECT_INPUT_SOURCE, (Arg)&p);

 

What's wrong?

  • Hi Yass,

    Did you solve your problem? I am trying to change AIC3106 settings using SIO_ctrl() within the audioSample example. My calls to SIO_ctrl() do not appear to be successful - the function is

    returning non-zero values, typically 0x06, which would appear to indicate that the call has been unsuccessful.

    For example, I tried

    int status;

    status = SIO_ctrl(inStream, Aic31_AC_IOCTL_MUTE_ON, NULL);

     

    Regards,

    Donald

  • Hi Donald,

    For sending a request to the Codec from audio sample, the application has to use the following code

    Audio_IoctlParam    ioctlPrm;

    ioctlPrm. aiModule = Audio_ModuleSel_AUDIO_CODEC;   /* select the device to be controlled (codec) */
    ioctlPrm. codecId = 0;   /* codec id(only one codec is present) */
    ioctlPrm.ioctlArg = 0;   /* No argument required for mute ON command (specify the argument if any here)  */

    status = SIO_ctrl(inStream, Aic31_AC_IOCTL_MUTE_ON, &ioctlPrm);

    Please let me know if it works.

  • Hi Mariana,

    Thanks for your reply. In order to get your solution to work I had to change the line

    status = SIO_ctrl(inStream, Aic31_AC_IOCTL_MUTE_ON, &ioctlPrm);

    to

    status = SIO_ctrl(inStream, Aic31_AC_IOCTL_MUTE_ON, (Arg)&ioctlPrm);

    Otherwise I got the compiler error message

    argument of type "Ptr" is incompatible with parameter of type "Arg"

    I have been reading the document OMAPL137 BIOS PSP User Guide 01.30.00.05 and am a bit confused about

    the distinction between using the audio driver through SIO APIs (section 10) and using the aic31 driver through

    SIO APIs (section 11).

    Your solution appears (possibly?) to do the former but using an aic31 control command.

    What I really want to do is use the control command Aic31_AC_IOCTL_REG_WRITE. Could you give me an example

    of how to do that? e.g. to write 0xF5 into page 0 register 12 in the AIC3106.

     

    Regards,

     

    Donald

  • Donald,

    To do that you need to pass an argument in the:

    ioctlPrm.ioctlArg = 0;

    The type os the ioctlArg is Ptr.

    The argument would need to be a pointer to the type ICodec_RegData as described in the file:

    C:\Program Files\Texas Instruments\pspdrivers_01_30_00_05\packages\ti\pspiom\platforms\codec\ICodec.h

    typedef struct ICodec_RegData {
        Uint32  regIndex;       /**< Starting index and codec register            */
        Ptr     regData;        /**< Register data written/read                   */
        Uint32  regCount;       /**< Number of registers written/read             */
    }ICodec_RegData;

     

    ICodec_RegData  mydata;

    mydata.regIndex = xxx;

    mydata.redData = xxx;

    ...

    ioctlPrm. aiModule = Audio_ModuleSel_AUDIO_CODEC; 

    ioctlPrm. codecId = 0;  

    ioctlPrm.ioctlArg = (Ptr)mydata;

    status = SIO_ctrl(inStream, Aic31_AC_IOCTL_REG_WRITE, (Arg)&ioctlPrm);

     

    You can take a look at the file:

    C:\Program Files\Texas Instruments\pspdrivers_01_30_00_05\packages\ti\pspiom\platforms\codec\aic31_src\Aic31.c

  • Hi Mariana,

    Thanks again for your help, but I am still struggling.

    In your example, I think it should be

    ioctlPrm.ioctlArg = (Ptr)&mydata;

    and

    mydata.regData = (Ptr)&xxx;

    and also, surely

    mydata.regCount = 1;

    I'm now getting status equal to 0 after calling SIO_ctrl() (indicating successful operation?) but I'm not

    seeing the effect on the AIC3106 that I expect - which suggests that I haven't written to a register

    as intended.

    I now see that some of my earlier confusion was caused by reading section 11.6.2 of the BIOS

    User Guide version 01.20.00  :( which has changed in version 01.30.00.05.

    I have been looking at aic31.c and have successfully modified that to get the effect that I want (by

    adding a call to aic31RegWrite() from aic31InitAdc()) However, that is presumably not the way the psp

    is supposed to be used. Presumably also, you can't call aic31RegWrite() from audioSample_io.c.

    Regards,

     

    Donald

  • Hi Mariana,

    The code changes I've made to file audioSample_io.c are

    .
    .
    .

    Audio_IoctlParam ioctlPrm;
    ICodec_RegData mydata;

    int donald_status;
    Uint32 donald_reg_data;

    .
    .
    .

    /* Call prime function to do priming */
    prime();

    // these commented-out lines were successful in muting the codec

    // ioctlPrm.aiModule = Audio_ModuleSel_AUDIO_CODEC;
    // ioctlPrm.codecId = 0;
    // ioctlPrm.ioctlArg = 0;

    // donald_status = SIO_ctrl(inStream, Aic31_AC_IOCTL_MUTE_ON, (Arg)&ioctlPrm);

    // the following lines are apparently unsuccessful in muting the DACs
    // by writing to registers 43 and 44, although SIO_ctrl() does return zero

    donald_reg_data = 0x80;

    mydata.regIndex = (Uint32)43;
    mydata.regData = (Ptr)&donald_reg_data;
    mydata.regCount = 1;

    ioctlPrm.aiModule = Audio_ModuleSel_AUDIO_CODEC;
    ioctlPrm.codecId = 0;
    ioctlPrm.ioctlArg = (Ptr)&mydata;

    donald_status = SIO_ctrl(outStream, Aic31_AC_IOCTL_REG_WRITE, (Arg)&ioctlPrm);

    mydata.regIndex = (Uint32)44;

    donald_status = SIO_ctrl(outStream, Aic31_AC_IOCTL_REG_WRITE, (Arg)&ioctlPrm);

    .
    .
    .

    /* Forever loop to continously receviec and transmit audio data */
    for (i32Count = 0; i32Count >= 0; i32Count++)
        {

    .
    .
    .

    but, as noted in the comments, I can't seem to get Aic31_AC_IOCTL_REG_WRITE to work.

     

    Regards,

     

    Donald

  • Hi Donald,

    This seems to be a big (I will give feedback to the PSP team). You will need to edit the driver code to correct it.

    1) Open the correct project:

    If you are using the AudioSample.pjt insise the evm6747 folder, please open the project

    C:\Program Files\Texas Instruments\pspdrivers_01_30_00_05\packages\ti\pspiom\platforms\evm6747\audio\build\audio.pjt

    If you are using the AudioSample.pjt insise the evmOMAPL137 folder, please open the project

    C:\Program Files\Texas Instruments\pspdrivers_01_30_00_05\packages\ti\pspiom\platforms\evmOMAPL137 \audio\build\audio.pjt

    2) Edit the Audio.c file within this project:

    replace (line 663):

    (Ptr)&cmdArg->ioctlArg);

    with:

    (Ptr)cmdArg->ioctlArg);

    3) Recompile the audio.pjt

    4) Rebuild all the project audioSample.pjt

    let me know if it works.

     

  • Thanks Mariana,

    That seems to have fixed it.

    Regards,

    Donald