Update SW
This commit is contained in:
parent
2f3e03827a
commit
8658ac24db
15
sw/config
15
sw/config
@ -2,13 +2,14 @@
|
||||
#
|
||||
#Each line of this file defines a configuration slot and consists of integer numbers delimited by white
|
||||
#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)
|
||||
#ADD_INPUT_MUX: Select feedback input (0=GND[only ADC Input 1], 1=ADC Input 2[Both ADC inputs are used])
|
||||
#DELAY: Clock cycles counts (50 ns period) to delay the feedback signal [0-255]
|
||||
#FACTOR: Multiplication factor to apply to the feedback signal [0-16] (NOTE: Integer is intepreted as a 1Q4 Fixed Point Number!)
|
||||
#ADDSUB_MODE: Select feedback mode (0=Negative, 1=Positive)
|
||||
#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-65535]
|
||||
#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]
|
||||
# First Config slot should have a timestamp equal to zero.
|
||||
1 0 0 8 0
|
||||
0 0 0 8 1200000000
|
||||
1 0 0 8 8 0
|
||||
0 0 0 8 8 1200000000
|
||||
|
||||
BIN
sw/read_debug
BIN
sw/read_debug
Binary file not shown.
BIN
sw/write_config
BIN
sw/write_config
Binary file not shown.
@ -37,7 +37,7 @@ int main(int argc, char *argv[]){
|
||||
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*/
|
||||
while(getline(&line, &len, src) != -1){
|
||||
@ -46,7 +46,7 @@ int main(int argc, char *argv[]){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(sscanf(line, "%u %u %u %u %u", &addsub_mode, &add_input_mode, &delay, &factor, ×tamp) < 5){
|
||||
if(sscanf(line, "%u %u %u %u %u %u", &addsub_mode, &add_input_mode, &delay, &factor1, &factor2, ×tamp) < 5){
|
||||
perror("Parsing of configuration file failed");
|
||||
fprintf(stderr, "Failing line: %s", line);
|
||||
bail();
|
||||
@ -54,8 +54,8 @@ int main(int argc, char *argv[]){
|
||||
}
|
||||
|
||||
data = 0x0;
|
||||
data |= ((uint64_t)0x1 << 63) | ((addsub_mode & 0x1) << 62) | ((add_input_mode & 0x1) << 61) | ((delay & 0xFF) << 40) |
|
||||
((factor & 0x1F) << 32) | (timestamp & 0xFFFFFFFF);
|
||||
data |= ((uint64_t)0x1 << 63) | ((addsub_mode & 0x1) << 62) | ((add_input_mode & 0x1) << 61) | ((delay & 0xFF) << 42) |
|
||||
((factor1 & 0x1F) << 37) | ((factor2 & 0x1F) << 32) | (timestamp & 0xFFFFFFFF);
|
||||
if(write(dest, &data, sizeof(uint64_t)) != sizeof(uint64_t)){
|
||||
perror("Failed to write data");
|
||||
bail();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user