本文整理汇总了C++中DmaManager::dereference方法的典型用法代码示例。如果您正苦于以下问题:C++ DmaManager::dereference方法的具体用法?C++ DmaManager::dereference怎么用?C++ DmaManager::dereference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DmaManager
的用法示例。
在下文中一共展示了DmaManager::dereference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtest
int runtest(int argc, const char ** argv)
{
int test_result = 0;
int srcAlloc;
unsigned int *srcBuffer = 0;
fprintf(stderr, "Main::%s %s\n", __DATE__, __TIME__);
MemreadRequestProxy *device = new MemreadRequestProxy(IfcNames_MemreadRequestS2H);
MemreadIndication deviceIndication(IfcNames_MemreadIndicationH2S);
DmaManager *dma = platformInit();
fprintf(stderr, "Main::allocating memory...\n");
srcAlloc = portalAlloc(alloc_sz, 0);
srcBuffer = (unsigned int *)portalMmap(srcAlloc, alloc_sz);
#ifdef FPGA0_CLOCK_FREQ
long req_freq = FPGA0_CLOCK_FREQ;
long freq = 0;
setClockFrequency(0, req_freq, &freq);
fprintf(stderr, "Requested FCLK[0]=%ld actually %ld\n", req_freq, freq);
#endif
for (int i = 0; i < numWords; i++){
srcBuffer[i] = i;
}
portalCacheFlush(srcAlloc, srcBuffer, alloc_sz, 1);
fprintf(stderr, "Main::flush and invalidate complete\n");
unsigned int ref_srcAlloc = dma->reference(srcAlloc);
fprintf(stderr, "ref_srcAlloc=%d\n", ref_srcAlloc);
if(true) {
fprintf(stderr, "Main::test read %08x\n", numWords);
// first attempt should get the right answer
device->startRead(ref_srcAlloc, 0, numWords, burstLen);
sem_wait(&test_sem);
if (mismatchCount) {
fprintf(stderr, "Main::first test failed to match %d.\n", mismatchCount);
test_result++; // failed
}
}
int err = 5;
switch (err){
case 0:
{
fprintf(stderr, "Main: attempt to use a de-referenced sglist\n");
dma->dereference(ref_srcAlloc);
device->startRead(ref_srcAlloc, 0, numWords, burstLen);
break;
}
case 1:
{
fprintf(stderr, "Main: attempt to use an out-of-range sglist\n");
device->startRead(ref_srcAlloc+32, 0, numWords, burstLen);
break;
}
case 2:
{
fprintf(stderr, "Main: attempt to use an invalid sglist\n");
device->startRead(ref_srcAlloc+1, 0, numWords, burstLen);
break;
}
case 3:
{
fprintf(stderr, "Main: attempt to use an invalid mmusel\n");
device->startRead(ref_srcAlloc | (1<<16), 0, numWords, burstLen);
break;
}
case 4:
{
fprintf(stderr, "Main: attempt to read off the end of the region\n");
device->startRead(ref_srcAlloc, numWords<<2, burstLen, burstLen);
break;
}
default:
{
device->startRead(ref_srcAlloc, 0, numWords, burstLen);
}
}
sem_wait(&test_sem);
if (mismatchCount) {
fprintf(stderr, "Main::first test failed to match %d.\n", mismatchCount);
test_result++; // failed
}
return test_result;
}