c - How to map a PCIe area with VxWorks? -
this first post :) using vxworks 6.9 , intel sandy bridge board. know how map pcie memory area in application. pcie memory area part of graphic memory , it's physical address 0x80000000.
i’m trying vmmap function doesn’t return virtual address. in case, set virtual address same value physical address don’t know if it’s behavior. how can virtual address physical address? if no function exists, what’s virtual address have use?
when i’ve mapped area in application, i’m benching access area. i’m trying change cache state function vmstateset copyback, writethru , default can set (setting other cache values fail). i’ve got low throughput cache states. in intel sandybridge, possible set mmu write combining. how can in vxworks?
this have tried far:
int test_appli_pci (void) { struct timeval start, end; uint64_t time_us = 0; virt_addr buffer_virt_dest = addr_phys_graphic_pci; void* buffer_virt_src = null; int i; int j; uint state; uint states[] = {mmu_attr_cache_off, mmu_attr_cache_copyback, mmu_attr_cache_writethru, mmu_attr_cache_default, mmu_attr_cache_guarded, mmu_attr_cache_coherency}; /* mapping on physical address */ if(vmmap(null, addr_phys_graphic_pci, addr_phys_graphic_pci, mwtest_buffer_size) == error) { return -1; } /* allocate buffer */ buffer_virt_src = (uint8_t*)malloc(mwtest_buffer_size); /* bench depending on cache state */ for(i = 0; < nelements(states); i++) { if(vmstateset(null, addr_phys_graphic_pci, mwtest_buffer_size, mmu_attr_cache_msk, states[i]) == error) { printf("set state %d error\n", i); continue; } vmstateget(null, buffer_virt_dest, &state); printf("state: %x\n", state); /* memcpy */ gettimeofday(&start, null); for(j = 0; j < nb_loop; j++) { memcpy((void*)buffer_virt_dest, buffer_virt_src, mwtest_buffer_size); } gettimeofday(&end, null); time_us = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec); printf("mean transfer time:%lld us, throughput:%lld mb/s\n", time_us / nb_loop, (mwtest_buffer_size * 1000000ull * nb_loop) / (1024 * 1024) / time_us); } /* free buffer */ free(buffer_virt_src); return (0); } thank !!
Comments
Post a Comment