From 7b9e12f8ff46ca3f8ce8dbcb27f75ac119605231 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 11 Jun 2013 11:41:29 +0000 Subject: [PATCH] a rough working version git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@591 951219d9-93cf-4727-9268-0efd64621fa3 --- .../eigerDetectorServer/Makefile | 10 +++-- .../slsDetectorFunctionList.c | 37 ++++++++++++++++++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/slsDetectorSoftware/eigerDetectorServer/Makefile b/slsDetectorSoftware/eigerDetectorServer/Makefile index b015b71b6..cd345c0c8 100644 --- a/slsDetectorSoftware/eigerDetectorServer/Makefile +++ b/slsDetectorSoftware/eigerDetectorServer/Makefile @@ -1,5 +1,5 @@ CC = powerpc-4xx-softfloat-gcc -CLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST #-DVIRTUAL +CLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST #-DVERBOSE #-DVIRTUAL LDLIBS += -lm -lstdc++ PROGS = eigerDetectorServer @@ -13,10 +13,12 @@ OBJS = $(SRC_CLNT:.cpp=.o) all: clean $(PROGS) -pc: clean pccompile $(PROGS) -pccompile: -CC := gcc +3pc: clean pccompile $(PROGS) + + +#pccompile: +#CC := gcc boot: $(OBJS) diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index cc96bc827..4a819d9fa 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -6,6 +6,11 @@ #include #include +/** temporary*/ +#include //PROT_READ,PROT_WRITE,MAP_FILE,MAP_SHARED,MAP_FAILED +#include //O_RDWR + + const int nChans=NCHAN; const int nChips=NCHIP; @@ -36,7 +41,7 @@ int nModBoard; extern int dataBytes; -/** temporary */ +/** temporary u_int32_t CSP0BASE; int mapCSP0(void) { CSP0BASE = (u_int32_t)malloc(0xFFFFFFF); @@ -45,11 +50,39 @@ int mapCSP0(void) { printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+0xFFFFFFF); return OK; } +*/ +#define CSP0 0xC4100000 //XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR +#define MEM_SIZE 0xFFFFFFF + +u_int32_t CSP0BASE; +int mapCSP0(void) { + int fd; + printf("Mapping memory\n"); +#ifdef VIRTUAL + CSP0BASE = (u_int32_t)malloc(MEM_SIZE); + printf("memory allocated\n"); +#else + if ((fd=open("/dev/mem", O_RDWR | O_SYNC)) < 0){ + printf("Cant find /dev/mem!\n"); + return FAIL; + } + printf("/dev/mem opened\n"); + CSP0BASE = (u_int32_t)mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0); + if (CSP0BASE == (u_int32_t)MAP_FAILED) { + printf("\nCan't map memmory area!!\n"); + return FAIL; + } +#endif + printf("CSPOBASE is 0x%x \n",CSP0BASE); + printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+MEM_SIZE); + + return OK; +} int initializeDetectorStructure(){ - + printf("EIGER 5\n"); int imod; int n=getNModBoard(X)*getNModBoard(Y); #ifdef VERBOSE