diff --git a/Pcie40Applications/Makefile b/Pcie40Applications/Makefile index 61a176a9c03b22427cb0b393d890764cee492989..addf4af11c4c927a5756511d5adada8f3c2d37dd 100644 --- a/Pcie40Applications/Makefile +++ b/Pcie40Applications/Makefile @@ -63,6 +63,12 @@ PCIE40_DMA_CHECK_CXXFLAGS =$(CFLAGS) -I$(TOP) -I$(TOP)/../Pcie40Driver PCIE40_DMA_CHECK_INSTALL =$(PREFIX)/bin PCIE40_DMA_CHECK_LDFLAGS = -L../Pcie40Libraries/lib -lpcie40 -L../Pcie40DriverLibraries/ -lpcie40driver_ecs +PCIE40_ULRESET :=pcie40_ulreset +PCIE40_ULRESET_OBJS =main_pcie40_ulreset.o +PCIE40_ULRESET_CXXFLAGS =$(CFLAGS) -I$(TOP) -I$(TOP)/../Pcie40Driver +PCIE40_ULRESET_INSTALL =$(PREFIX)/bin +PCIE40_ULRESET_LDFLAGS = -L../Pcie40Libraries/lib -lpcie40 -L../Pcie40DriverLibraries/ -lpcie40driver_ecs + PCIE40_READFPGAVERSION :=pcie40_readFPGAversion PCIE40_READFPGAVERSION_OBJS =main_pcie40_readFPGAversion.o @@ -82,6 +88,7 @@ $(eval $(call ODIR_template,PCIE40_B2LRESET)) $(eval $(call ODIR_template,PCIE40_DMA)) $(eval $(call ODIR_template,PCIE40_DAQ)) $(eval $(call ODIR_template,PCIE40_UL)) +$(eval $(call ODIR_template,PCIE40_ULRESET)) $(eval $(call ODIR_template,PCIE40_DMA_CHECK)) $(eval $(call ODIR_template,PCIE40_READFPGAVERSION)) $(eval $(call COPY_template,SCRIPTS,755)) diff --git a/Pcie40Applications/main_pcie40_ulreset.cpp b/Pcie40Applications/main_pcie40_ulreset.cpp new file mode 100644 index 0000000000000000000000000000000000000000..566f83cb97d3e311b86c2e4a47f09792e4730c27 --- /dev/null +++ b/Pcie40Applications/main_pcie40_ulreset.cpp @@ -0,0 +1,28 @@ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <time.h> +#include "altera_dma_regs.h" + +extern "C" int ecs_open(int dev, int bar); +extern "C" void ecs_close(int dev, int bar); +extern "C" int ecs_write(int dev, int bar, unsigned add, int val); + +//#define DEBUG + +int main (int argc ,char** argv) { + + int res = ecs_open( 0 , 0 ) ; + res = ecs_open( 0 , 2 ) ; + + // + // Turn on pio_cmd1_s(2) to reset UL + // ( From messages in https://b2rc.kek.jp/channel/daq_upgrade_pcie40 ) + // + ecs_write( 0 , 2 , 0x00050400 , 0x0); + ecs_write( 0 , 2 , 0x00050400 , 0x4 ); + ecs_write( 0 , 2 , 0x00050400 , 0x0 ); + + ecs_close( 0 , 0 ) ; + return 0 ; +}