Newer
Older
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int res = ecs_open( 0 , 0 ) ;
if ( -1 == res ) printf("ERROR: Could not open device (BAR 0)\n") ;
else printf("SUCCESS: Device opened for DMA\n");
res = ecs_open( 0 , 2 ) ;
if ( -1 == res ) printf("ERROR: Could not open device (BAR 2)\n") ;
else printf("SUCCESS: Device opened for ECS\n");
// Read DMA
unsigned int * data ;
res = pcie40_b2dmapointerread( 0 , &data ) ;
int i = 0 ;
if ( res == 0 ) printf( "DMA Error\n" ) ;
else {
for (i= 0 ;i < DMASIZE;i++) printf("0X%08x\n",data[i]);
}
//
res = ecs_close( 0 , 0 ) ;
if ( -1 == res ) printf("ERROR: Could not close device (BAR 0)\n");
else printf("SUCCESS: Device closed for DMA\n");
res = ecs_close( 0 , 2 ) ;
if ( -1 == res ) printf("ERROR: Could not close device (BAR 2)\n");
else printf("SUCCESS: Device closed for ECS\n");