start pattern without binaries

This commit is contained in:
2020-05-15 17:06:08 +02:00
parent 00c1211c56
commit ecc692ad9a
11 changed files with 57 additions and 24 deletions

View File

@ -90,6 +90,7 @@
/* Config RW regiseter */
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
#define CONFIG_COUNTER_ENA_OFST (0)
#define CONFIG_COUNTER_ENA_MSK (0x00000003 << CONFIG_COUNTER_ENA_OFST)
#define CONFIG_COUNTER_ENA_DEFAULT_VAL ((0x0 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
@ -110,6 +111,8 @@
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
#define CONTROL_STP_ACQSTN_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_STRT_PATTERN_OFST (2)
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?

View File

@ -716,10 +716,8 @@ int setTrimbits(int *trimbits) {
int start = 0, nloop = 0;
setPatternLoop(-1, &start, &iaddr, &nloop);
}
// load the trimbits
#ifndef VIRTUAL
startStateMachine();
#endif
// send pattern to the chips
startPattern();
}
// copy trimbits locally
@ -1186,6 +1184,11 @@ int *getDetectorPosition() { return detPos; }
/* pattern */
void startPattern() {
LOG(logINFOBLUE, ("Starting Pattern\n"));
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_PATTERN_MSK);
}
uint64_t readPatternWord(int addr) {
// error (handled in tcp)
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {

View File

@ -449,6 +449,7 @@ int getActivate(int *retval);
int setPhase(enum CLKINDEX ind, int val, int degrees);
#elif MYTHEN3D
void startPattern();
uint64_t readPatternWord(int addr);
uint64_t writePatternWord(int addr, uint64_t word);
int setPatternWaitAddress(int level, int addr);

View File

@ -217,3 +217,4 @@ int set_timing_source(int);
int get_num_channels(int);
int update_rate_correction(int);
int get_receiver_parameters(int);
int start_pattern(int);

View File

@ -329,6 +329,7 @@ void function_table() {
flist[F_GET_NUM_CHANNELS] = &get_num_channels;
flist[F_UPDATE_RATE_CORRECTION] = &update_rate_correction;
flist[F_GET_RECEIVER_PARAMETERS] = &get_receiver_parameters;
flist[F_START_PATTERN] = &start_pattern;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -7009,4 +7010,20 @@ int get_receiver_parameters(int file_des) {
LOG(logINFO, ("Sent %d bytes for receiver parameters\n", n));
return OK;
}
int start_pattern(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
LOG(logDEBUG1, ("Starting Pattern\n"));
#ifndef MYTHEN3D
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
startPattern();
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}