Platform/ECM3532/DSP/hw/csp/ecm3532/src/eta_csp_pdm.c
/***************************************************************************/
/**
 *
 *  Initialize the PDM module.
 *
 *  @param sPdmConfig is a union. To access the field: enable, for example,
 *  use sPdmConfig.fields.enable.
 *
 *  This function initializes the PDM. It configures and/or enables it.
 *  User may do both in a single call or in 2 seperate calls.
 *
 *  @return Returns the configuration status. ePdmConfigGood if no errors.
 *
 ******************************************************************************/
Initialize the PDM module.
@param sPdmConfig is a union. To access the field: enable, for example,
use sPdmConfig.fields.enable.

This function initializes the PDM. It configures and/or enables it.
User may do both in a single call or in 2 seperate calls.

@return Returns the configuration status. ePdmConfigGood if no errors.
Initialize the PDM module . @param sPdmConfig is a union . To access the field : enable for example use sPdmConfig . fields . enable . This function initializes the PDM . It configures and / or enables it . User may do both in a single call or in 2 seperate calls . @return Returns the configuration status . ePdmConfigGood if no errors .
tPdmConfigRetVal
EtaCspPdmConfig(tPdmConfig sPdmConfig)
{
    uint32_t ui32TempData0;
    uint8_t ui8Instance;
    EtaCspMboxDsp2M3(MAILBOX_DSP2M3CMD_PDM_CFG, sPdmConfig.packed_config);
    if(sPdmConfig.fields.enable && (sPdmConfig.fields.port_select == ePdmPort0))
    {
        ui8Instance = 0;
    }
    else if(sPdmConfig.fields.enable &&
            (sPdmConfig.fields.port_select == ePdmPort0Alt))
    {
        ui8Instance = 0;
    }
    else if(sPdmConfig.fields.enable &&
            (sPdmConfig.fields.port_select == ePdmPort1))
    {
        ui8Instance = 1;
    }
    else
    {
        return(ePdmConfigInvalidConfig);
    }
    ui32TempData0 = REG_PDM_DSP_CSR(ui8Instance);
    ui32TempData0 &= ~(BM_PDM_DSP_CSR_RX_CH_MODE        |
                   BM_PDM_DSP_CSR_SRSRDY_EDGE_TRIG  |
                   BM_PDM_DSP_CSR_SWAP_RD_CHNL      |
                   BM_PDM_DSP_CSR_PDM_EN);
    ui32TempData0 |=
        (sPdmConfig.fields.chan_config << BP_PDM_DSP_CSR_RX_CH_MODE)       |
        (sPdmConfig.fields.swap_chan <<
            BP_PDM_DSP_CSR_SWAP_RD_CHNL)     |
        (sPdmConfig.fields.edge_trig <<
            BP_PDM_DSP_CSR_SRSRDY_EDGE_TRIG);
    REG_PDM_DSP_CSR(ui8Instance) = ui32TempData0;
    REG_PDM_DSP_CSR(ui8Instance) = ui32TempData0 |
                                (sPdmConfig.fields.enable <<
    BP_PDM_DSP_CSR_PDM_EN);
    return(ePdmConfigGood);
}
tPdmConfigRetVal EtaCspPdmConfig ( tPdmConfig sPdmConfig ) { uint32_t ui32TempData0 ; uint8_t ui8Instance ; EtaCspMboxDsp2M3 ( MAILBOX_DSP2M3CMD_PDM_CFG , sPdmConfig . packed_config ) ; if ( sPdmConfig . fields . enable && ( sPdmConfig . fields . port_select == ePdmPort0 ) ) { ui8Instance = 0 ; } else if ( sPdmConfig . fields . enable && ( sPdmConfig . fields . port_select == ePdmPort0Alt ) ) { ui8Instance = 0 ; } else if ( sPdmConfig . fields . enable && ( sPdmConfig . fields . port_select == ePdmPort1 ) ) { ui8Instance = 1 ; } else { return ( ePdmConfigInvalidConfig ) ; } ui32TempData0 = REG_PDM_DSP_CSR ( ui8Instance ) ; ui32TempData0 &= ~ ( BM_PDM_DSP_CSR_RX_CH_MODE | BM_PDM_DSP_CSR_SRSRDY_EDGE_TRIG | BM_PDM_DSP_CSR_SWAP_RD_CHNL | BM_PDM_DSP_CSR_PDM_EN ) ; ui32TempData0 |= ( sPdmConfig . fields . chan_config << BP_PDM_DSP_CSR_RX_CH_MODE ) | ( sPdmConfig . fields . swap_chan << BP_PDM_DSP_CSR_SWAP_RD_CHNL ) | ( sPdmConfig . fields . edge_trig << BP_PDM_DSP_CSR_SRSRDY_EDGE_TRIG ) ; REG_PDM_DSP_CSR ( ui8Instance ) = ui32TempData0 ; REG_PDM_DSP_CSR ( ui8Instance ) = ui32TempData0 | ( sPdmConfig . fields . enable << BP_PDM_DSP_CSR_PDM_EN ) ; return ( ePdmConfigGood ) ; }
Initialize the PDM module.
Initialize the PDM module .
// Tell M3 To Enable / Config PDM /////////////////////////////////////////////// // Determine PDM Instance // Determine PDM Instance /////////////////////////////////////////////// /////////////////////////////////////////////// // Configure Actual PDM // Set Enable after the rest of configurtion is in place. // Configure Actual PDM ///////////////////////////////////////////////