read_flash.c
来自「ADI 公司的DSP ADSP21262 EZ-KIT LITE开发板的全部源代」· C语言 代码 · 共 51 行
C
51 行
#include "Sample Playback.h"
//This subroutine reads one 16-bit audio sample from FLASH using
//core accesses of the PP. It fetches this sample from a byte address
//that is passed in as the argument bAddr.
void read_flash_samples (void)
{
Csample* P2Sample;
int temp;
P2Sample = FirstSample;
while(P2Sample){
//configure general PP settings
(*pPPCTL) = PPBHC|PPDUR20;
(*pEIPP) = P2Sample->CurrentAddr; //External Index
(*pEMPP) = 1; //External Modify
//and then or in bit's to initiate DMA
(*pPPCTL) |= (PPEN);
// (with PPEN = 1 and PPDEN =0 core read's of the RXPP buffer cause
// the PP to fetch 32bits of data based on EIPP and EMPP.)
//----CONDITION SAMPLE -----------------------
// PP fetches 32bits, but only 16 msb's of data are valid (signed integer).
// To convert to float, shift it right by 16 (first cast to int to maintain sign bit)
//P2Sample->CurrentVal = (float)( (int)(*pRXPP) >> 16 );
// To be clear for this example, above instr. is equivalent
// to these:
#if 1
temp = (*pRXPP); //fetch sample
temp = temp >> 16; //shift to lsb's
P2Sample->CurrentVal = (float)temp; //convert in to float
#endif
P2Sample=P2Sample->Next;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?