有关问题在程序后面的注释中,请大神解释详细点哦,本人小白一枚
//############################# SPI_XMIT_BYTE ################################
Uint16 spi_Rmit_byte()
while (!MCBSP_xrdy(mhMcbsp)) {};
MCBSP_write16(mhMcbsp,0xFFFF); //这个写地址该怎么确定????
while (!MCBSP_rrdy(mhMcbsp)) {}
/* Read sample from and write back to handset codec */
return (MCBSP_read16(mhMcbsp)<<8); //这个左移和下面的右移作用是什么?????
}
Uint16 spi_xmit_byte(Uint16 byte)
{
while (!MCBSP_xrdy(mhMcbsp)) {};
MCBSP_write16(mhMcbsp,byte>>8);
while (!MCBSP_rrdy(mhMcbsp)) {};
/* Read sample from and write back to handset codec */
return (MCBSP_read16(mhMcbsp)<<8); //为什么在发数据的时候还要读回????
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
CSL库中只定义了各参数的格式类型,没有更具体的介绍了,函数声明如下
/*----------------------------------------------------------------------------*/
IDEF Uint32 MCBSP_read(MCBSP_Handle hMcbsp) {
return (*(volatile Uint32 *)(hMcbsp->drrAddr));
}
/*----------------------------------------------------------------------------*/
IDEF void MCBSP_write(MCBSP_Handle hMcbsp, Uint32 val) {
(*(volatile Uint32 *)(hMcbsp->dxrAddr)) = val;
}
/*----------------------------------------------------------------------------*/
IDEF Uint32 MCBSP_xrdy(MCBSP_Handle hMcbsp) {
return MCBSP_FGETH(hMcbsp,SPCR,XRDY);
}
/*----------------------------------------------------------------------------*/
IDEF Uint32 MCBSP_rrdy(MCBSP_Handle hMcbsp) {
return MCBSP_FGETH(hMcbsp,SPCR,RRDY);
}
一周热门 更多>