Skip to content
Snippets Groups Projects
Commit c65e64cb authored by Patrick Robbe's avatar Patrick Robbe
Browse files

Add DMA test softwrae

parent 6dcc76a1
No related branches found
No related tags found
No related merge requests found
......@@ -27,5 +27,6 @@ modules.order
Pcie40Applications/pcie40_ecs
Pcie40Applications/pcie40_reload
Pcie40Applications/pcie40_b2slc
Pcie40Applications/pcie40_dma
*.d
**/pcie40_reload.out
......@@ -27,6 +27,12 @@ PCIE40_SLC_CFLAGS =$(CFLAGS) -I$(TOP) -I$(TOP)/../Pcie40Libraries
PCIE40_SLC_INSTALL =$(PREFIX)/bin
PCIE40_SLC_LDFLAGS = -L../Pcie40Libraries/lib -lpcie40 -L../Pcie40DriverLibraries/ -lpcie40driver_ecs
PCIE40_DMA :=pcie40_dma
PCIE40_DMA_OBJS =main_pcie40_dma.o
PCIE40_DMA_CFLAGS =$(CFLAGS) -I$(TOP) -I$(TOP)/../Pcie40Driver
PCIE40_DMA_INSTALL =$(PREFIX)/bin
PCIE40_DMA_LDFLAGS = -L../Pcie40Libraries/lib -lpcie40 -L../Pcie40DriverLibraries/ -lpcie40driver_ecs
VPATH :=$(TOP)
include $(TOP)/rules.mk
......@@ -34,6 +40,7 @@ include $(TOP)/rules.mk
ifeq ($(ENABLE_PCIE40), true)
$(eval $(call ODIR_template,PCIE40_ECS))
$(eval $(call ODIR_template,PCIE40_SLC))
$(eval $(call ODIR_template,PCIE40_DMA))
$(eval $(call COPY_template,SCRIPTS,755))
$(eval $(call LINK_template,PCIE40_RELOAD))
$(eval $(call ODIR_template,PCIE40_RELOAD_SUID))
......
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
#include "altera_dma_cmd.h"
#include "altera_dma_regs.h"
#define BUFFER_LENGTH 40
unsigned int* pDmaUser;
int main (int argc ,char** argv) {
int i;
int rc= 0;
int on_chip_size = ( DMASIZE * 4 )*ALTERA_DMA_DESCRIPTOR_NUM ;
ssize_t f;
f = open ("/dev/pcie40_0_altdma", O_RDWR);
if (f == -1) {
printf ("Couldn't open the device.\n");
return 0;
} else {
printf ("Opened the device: file handle #%lu!\n", (long unsigned int)f);
}
pDmaUser= (unsigned int *) mmap( NULL ,
on_chip_size ,
PROT_READ|PROT_WRITE ,
MAP_SHARED ,
f ,
0x000);
rc = ioctl(f, ALTERA_IOCX_START);
if (( pDmaUser!= NULL)&(rc >0) ) {
for (i= 0 ;i < DMASIZE;i++) printf("0X%08x\n",pDmaUser[i]);
} else {
printf (" No data available :\n");
if (rc == -1) printf( "DMA too longs\n ");
if (rc == -2) printf( "FIFO is empty \n ");
}
close (f);
return 0 ;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment