|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2015-1-22 19:27:37
|
显示全部楼层
程序片段
/******************************************************
* Function: AD1955 Init
* Input: uint16_t bitsPerSample
* Output: void
* Detail: None
*****************************************************/
void SND_AD1955Init(uint16_t bitsPerSample)
{
uint8_t txbuf[2], rxbuf[2];
dspi_status_t status;
// Control Register 0
switch(bitsPerSample)
{
case 16:
txbuf[0]= 0x0C;
break;
case 18:
txbuf[0]= 0x08;
break;
case 20:
txbuf[0]= 0x04;
break;
case 24:
txbuf[0]= 0x00;
break;
default:
xprintf("AD1955\tbitsPerSample Error\n");
break;
}
txbuf[1]= 0x00;
do {
status= DSPI_DRV_MasterGetTransferStatus(FSL_SPICOM1, NULL);
} while(status == kStatus_DSPI_Busy);
if(kStatus_DSPI_Success != DSPI_DRV_MasterTransfer(FSL_SPICOM1, &AD_BusConfig0, txbuf, rxbuf, 2))
xprintf("AD1955\tDSPI Failed 2\n");
// Control Register 1
// txbuf[1]= 0x00;
// txbuf[0]= 0x01;
// do {
// status= DSPI_DRV_MasterGetTransferStatus(FSL_SPICOM1, NULL);
// } while(status == kStatus_DSPI_Busy);
// if(kStatus_DSPI_Success != DSPI_DRV_MasterTransfer(FSL_SPICOM1, &AD_BusConfig0, txbuf, rxbuf, 2))
// xprintf("AD1955\tDSPI Failed 2\n");
// Volume Register L
// txbuf[1]= 0x70;
// txbuf[0]= 0x02;
// do {
// status= DSPI_DRV_MasterGetTransferStatus(FSL_SPICOM1, NULL);
// } while(status == kStatus_DSPI_Busy);
// if(kStatus_DSPI_Success != DSPI_DRV_MasterTransfer(FSL_SPICOM1, &AD_BusConfig0, txbuf, rxbuf, 2))
// xprintf("AD1955\tDSPI Failed 2\n");
// Volume Register R
// txbuf[1]= 0x70;
// txbuf[0]= 0x03;
// do {
// status= DSPI_DRV_MasterGetTransferStatus(FSL_SPICOM1, NULL);
// } while(status == kStatus_DSPI_Busy);
// if(kStatus_DSPI_Success != DSPI_DRV_MasterTransfer(FSL_SPICOM1, &AD_BusConfig0, txbuf, rxbuf, 2))
// xprintf("AD1955\tDSPI Failed 2\n");
} |
|