implemented marking of desired events in logfile by void insert_marker_to_file(char* logfilename, char* marker_text). Also implemented marker correct displaying on plots

This commit is contained in:
2025-10-14 19:22:58 +03:00
parent 8c283cb262
commit 5a817dc910
3 changed files with 54 additions and 19 deletions

57
main.c
View File

@ -851,6 +851,12 @@ uint32_t X502_FlushRcv_buff(t_x502_hnd hnd){
return ready;
}
void insert_marker_to_file(char* logfilename, char* marker_text){
printf("marker %s \n", marker_text);
FILE* logfile_ptr = fopen(logfilename, "a");
fprintf(logfile_ptr, "marker %s \n", marker_text);
fclose(logfile_ptr);
}
void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint32_t max_total_words){
FILE* logfile_ptr = fopen(logfilename, "a");
@ -1213,6 +1219,8 @@ int main(int argc, char** argv) {
uint32_t recv_Err_code = 0;
insert_marker_to_file(logfilename, "start transparent");
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
@ -1276,7 +1284,7 @@ int main(int argc, char** argv) {
// printf("\nStart SEMITRANSPARENT mode\n");
// BF_exec_cmd_simple(hnd, 0x800B, 2, 1); //start SEMITRANSPARENT
insert_marker_to_file(logfilename, "start AVG");
printf("\nStart AVG mode\n");
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
@ -1311,8 +1319,6 @@ int main(int argc, char** argv) {
data_receive_trys_counter = 100;
max_total_words = 100000;
// void receive_data(t_x502_hnd hnd, FILE* logfile_ptr, uint32_t* inp_buff, int data_receive_trys_counter, uint32_t max_total_words, DUMP_TO_FILE)
//printf("\n dbg value: ");
//BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
@ -1338,20 +1344,34 @@ int main(int argc, char** argv) {
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
// printf("\n dbg value: ");
// BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
// printf("\n dbg value: ");
// BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
insert_marker_to_file(logfilename, "enable FFT");
printf("\nEnabled FFT\n");
BF_exec_cmd_simple(hnd, 0x8011, 2, 1); //enable FFT
max_total_words = 100000;
// printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
// BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
X502_StreamsStop(hnd);
X502_StreamsStart(hnd);
receive_to_file(hnd, logfilename, inp_buff, max_total_words);
insert_marker_to_file(logfilename, "enable SYNC_DETector");
printf("\nEnabled SYNC_DETector\n");
BF_exec_cmd_simple(hnd, 0x8012, 2, 1); //enable FFT
max_total_words = 100000;
// printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
// BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
X502_StreamsStop(hnd);
X502_StreamsStart(hnd);
receive_to_file(hnd, logfilename, inp_buff, max_total_words);
@ -1365,6 +1385,15 @@ int main(int argc, char** argv) {
insert_marker_to_file(logfilename, "start transparent");
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
X502_StreamsStop(hnd);