TI中文支持网
TI专业的中文技术问题搜集分享网站

用6748的MCASP传输4路音频该怎么设置。

static void McASPI2SConfigure(void)
{
    McASPRxReset(SOC_MCASP_0_CTRL_REGS);
    McASPTxReset(SOC_MCASP_0_CTRL_REGS);
    /* Enable the FIFOs for DMA transfer
     * 启用FIFO进行DMA传输*/
    McASPReadFifoEnable(SOC_MCASP_0_FIFO_REGS, 4, 1);
    McASPWriteFifoEnable(SOC_MCASP_0_FIFO_REGS, 4, 1);
    /* Set I2S format in the transmitter/receiver format units
     * 以收发格式为单位设定i2s格式,在发送器/接收器单元的格式设定I2S格式*/
    McASPRxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
                     MCASP_RX_MODE_DMA);
    McASPTxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
                     MCASP_TX_MODE_DMA);
    /* Configure the frame sync. I2S shall work in TDM format with 2 slots*/
    McASPRxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 8, MCASP_RX_FS_WIDTH_WORD,
                        MCASP_RX_FS_EXT_BEGIN_ON_FALL_EDGE);//帧同步的信号设置,外部,上升沿
    McASPTxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 8, MCASP_RX_FS_WIDTH_WORD,
    MCASP_TX_FS_INT_BEGIN_ON_FALL_EDGE);//帧同步的信号设置,内部,上升沿
    /* configure the clock for receiver*/
    McASPRxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL, 0, 0);//外部时钟
    McASPRxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_POL_RIS_EDGE);
    McASPRxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLKCHCK_DIV32,
                          0x00, 0xFF);
    /* configure the clock for transmitter
     * 
     */
    McASPTxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_MIXED, 11, 0);
    McASPTxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_POL_FALL_EDGE);
    McASPTxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLKCHCK_DIV32,
                          0x00, 0xFF);
    /* Enable synchronization of RX and TX sections
    //McASPTxRxClkSyncEnable(SOC_MCASP_0_CTRL_REGS);
    /* Enable the transmitter/receiver slots. I2S uses 2 slots
   */
    McASPRxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
    McASPTxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
    /*
    ** Set the serializers, Currently only one serializer is set as
    ** transmitter and one serializer as receiver.
    */
    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX1);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX1);
    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX2);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX2);
    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX3);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX3);
    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX4);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX4);
    /*
    ** Configure the McASP pins
    ** Input – Frame Sync, Clock and Serializer Rx
    ** Output – Serializer Tx is connected to the input of the codec
    */
    McASPPinMcASPSet(SOC_MCASP_0_CTRL_REGS, 0xFFFFFFFF);//设置McASP引脚用于McASP功能
    McASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AXR(MCASP_XSER_TX1)
    | MCASP_PIN_AFSX
    | MCASP_PIN_ACLKX);//将McASP引脚配置为输出引脚。
    McASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AXR(MCASP_XSER_TX2)
    | MCASP_PIN_AFSX
    | MCASP_PIN_ACLKX);
    McASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AXR(MCASP_XSER_TX3)
    | MCASP_PIN_AFSX
    | MCASP_PIN_ACLKX);
    McASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AXR(MCASP_XSER_TX4)
    | MCASP_PIN_AFSX
    | MCASP_PIN_ACLKX);
    McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSR
                                               | MCASP_PIN_ACLKR
                                               | MCASP_PIN_AXR(MCASP_XSER_RX1));
    McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSR
                                               | MCASP_PIN_ACLKR
                                               | MCASP_PIN_AXR(MCASP_XSER_RX2));
    McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSR
                                               | MCASP_PIN_ACLKR
                                               | MCASP_PIN_AXR(MCASP_XSER_RX3));
    McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSR
                                               | MCASP_PIN_ACLKR
                                               | MCASP_PIN_AXR(MCASP_XSER_RX4));
    /* Enable error interrupts for McASP 
    McASPTxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_TX_DMAERROR
                                            | MCASP_TX_CLKFAIL
                                            | MCASP_TX_SYNCERROR
                                            | MCASP_TX_UNDERRUN);
    McASPRxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_RX_DMAERROR
                                            | MCASP_RX_CLKFAIL
                                            | MCASP_RX_SYNCERROR
                                            | MCASP_RX_OVERRUN);
}
这样对不对。还有edma3怎么弄
Tony Tang:

user5324036
*/
    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX1);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX1);

    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX2);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX2);

    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX3);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX3);

    McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX4);
    McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX4);

    /*

这个对照下面的源码,是不是后一个把前一个覆盖了啊。MCASP_XSER_RX1, MCASP_XSER_TX1是在哪定义的?

/** * \brief Sets a serializer as transmitter * * \param baseAddr Base Address of the McASP Module Registers. * \param serNum Serializer which is to be used as Transmitter. * * \return None. * **/void McASPSerializerTxSet(unsigned int baseAddr, unsigned int serNum){ HWREG(baseAddr + MCASP_SRCTL(serNum)) &= ~MCASP_SRCTL0_SRMOD; HWREG(baseAddr + MCASP_SRCTL(serNum)) |= MCASP_SRCTL_SRMOD_TX; }

/** * \brief Sets a serializer as receiver * * \param baseAddr Base Address of the McASP Module Registers. * \param serNum Serializer which is to be used as Receiver. * * \return None. * **/void McASPSerializerRxSet(unsigned int baseAddr, unsigned int serNum){ HWREG(baseAddr + MCASP_SRCTL(serNum)) &= ~MCASP_SRCTL0_SRMOD; HWREG(baseAddr + MCASP_SRCTL(serNum)) |= MCASP_SRCTL_SRMOD_RX;

}

多通道的配置对于单通道来说,仅仅是使能多个数据线就好了。

关于EDMA的配置,参考下面截图的说明:

赞(0)
未经允许不得转载:TI中文支持网 » 用6748的MCASP传输4路音频该怎么设置。
分享到: 更多 (0)