8.0.0.rc jf: reconfigure chip when touching electron collection mode bit (#830)

* jf: if bit 14 in reg 0x5d (electron mode collection bit) is changed, configure chip if v1.1 and powered on. so touch writeregister (setbit/clearbit also calls write register in the end). replace when electroncollectionmode command introduced
This commit is contained in:
maliakal_d 2023-10-18 10:49:44 +02:00 committed by GitHub
parent 601249cc71
commit e5ee27dbfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -15,6 +15,11 @@ u_int32_t *csp0base = 0;
#define CSP0 0x20200000
#define MEM_SIZE 0x100000
#ifdef JUNGFRAUD
extern void configureChip();
#endif
void bus_w16(u_int32_t offset, u_int16_t data) {
volatile u_int16_t *ptr1;
ptr1 = (u_int16_t *)(csp0base + offset / 2);
@ -80,7 +85,21 @@ u_int32_t readRegister(u_int32_t offset) {
}
u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
// if electron mode bit touched
#ifdef JUNGFRAUD
int electronCollectionModeChange = 0;
if ((offset << MEM_MAP_SHIFT) == DAQ_REG) {
if ((readRegister(offset) ^ data) & DAQ_ELCTRN_CLLCTN_MDE_MSK) {
electronCollectionModeChange = 1;
}
}
#endif
bus_w(offset << MEM_MAP_SHIFT, data);
#ifdef JUNGFRAUD
if (electronCollectionModeChange) {
configureChip();
}
#endif
return readRegister(offset);
}

View File

@ -10,4 +10,4 @@
#define APIMYTHEN3 "developer 0x230922"
#define APIMOENCH "developer 0x230922"
#define APIEIGER "developer 0x230922"
#define APIJUNGFRAU "developer 0x231013"
#define APIJUNGFRAU "developer 0x231018"