C6416的McBSP配置如下
void init_mcbsp(MCBSP_Handle handle)[ Uint32 spcr, rcr, xcr, srgr, mcr, pcr; Uint32 rcere0, rcere1, rcere2, rcere3; Uint32 xcere0, xcere1, xcere2, xcere3; /* SPI mode, CLKSTP = 11b and CLKXP = 0: Clock starts with rising edge with delay. */ spcr = MCBSP_SPCR_RMK( MCBSP_SPCR_FREE_DEFAULT, MCBSP_SPCR_SOFT_DEFAULT, MCBSP_SPCR_FRST_DEFAULT, MCBSP_SPCR_GRST_DEFAULT, MCBSP_SPCR_XINTM_DEFAULT, MCBSP_SPCR_XSYNCERR_DEFAULT, MCBSP_SPCR_XRST_DEFAULT, MCBSP_SPCR_DLB_DEFAULT, MCBSP_SPCR_RJUST_DEFAULT, MCBSP_SPCR_CLKSTP_DELAY, /* CLKSTP = 11b */ MCBSP_SPCR_DXENA_OFF, MCBSP_SPCR_RINTM_DEFAULT, MCBSP_SPCR_RSYNCERR_DEFAULT, MCBSP_SPCR_RRST_DEFAULT ); rcr = MCBSP_RCR_RMK( MCBSP_RCR_RPHASE_SINGLE, MCBSP_RCR_RFRLEN2_DEFAULT, MCBSP_RCR_RWDLEN2_DEFAULT, MCBSP_RCR_RCOMPAND_DEFAULT, MCBSP_RCR_RFIG_NO, MCBSP_RCR_RDATDLY_1BIT, /* 1 - (Master) */ MCBSP_RCR_RFRLEN1_DEFAULT, MCBSP_RCR_RWDLEN1_32BIT, MCBSP_RCR_RWDREVRS_DISABLE ); xcr = MCBSP_XCR_RMK( MCBSP_XCR_XPHASE_DEFAULT, MCBSP_XCR_XFRLEN2_DEFAULT, MCBSP_XCR_XWDLEN2_DEFAULT, MCBSP_XCR_XCOMPAND_DEFAULT, MCBSP_XCR_XFIG_DEFAULT, MCBSP_XCR_XDATDLY_1BIT, /* 1 - (Master) */ MCBSP_XCR_XFRLEN1_DEFAULT, MCBSP_XCR_XWDLEN1_32BIT, MCBSP_XCR_XWDREVRS_DISABLE ); srgr = MCBSP_SRGR_RMK( MCBSP_SRGR_GSYNC_FREE, MCBSP_SRGR_CLKSP_RISING, MCBSP_SRGR_CLKSM_INTERNAL, /* SRGR clock mode from internal source */ MCBSP_SRGR_FSGM_DEFAULT, MCBSP_SRGR_FPER_DEFAULT, MCBSP_SRGR_FWID_DEFAULT, MCBSP_SRGR_CLKGDV_OF(0) /* C64X: CLKG = CPU/4 / (CLKGDV+1) */ ); mcr = MCBSP_MCR_DEFAULT; rcere0 = MCBSP_RCERE0_RMK(0); rcere1 = MCBSP_RCERE1_RMK(0); rcere2 = MCBSP_RCERE2_RMK(0); rcere3 = MCBSP_RCERE3_RMK(0); xcere0 = MCBSP_XCERE0_RMK(0); xcere1 = MCBSP_XCERE1_RMK(0); xcere2 = MCBSP_XCERE2_RMK(0); xcere3 = MCBSP_XCERE3_RMK(0); pcr = MCBSP_PCR_RMK( MCBSP_PCR_XIOEN_SP, MCBSP_PCR_RIOEN_SP, MCBSP_PCR_FSXM_INTERNAL, /* SS output (Master) */ MCBSP_PCR_FSRM_EXTERNAL, MCBSP_PCR_CLKXM_OUTPUT, /* TX CLK output (Master) */ MCBSP_PCR_CLKRM_INPUT, MCBSP_PCR_CLKSSTAT_0, MCBSP_PCR_DXSTAT_0, MCBSP_PCR_FSXP_ACTIVELOW, /* SS polarity: Valid when SS goes low */ MCBSP_PCR_FSRP_ACTIVELOW, MCBSP_PCR_CLKXP_RISING, /* TX CLK polarity: Sampling at rising edge of clock */ MCBSP_PCR_CLKRP_FALLING ); MCBSP_configArgs(handle, spcr, rcr, xcr, srgr, mcr, rcere0, rcere1, rcere2, rcere3, xcere0, xcere1, xcere2, xcere3, pcr); return;]
C6416的McBSP配置如下
void init_mcbsp(MCBSP_Handle handle)[ Uint32 spcr, rcr, xcr, srgr, mcr, pcr; Uint32 rcere0, rcere1, rcere2, rcere3; Uint32 xcere0, xcere1, xcere2, xcere3; /* SPI mode, CLKSTP = 11b and CLKXP = 0: Clock starts with rising edge with delay. */ spcr = MCBSP_SPCR_RMK( MCBSP_SPCR_FREE_DEFAULT, MCBSP_SPCR_SOFT_DEFAULT, MCBSP_SPCR_FRST_DEFAULT, MCBSP_SPCR_GRST_DEFAULT, MCBSP_SPCR_XINTM_DEFAULT, MCBSP_SPCR_XSYNCERR_DEFAULT, MCBSP_SPCR_XRST_DEFAULT, MCBSP_SPCR_DLB_DEFAULT, MCBSP_SPCR_RJUST_DEFAULT, MCBSP_SPCR_CLKSTP_DELAY, /* CLKSTP = 11b */ MCBSP_SPCR_DXENA_OFF, MCBSP_SPCR_RINTM_DEFAULT, MCBSP_SPCR_RSYNCERR_DEFAULT, MCBSP_SPCR_RRST_DEFAULT ); rcr = MCBSP_RCR_RMK( MCBSP_RCR_RPHASE_SINGLE, MCBSP_RCR_RFRLEN2_DEFAULT, MCBSP_RCR_RWDLEN2_DEFAULT, MCBSP_RCR_RCOMPAND_DEFAULT, MCBSP_RCR_RFIG_NO, MCBSP_RCR_RDATDLY_1BIT, /* 1 - (Master) */ MCBSP_RCR_RFRLEN1_DEFAULT, MCBSP_RCR_RWDLEN1_32BIT, MCBSP_RCR_RWDREVRS_DISABLE ); xcr = MCBSP_XCR_RMK( MCBSP_XCR_XPHASE_DEFAULT, MCBSP_XCR_XFRLEN2_DEFAULT, MCBSP_XCR_XWDLEN2_DEFAULT, MCBSP_XCR_XCOMPAND_DEFAULT, MCBSP_XCR_XFIG_DEFAULT, MCBSP_XCR_XDATDLY_1BIT, /* 1 - (Master) */ MCBSP_XCR_XFRLEN1_DEFAULT, MCBSP_XCR_XWDLEN1_32BIT, MCBSP_XCR_XWDREVRS_DISABLE ); srgr = MCBSP_SRGR_RMK( MCBSP_SRGR_GSYNC_FREE, MCBSP_SRGR_CLKSP_RISING, MCBSP_SRGR_CLKSM_INTERNAL, /* SRGR clock mode from internal source */ MCBSP_SRGR_FSGM_DEFAULT, MCBSP_SRGR_FPER_DEFAULT, MCBSP_SRGR_FWID_DEFAULT, MCBSP_SRGR_CLKGDV_OF(0) /* C64X: CLKG = CPU/4 / (CLKGDV+1) */ ); mcr = MCBSP_MCR_DEFAULT; rcere0 = MCBSP_RCERE0_RMK(0); rcere1 = MCBSP_RCERE1_RMK(0); rcere2 = MCBSP_RCERE2_RMK(0); rcere3 = MCBSP_RCERE3_RMK(0); xcere0 = MCBSP_XCERE0_RMK(0); xcere1 = MCBSP_XCERE1_RMK(0); xcere2 = MCBSP_XCERE2_RMK(0); xcere3 = MCBSP_XCERE3_RMK(0); pcr = MCBSP_PCR_RMK( MCBSP_PCR_XIOEN_SP, MCBSP_PCR_RIOEN_SP, MCBSP_PCR_FSXM_INTERNAL, /* SS output (Master) */ MCBSP_PCR_FSRM_EXTERNAL, MCBSP_PCR_CLKXM_OUTPUT, /* TX CLK output (Master) */ MCBSP_PCR_CLKRM_INPUT, MCBSP_PCR_CLKSSTAT_0, MCBSP_PCR_DXSTAT_0, MCBSP_PCR_FSXP_ACTIVELOW, /* SS polarity: Valid when SS goes low */ MCBSP_PCR_FSRP_ACTIVELOW, MCBSP_PCR_CLKXP_RISING, /* TX CLK polarity: Sampling at rising edge of clock */ MCBSP_PCR_CLKRP_FALLING ); MCBSP_configArgs(handle, spcr, rcr, xcr, srgr, mcr, rcere0, rcere1, rcere2, rcere3, xcere0, xcere1, xcere2, xcere3, pcr); return;]
举报