本文整理汇总了C++中DmaManager::dCacheFlushInval方法的典型用法代码示例。如果您正苦于以下问题:C++ DmaManager::dCacheFlushInval方法的具体用法?C++ DmaManager::dCacheFlushInval怎么用?C++ DmaManager::dCacheFlushInval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DmaManager
的用法示例。
在下文中一共展示了DmaManager::dCacheFlushInval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char **argv)
{
MaxcommonsubseqRequestProxy *device = 0;
DmaConfigProxy *dmap = 0;
MaxcommonsubseqIndication *deviceIndication = 0;
DmaIndication *dmaIndication = 0;
fprintf(stderr, "%s %s\n", __DATE__, __TIME__);
device = new MaxcommonsubseqRequestProxy(IfcNames_MaxcommonsubseqRequest);
dmap = new DmaConfigProxy(IfcNames_DmaConfig);
DmaManager *dma = new DmaManager(dmap);
deviceIndication = new MaxcommonsubseqIndication(IfcNames_MaxcommonsubseqIndication);
dmaIndication = new DmaIndication(dma, IfcNames_DmaIndication);
if(sem_init(&test_sem, 1, 0)){
fprintf(stderr, "failed to init test_sem\n");
return -1;
}
pthread_t tid;
fprintf(stderr, "creating exec thread\n");
if(pthread_create(&tid, NULL, portalExec, NULL)){
fprintf(stderr, "error creating exec thread\n");
exit(1);
}
fprintf(stderr, "simple tests\n");
PortalAlloc *strAAlloc;
PortalAlloc *strBAlloc;
PortalAlloc *fetchAlloc;
unsigned int alloc_len = 128;
unsigned int fetch_len = alloc_len * alloc_len;
int rcA, rcB, rcFetch;
struct stat statAbuf, statBbuf, statFetchbuf;
dma->alloc(fetch_len*sizeof(uint16_t), &fetchAlloc);
rcFetch = fstat(fetchAlloc->header.fd, &statFetchbuf);
if (rcA < 0) perror("fstatFetch");
int *fetch = (int *)mmap(0, fetch_len * sizeof(uint16_t), PROT_READ|PROT_WRITE, MAP_SHARED, fetchAlloc->header.fd, 0);
if (fetch == MAP_FAILED) perror("fetch mmap failed");
assert(fetch != MAP_FAILED);
dma->alloc(alloc_len, &strAAlloc);
rcA = fstat(strAAlloc->header.fd, &statAbuf);
if (rcA < 0) perror("fstatA");
char *strA = (char *)mmap(0, alloc_len, PROT_READ|PROT_WRITE, MAP_SHARED, strAAlloc->header.fd, 0);
if (strA == MAP_FAILED) perror("strA mmap failed");
assert(strA != MAP_FAILED);
dma->alloc(alloc_len, &strBAlloc);
rcB = fstat(strBAlloc->header.fd, &statBbuf);
if (rcA < 0) perror("fstatB");
char *strB = (char *)mmap(0, alloc_len, PROT_READ|PROT_WRITE, MAP_SHARED, strBAlloc->header.fd, 0);
if (strB == MAP_FAILED) perror("strB mmap failed");
assert(strB != MAP_FAILED);
/*
const char *strA_text = "___a_____b______c____";
const char *strB_text = "..a........b.c....";
*/
const char *strA_text = "012a45678b012345c7890";
const char *strB_text = "ABaDEFGHIJKbMcOPQR";
assert(strlen(strA_text) < alloc_len);
assert(strlen(strB_text) < alloc_len);
strncpy(strA, strA_text, alloc_len);
strncpy(strB, strB_text, alloc_len);
int strA_len = strlen(strA);
int strB_len = strlen(strB);
uint16_t swFetch[fetch_len];
init_timer();
start_timer(0);
fprintf(stderr, "elapsed time (hw cycles): %zd\n", lap_timer(0));
dma->dCacheFlushInval(strAAlloc, strA);
dma->dCacheFlushInval(strBAlloc, strB);
dma->dCacheFlushInval(fetchAlloc, fetch);
unsigned int ref_strAAlloc = dma->reference(strAAlloc);
unsigned int ref_strBAlloc = dma->reference(strBAlloc);
unsigned int ref_fetchAlloc = dma->reference(fetchAlloc);
device->setupA(ref_strAAlloc, 0, strA_len);
sem_wait(&test_sem);
device->setupB(ref_strBAlloc, 0, strB_len);
sem_wait(&test_sem);
uint64_t cycles;
uint64_t beats;
fprintf(stderr, "starting algorithm A\n");
//.........这里部分代码省略.........