Update SW

This commit is contained in:
Greek 2021-03-28 13:36:44 +02:00
parent 2f3e03827a
commit 8658ac24db
5 changed files with 16 additions and 15 deletions

View File

@ -2,13 +2,14 @@
# #
#Each line of this file defines a configuration slot and consists of integer numbers delimited by white #Each line of this file defines a configuration slot and consists of integer numbers delimited by white
#spaces in the following order: #spaces in the following order:
#ADDSUB_MODE ADD_INPUT_MUX DELAY FACTOR TIMESTAMP #ADDSUB_MODE ADD_INPUT_MUX DELAY FACTOR0 FACTOR1 TIMESTAMP
# #
#ADDSUB_MODE: Select feedback mode (0=negative, 1=positive) #ADDSUB_MODE: Select feedback mode (0=Negative, 1=Positive)
#ADD_INPUT_MUX: Select feedback input (0=GND[only ADC Input 1], 1=ADC Input 2[Both ADC inputs are used]) #ADD_INPUT_MUX: Select feedback input (0=Single Input Mode [ADC0], 1=Double Input Mode)
#DELAY: Clock cycles counts (50 ns period) to delay the feedback signal [0-255] #DELAY: Clock cycles counts (50 ns period) to delay the feedback signal [0-65535]
#FACTOR: Multiplication factor to apply to the feedback signal [0-16] (NOTE: Integer is intepreted as a 1Q4 Fixed Point Number!) #FACTOR0: Multiplication factor to apply to the ADC Signal0 [0-32] (NOTE: Integer is intepreted as a Q1.4 Fixed Point Number!)
#FACTOR1: Multiplication factor to apply to the ADC Signal1 [0-32] (NOTE: Integer is intepreted as a Q1.4 Fixed Point Number!)
#TIMESTAMP: Defines the clock count number from the sync pulse from which on the configurations settings will be applied. [32-bit unsigned integer] #TIMESTAMP: Defines the clock count number from the sync pulse from which on the configurations settings will be applied. [32-bit unsigned integer]
# First Config slot should have a timestamp equal to zero. # First Config slot should have a timestamp equal to zero.
1 0 0 8 0 1 0 0 8 8 0
0 0 0 8 1200000000 0 0 0 8 8 1200000000

BIN
sw/out

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,7 +37,7 @@ int main(int argc, char *argv[]){
return -1; return -1;
} }
uint64_t data, addsub_mode, add_input_mode, delay, factor, timestamp; uint64_t data, addsub_mode, add_input_mode, delay, factor1, factor2, timestamp;
/*File Parsing Loop*/ /*File Parsing Loop*/
while(getline(&line, &len, src) != -1){ while(getline(&line, &len, src) != -1){
@ -46,7 +46,7 @@ int main(int argc, char *argv[]){
continue; continue;
} }
if(sscanf(line, "%u %u %u %u %u", &addsub_mode, &add_input_mode, &delay, &factor, &timestamp) < 5){ if(sscanf(line, "%u %u %u %u %u %u", &addsub_mode, &add_input_mode, &delay, &factor1, &factor2, &timestamp) < 5){
perror("Parsing of configuration file failed"); perror("Parsing of configuration file failed");
fprintf(stderr, "Failing line: %s", line); fprintf(stderr, "Failing line: %s", line);
bail(); bail();
@ -54,8 +54,8 @@ int main(int argc, char *argv[]){
} }
data = 0x0; data = 0x0;
data |= ((uint64_t)0x1 << 63) | ((addsub_mode & 0x1) << 62) | ((add_input_mode & 0x1) << 61) | ((delay & 0xFF) << 40) | data |= ((uint64_t)0x1 << 63) | ((addsub_mode & 0x1) << 62) | ((add_input_mode & 0x1) << 61) | ((delay & 0xFF) << 42) |
((factor & 0x1F) << 32) | (timestamp & 0xFFFFFFFF); ((factor1 & 0x1F) << 37) | ((factor2 & 0x1F) << 32) | (timestamp & 0xFFFFFFFF);
if(write(dest, &data, sizeof(uint64_t)) != sizeof(uint64_t)){ if(write(dest, &data, sizeof(uint64_t)) != sizeof(uint64_t)){
perror("Failed to write data"); perror("Failed to write data");
bail(); bail();