Enable Client Tag, remove ILA

This commit is contained in:
Byron Lathi
2025-11-11 23:08:19 -08:00
parent df377dda5d
commit 13b238e51e
9 changed files with 297 additions and 6373 deletions

View File

@@ -76,13 +76,15 @@ int virt_to_phys_user(uintptr_t *paddr, uintptr_t vaddr)
int main(void)
{
uint32_t dma_mem_addr = 0x10;
uint32_t dma_mem_addr = 0x00;
/* Instead of allocating source, just use the constant string */
//char* src_1 = "Hello, world! This is some data that is stored in system memory!";
char* src_1 = "AAAA";
//char* src_2 = "This is many different words, in a different order";
char* src_2 = "BBBB";
//printf("Allocating 1024 bytes as source\n");
//uintptr_t src = (uintptr_t)malloc(1024);
char* src = "Hello, world! This is some data that is stored in system memory!";
char* src = (char*)malloc(1024);
printf("Virtual address: %lx\n", src);
uintptr_t src_phys;
virt_to_phys_user(&src_phys, (uintptr_t)src);
@@ -98,7 +100,6 @@ int main(void)
printf("Physical address: %lx\n", dst_phys);
printf("\n\n");
memset((void*)dst, 0, 1024);
printf("mmaping PCIe space\n");
// this is hardcoded, seems to be deterministic.
@@ -107,38 +108,49 @@ int main(void)
uint32_t* pcie_base = (uint32_t*)mmap(0, 64, PROT_READ|PROT_WRITE, MAP_SHARED, fd, pcie_physical_base_offset);
printf("Virtual PCIe Base: %p\n", pcie_base);
printf("Sending read DMA\n");
pcie_base[0] = (uint32_t)src_phys;
pcie_base[1] = (uint32_t)(src_phys >> 32);
pcie_base[2] = dma_mem_addr;
pcie_base[3] = strlen(src);
for (int i = 0; i < 4; i++) {
printf("pcie_base[%d] = %x\n", i, pcie_base[i]);
for (int i = 0; i < 2; i++) {
if (i == 0) {
strncpy((void*)src, src_1, 1024);
} else {
strncpy((void*)src, src_2, 1024);
}
memset((void*)dst, 0, 1024);
printf("Sending read DMA\n");
pcie_base[0] = (uint32_t)src_phys;
pcie_base[1] = (uint32_t)(src_phys >> 32);
pcie_base[2] = dma_mem_addr;
pcie_base[3] = strlen(src);
for (int i = 0; i < 4; i++) {
printf("pcie_base[%d] = %x\n", i, pcie_base[i]);
}
pcie_base[4] = 1;
printf("%d\n", pcie_base[4]);
printf("\n\n");
printf("Sending write DMA\n");
printf("Sending read DMA\n");
pcie_base[8] = (uint32_t)dst_phys;
pcie_base[9] = (uint32_t)(dst_phys >> 32);
pcie_base[10] = dma_mem_addr;
pcie_base[11] = strlen(src);
for (int i = 8; i < 12; i++) {
printf("pcie_base[%d] = %x\n", i, pcie_base[i]);
}
pcie_base[12] = 1;
printf("%d\n", pcie_base[12]);
printf("\n\n");
printf("strlen(dst)=%d\n", strlen(dst));
printf("%s\n", dst);
}
pcie_base[4] = 1;
printf("%d\n", pcie_base[4]);
printf("\n\n");
printf("Sending write DMA\n");
printf("Sending read DMA\n");
pcie_base[8] = (uint32_t)dst_phys;
pcie_base[9] = (uint32_t)(dst_phys >> 32);
pcie_base[10] = dma_mem_addr;
pcie_base[11] = strlen(src);
for (int i = 8; i < 12; i++) {
printf("pcie_base[%d] = %x\n", i, pcie_base[i]);
}
pcie_base[12] = 1;
printf("%d\n", pcie_base[12]);
printf("\n\n");
printf("strlen(dst)=%d\n", strlen(dst));
printf("%s\n", dst);
}