McBSP初始化函数

来源:互联网 发布:2015年电影 推荐 知乎 编辑:程序博客网 时间:2024/05/22 06:29

#include <csl_mcbsp.h>       //header included

 

 

MCBSP_Handle hMcbsp;       //定义一个MCBSP的句柄

 

/***********************************************************************/
/*    函数声明:    MCBSP初始化                                                                                              */
/***********************************************************************/
void McBSP_int()
{

    
  /* Let's open up serial port 0 */
    hMcbsp = MCBSP_open(MCBSP_DEV1, MCBSP_OPEN_RESET);
                                               /*Before a McBSP port can be used, it must first be opened by this function.
                                                The return value is a unique device handle that you use in subsequent McBSP API calls
                                               MCBSP_Handle MCBSP_open(
                                                int devNum,//McBSP device (port) number:
                                                                    MCBSP_DEV0
                                                                    MCBSP_DEV1
                                                 Uint32 flags//MCBSP_OPEN_RESET
                                               );*/
 
    MCBSP_config(hMcbsp,&ConfigLoopback);

/*Sets up the McBSP port using the configuration structure.


void MCBSP_config(
MCBSP_Handle hMcbsp,
MCBSP_Config *Config
);

*/


  /* Now that the port is setup, let's enable it in steps. */
    MCBSP_start(hMcbsp,MCBSP_RCV_START | MCBSP_XMIT_START |
                        MCBSP_SRGR_START| MCBSP_SRGR_FRAMESYNC,
                 MCBSP_SRGR_DEFAULT_DELAY);

/*Use this function to start a transmit and/or receive operation for a McBSP port
by passing the handle and mask.

void MCBSP_start(
MCBSP_Handle hMcbsp,    // handle
Uint32 startMask,             //using macros instead ,pull some part out of rst ,enable these part

                                         // MCBSP_XMIT_START: start transmit (XRST)
                                          //   MCBSP_RCV_START: start receive (RRST)
                                           //  MCBSP_SRGR_START: start Sample rate
                                            //generator (GRST)
                                            // MCBSP_SRGR_FRAMESYNC: Start frame   //spi doesn't need
sync. Generation (FRST)

Uint32 SampleRateGenDelay//sys requirments
);*/
}

原创粉丝点击