mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
solving merging conflicts from 3.1.0 to developer
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
/* global variables */
|
||||
u_int32_t CSP0BASE = 0;
|
||||
u_int64_t CSP0BASE = 0;
|
||||
#define CSP0 0x20200000
|
||||
#define MEM_SIZE 0x100000
|
||||
#define MEM_MAP_SHIFT 1
|
||||
@ -123,10 +123,14 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
||||
*/
|
||||
int mapCSP0(void) {
|
||||
// if not mapped
|
||||
if (!CSP0BASE) {
|
||||
if (CSP0BASE == 0) {
|
||||
printf("Mapping memory\n");
|
||||
#ifdef VIRTUAL
|
||||
CSP0BASE = malloc(MEM_SIZE);
|
||||
if (CSP0BASE == NULL) {
|
||||
cprintf(BG_RED, "Error: Could not allocate virtual memory.\n");
|
||||
return FAIL;
|
||||
}
|
||||
printf("memory allocated\n");
|
||||
#else
|
||||
int fd;
|
||||
@ -138,14 +142,15 @@ int mapCSP0(void) {
|
||||
#ifdef VERBOSE
|
||||
printf("/dev/mem opened\n");
|
||||
#endif
|
||||
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) {
|
||||
CSP0BASE = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||
if (CSP0BASE == MAP_FAILED) {
|
||||
cprintf(BG_RED, "Error: Can't map memmory area\n");
|
||||
return FAIL;
|
||||
}
|
||||
printf("CSPOBASE mapped from %08x to %08x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
#endif
|
||||
//printf("Status Register: %08x\n",bus_r(STATUS_REG));
|
||||
printf("CSPOBASE mapped from 0x%llx to 0x%llx\n",CSP0BASE, CSP0BASE+MEM_SIZE);
|
||||
printf("Status Register: %08x\n",bus_r(STATUS_REG));
|
||||
|
||||
}else
|
||||
printf("Memory already mapped before\n");
|
||||
return OK;
|
||||
|
@ -1391,7 +1391,7 @@ int get_adc(int file_des) {
|
||||
int write_register(int file_des) {
|
||||
int ret=OK,ret1=OK;
|
||||
int n=0;
|
||||
int retval=-1;
|
||||
uint32_t retval=-1;
|
||||
sprintf(mess,"write to register failed\n");
|
||||
|
||||
// receive arguments
|
||||
@ -1399,7 +1399,7 @@ int write_register(int file_des) {
|
||||
n = receiveData(file_des,arg,sizeof(arg),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
int addr=arg[0];
|
||||
int val=arg[1];
|
||||
uint32_t val=arg[1];
|
||||
|
||||
// execute action
|
||||
if (differentClients && lockStatus) {
|
||||
@ -1449,7 +1449,7 @@ int write_register(int file_des) {
|
||||
int read_register(int file_des) {
|
||||
int ret=OK,ret1=OK;
|
||||
int n=0;
|
||||
int retval=-1;
|
||||
uint32_t retval=-1;
|
||||
sprintf(mess,"read register failed\n");
|
||||
|
||||
// receive arguments
|
||||
@ -3167,7 +3167,7 @@ int set_speed(int file_des) {
|
||||
#ifdef JUNGFRAUD
|
||||
case ADC_PHASE:
|
||||
retval = adcPhase(val);
|
||||
if ((retval!=val) && (val>=0)) {
|
||||
if ((val != 65536) && (retval!=val) && (val>=0)) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"could not change set adc phase: should be %d but is %d \n", val, retval);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
|
Reference in New Issue
Block a user