From fc3fdb92ee112e1910d873de9fe512c1543f4fb9 Mon Sep 17 00:00:00 2001 From: Theodor Chikin Date: Thu, 13 Nov 2025 18:20:19 +0300 Subject: [PATCH] deleted unused funcs and commented outdated code --- BF_companion | Bin 482928 -> 482936 bytes main.c | 476 +-------------------------------------------------- 2 files changed, 3 insertions(+), 473 deletions(-) diff --git a/BF_companion b/BF_companion index bc5b12cc51ec2b2cf6c3bd1cea69f0742d1ec281..0f0209c8f41fe2d16e87c613c4fd5a32af9f711d 100755 GIT binary patch delta 3023 zcmbVOYit!o6yBNH+1=ZVp)J# z3n7qVz@TH&pp8Ey28n>mfZmWQhDTzg7^!~@i2l%qR0<|o2~p2Cd-wKXG1X1x+nt@q z`OZ1toZaqZUQaS_??krg=%lB_y~V}fj$8D?ZGLE;b!Y!;?42E_dNwvSi=EAa>1M&3 zT((|ihIuZl)f2fqz`u^s%8G0~q=vsUl%NB_u6&C={3e{4$BrCq^d^&$WL z9>>4`pjUSAxue($)q0aiSL+iuc|x+oD&E6$`IK6fEV4)GiXMJ#6uY5j=ZIXErJucHC_(81*-=BOFBiJ9-SfMk#rIRmkOv@q!XAGqaHJ05@;+K z=?pP<_FQaGP9Tvx2l{d3bSuPD#YiW|%3)41+yVn6v4LhA*SuORHUOJ_5@>Q)2geU6 zK1uFw#MumVkG&9{v=`ZDu#bU%)xHhw+kvybWUWVwbf z4p;;X`~+oCm1715Nsxd|F%nY-8rI1|xz91K1-c71#wqhPJ`XDm+)d-XUJcN=G)Kxf zM5oE(ayj`D6m-#UF^9?UTK!d#JR0Kp_kv10g6Xb)7O*`-<0fu-EnsQD zNa7a^U{emNMro$&A6-;oX{vC4*}Guw_U3J7x>|ZrjNul#fvo`o;ujz-ZsVOtUpIaq zfm5a5DwUb{G~z2WP{nW|t>oMpG@ThRJpZSh5myIsbq+wzb7)hW$YonDBFqtC*Ob~S z{pgeOO~()mH25;jMofeF2C?m@f@lIn4fLv@8Fp|6`cz?bB~G`4Ae&hBQ31}mcaRqn zqAG{dbUo-H;|&-=RKs8!HY%>tuT;pMNMR65&@(A_+A!MyjQ0KRskdw7i!=VQ!uuI3 z3=CXByaYbRtc0mKwenO}usD4-ROULF`@|3uWVY$mP+CILI6I#HO3WvoM6z+6+~GB% zw8095(n<~DNIRLe1oI6HD4FJ)S53Ta{FT_tX`UG5%(3+}Aj`;xDcBMjaAZDJhH{G@ zElbyLk|D{;)V2m0kD0ibp9ds_VSoRxr%Zj?AUE&=TRpf%#=^a1lwP_;Zmw2iyJWWd zx>M$>G1p~OUF?z(-Q6iyGgaCxGjz>0IhpGtUGgQiv-rBy#n+wJN9cC$wk=}`wXf2h t!QNNrE8S8qJ5|O?cNS|`3s+Lty`gra+osM_mp!CHtLS!FEnMYJ_!~PU=PLjJ delta 3028 zcmbVOYitx%6rTH<-EC3&pxNDq?G|gH1q_iAAt)5I7=)k&8&MuD54%4sFG~@8zyj5f zkRrtZ6GJdH!59>b5anW85v3py4OVeQgFzCbAdw=8$u=N*zB`?5DaBMLneV>O`Of2> znPf}kN=u}%h%MV!{FoS^ceU-QOPm=YSM0d4`|kG&XR<%f);EX^4T9+g!Rvi&n3Ivt zgKU8=O6UHO;RLrVpJiDYF#>w_2Hp0AeqLoBlv=zY&~+JcsW13uyeh!)t&#KpWCj|r|QL? zd&7!|;z)U$JO6ONZAH`NpBOqC+JPk%UP87 z&!bM~lcbh0MlgVYZ=>+C2=&BZz!*Ro0hPrwdgc=R6N z7l0oL)Gq|`G9U@yq)7&#E{I;f9@HWagkzIw;PIYKeegD%Gsa`D0np{3D?pcn9|u1U zYHS7eZNS1#z#c#|fovsEUjl-9Ttc$!xTowIO~O%7m_u<-Db2n}Gt7WddOt0?N}*o% zQL`$eV{9gY4O@L6;;R;x{`jIipEVyWzyM}@42;SB*WsK2C^o?{(Gaj!+-$9YwF1_P zW&)YgsjBtg*X4O(to8KtZtX7UGhp<=WMi#JS=$HA-K_NtwRk?abQM$U{8K!i!%|~q zzgB29@L$3y%Jk4Q6%D0==$X_(;!*+3ya3?_OaP4rlRABjoy?#D#_|XhVrL_NY&FUX z@Of_S(Z}yn{p_(Y3k(p%skGae=6?W(4M1nN0Gim9fm@ApXR+ECe}i^n>q?6; zsha3VUKnnHGY}0BNO1wu;ymWs0e=zL`FdBW%D5w5L?5x9xe60f`5Mfl9n65?`9G5u zezoCOy9OCJk%USjmu30jVGa-bOhL`plcuTdb|Hv)(XXREeCqkv^KH)d3KfiZ#k>Jh zk=NZSD~1X;)`m-s=eorlch?V>`kM&?DQPNkdH^aD|{ zEKMXXgob;L1UD0J`!G%$0Eh0MHs_tiYSHLhPWXSt2?IS(5KV#aElXO?v?c0LuW?Jo zEGvWlOPGN^gv-e7%BWOADdUYoh=Tbx)qS$Olq_GH)Ek$o7yR+rH04#wCRzo9lmjxS z4KGDl%WXotl;pf8CYlUFhs(=WTTht}j*RN6m#d4fYt5r1D z_{{t}Ab1S&-Jc%r99ykwd53Vuu2H$^U1VnHsx|7R8t1KxDo-qbez~6bo0`Y?@><<^ zNloI;H|=VGbNI57`t values_N = 0; - (*FFT_data)-> ID = 0; - (*FFT_data)-> description = 0; - (*FFT_data)-> curr_I = 0; //current index of value and corresponding frequency - - for (int I = 0; I < adc_readouts_N; ++I){ - (*FFT_data)->vals_Re [I] = 0; - (*FFT_data)-> vals_Im [I] = 0; - (*FFT_data)-> vals_F [I] = 0; - } - -*/ - - - struct BF_msg_parsed_typedef BF_msg; - for (uint32_t inp_buff_I = 0; inp_buff_I < inp_values_N; ++inp_buff_I){ - - BF_msg.raw_data = inp_buff[inp_buff_I]; - BF_msg.raw_header = (uint8_t) (BF_msg.raw_data >> 24); - - BF_msg.flags = 0; - BF_msg.type = 0; - BF_msg.chan = 0; - //BF_msg.raw_data = 0; - BF_msg.raw_value = BF_msg.raw_data & 0xFFFFFF; - BF_msg.value_int = 0; - BF_msg.value = 0; - - if (BF_msg.raw_header & 0b10000000){ // ADC data - BF_msg.type = ADC_data; - BF_msg.chan = BF_msg.raw_header & 0b00001111; - BF_msg.flags = (BF_msg.raw_header >> 4); - BF_msg.value_int = BF_msg.raw_value & 0x7FFFFF; - if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value - BF_msg.value_int *= -1; - } - BF_msg.value = 0.0;// TODO conversion from int to double with respect to ADC channel voltage range - - - }else if (BF_msg.raw_header & 0b01000000){ //user data (FFT,) - if (BF_msg.raw_header & 0x0F == FFT_val_re){ - BF_msg.type = FFT_val_re; - }else if (BF_msg.raw_header & 0x0F == FFT_val_im){ - BF_msg.type = FFT_val_im; - }else if (BF_msg.raw_header & 0x0F == FFT_val_f){ - BF_msg.type = FFT_val_f; - }else{ - BF_msg.type = USR_data; - } - BF_msg.chan = 0; - //BF_msg.chan == BF_msg.raw_header & 0b00111111; - BF_msg.value_int = BF_msg.raw_value & 0x7FFFFF; - if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value - BF_msg.value_int *= -1; - } - if (! (((*FFT_data)-> rcv_state) & (0b1 << 7 ))){ - if (BF_msg.type == FFT_val_re){ - (*FFT_data)->rcv_state |= 0b1 << 0; - (*FFT_data)-> vals_Re[(*FFT_data)->curr_I] = BF_msg.value_int; - }else if (BF_msg.type == FFT_val_im){ - (*FFT_data)->rcv_state |= 0b1 << 1; - (*FFT_data)-> vals_Im[(*FFT_data)->curr_I] = BF_msg.value_int; - }else if (BF_msg.type == FFT_val_f){ - (*FFT_data)->rcv_state |= 0b1 << 2; - (*FFT_data)-> vals_F[(*FFT_data)->curr_I] = BF_msg.value_int; - } - if ((*FFT_data)-> rcv_state == 0b111){ - (*FFT_data)-> rcv_state = 0; - ++(*FFT_data)->curr_I; - if ((*FFT_data)->curr_I >= (*FFT_data)->max_N){ - (*FFT_data)-> rcv_state |= 0b1 << 7; - printf("received more FFT values than allowed. <========================== ERROR\n"); - - } - } - } - }else if (BF_msg.raw_header & 0b01100000){ //user data LFSM) - if (BF_msg.raw_header & 0x0F == LFSM_val_ON){ - BF_msg.type = LFSM_val_ON; - }else if (BF_msg.raw_header & 0x0F == LFSM_val_OFF){ - BF_msg.type = LFSM_val_OFF; - }else if (BF_msg.raw_header & 0x0F == LFSM_val_X){ - BF_msg.type = LFSM_val_X; - }else{ - BF_msg.type = USR_data; - } - BF_msg.chan = 0; - //BF_msg.chan == BF_msg.raw_header & 0b00111111; - BF_msg.value_int = BF_msg.raw_value & 0x7FFFFF; - if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value - BF_msg.value_int *= -1; - } - if (! (((*LFSM_data) -> rcv_state) & (0b1 << 7 ))){ - if (BF_msg.type == LFSM_val_ON){ - (*LFSM_data) ->rcv_state |= 0b1 << 0; - (*LFSM_data) -> Y_on[(*LFSM_data) ->curr_I] = BF_msg.value_int; - }else if (BF_msg.type == LFSM_val_OFF){ - (*LFSM_data) ->rcv_state |= 0b1 << 1; - (*LFSM_data) -> Y_off[(*LFSM_data) ->curr_I] = BF_msg.value_int; - }else if (BF_msg.type == LFSM_val_X){ - (*LFSM_data) ->rcv_state |= 0b1 << 2; - (*LFSM_data) -> X[(*LFSM_data) ->curr_I] = BF_msg.value_int; - } - if ((*LFSM_data) -> rcv_state == 0b011){ - (*LFSM_data) -> rcv_state = 0; - ++(*LFSM_data) ->curr_I; - if ((*LFSM_data) ->curr_I >= (*LFSM_data) ->max_N){ - (*LFSM_data) -> rcv_state |= 0b1 << 7; - printf("received more LFSM values than allowed. <========================== ERROR\n"); - } - } - } - - }else if (BF_msg.raw_header & 0b01100000 == 0b01100000){ //user message - BF_msg.type = USR_msg; - BF_msg.chan = BF_msg.raw_header & 0b00011111; - BF_msg.value_int = BF_msg.raw_value & 0x7FFFFF; - if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value - BF_msg.value_int *= -1; - } - printf("Received USR msg: 0x%06H \n", BF_msg.raw_value); - - //}else if (raw_header & 0b01100000 == 0b01100000){ // - }else if (BF_msg.raw_header & 0b01101010 == 0b01101010){ //new Frequency Sweep Started. So save old (*FFT_data)to FFT_data_done and start working with new FFT_data - //FFT - printf("Received: new LFSM started. msg payload: 0x%06H \n", BF_msg.raw_value); - (*FFT_data)-> rcv_state = 0xFF; // data filled - int FFT_last_ID = (*FFT_data)-> ID; - int FFT_points_max_N = (*FFT_data)-> max_N; - struct FFT_res_typedef ** FFT_tmp = *FFT_data_done; - *FFT_data_done = *FFT_data; - *FFT_data = *FFT_tmp; - - - //(*FFT_data)-> values_N = 0; - (*FFT_data)-> rcv_state = 0; - (*FFT_data)-> ID = FFT_last_ID + 1; - (*FFT_data)-> max_N = FFT_points_max_N; - (*FFT_data)-> description = 0; - (*FFT_data)-> curr_I = 0; //current index of value and corresponding frequency - - for (int I = 0; I < (*FFT_data)-> max_N; ++I){ - (*FFT_data)->vals_Re [I] = 0; - (*FFT_data)-> vals_Im [I] = 0; - (*FFT_data)-> vals_F [I] = 0; - } - free(FFT_tmp); - free(FFT_last_ID); - free(FFT_points_max_N); - - //LFSM - (*LFSM_data) -> rcv_state = 0xFF; // data filled - int LFSM_last_ID = (*LFSM_data) -> ID; - int LFSM_points_max_N = (*LFSM_data) -> max_N; - struct LFSM_typedef ** LFSM_tmp = *LFSM_data_done; - *LFSM_data_done = *LFSM_data; - *LFSM_data = *LFSM_tmp; - - - //(*LFSM_data) -> values_N = 0; - (*LFSM_data) -> rcv_state = 0; - (*LFSM_data) -> ID = LFSM_last_ID + 1; - (*LFSM_data) -> max_N = LFSM_points_max_N; - (*LFSM_data) -> description = 0; - (*LFSM_data) -> curr_I = 0; //current index of value and corresponding frequency - for (int I = 0; I < (*LFSM_data) -> max_N; ++I){ - (*LFSM_data) -> X [I] = 0; - (*LFSM_data) -> Y_on [I] = 0; - (*LFSM_data) -> Y_off [I] = 0; - } - free(LFSM_tmp); - free(LFSM_last_ID); - free(LFSM_points_max_N); - - - - - - - - - }else{ - BF_msg.type = unknown; - BF_msg.chan = 0; - BF_msg.value_int = BF_msg.raw_value & 0x7FFFFF; - if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value - BF_msg.value_int *= -1; - } - } - } -} uint32_t X502_FlushRcv_buff(t_x502_hnd hnd){ uint32_t ready; @@ -879,78 +674,6 @@ void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint fclose(logfile_ptr); } -void receive_data(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, int data_receive_trys_counter, uint32_t max_total_words, uint8_t mode){ - //int data_receive_trys_counter = 100; - //uint32_t max_total_words = 10000; - uint32_t ready_cnt_Err = 0; - uint32_t recv_Err_code = 0; - - int ready_cnt = 0; - int ready_cnt_copy = 0; - int values_in_line = 0; - - FILE *logfile_ptr; - - logfile_ptr = fopen(logfilename, "a"); - - //while((--data_receive_trys_counter)&& (max_total_words)){ - - //ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt); - recv_Err_code = X502_Recv(hnd, inp_buff, max_total_words, data_receive_trys_counter); - //printf("\n\nget counters of calls of SPORT_RX, SPORT_TX, HDMA_RX, HDMA_TX\n"); - //BF_exec_cmd_with_arr(hnd, 0x8005U, 100, NULL, 0, 1); - //printf("\n\request TX_buff_I_shadow value (last size of TX_buff transferred to pc )\n"); - //BF_exec_cmd_simple(hnd, 0x8009, 10, 1); - if (mode == DUMP_TO_FILE){ - if (ready_cnt){ - printf("Ready count: %d, Err: %d \n", ready_cnt, ready_cnt_Err); - for (int i = 0; i < ready_cnt; ++i){ - //printf("\nabort value: %d\n", abort_crtl_C); - if (abort_crtl_C){ - break; - } - --max_total_words; - if (max_total_words == 0){ - break; - } - char bin_str_val[9] = {0,}; - uin32_t_to_bin(inp_buff[i], bin_str_val); - printf(" 0x%08X,", inp_buff[i]); - fprintf(logfile_ptr, "0x%08X \n", inp_buff[i]); - //printf(" 0b%s,", bin_str_val); - ++values_in_line; - if (values_in_line == 10){ - printf("\n"); - values_in_line = 0; - } - } - - /* - uint32_t process_data_Err = 0; - uint32_t adc_data_size = ready_cnt; - X502_Raw_User_Data_Parser(inp_buff, inp_values_N, - adc_data, adc_chans_N, adc_readouts_N, - &LFSM_res_tmp, &LFSM_res, - &FFT_res_tmp, &FFT_res); - //process_data_Err = X502_ProcessData(hnd, inp_buff, ready_cnt, X502_PROC_FLAGS_VOLT, adc_data, &adc_data_size, NULL, NULL); - uint64_t data_sum = 0; - for (int i = 0; i < ready_cnt; ++i){ - data_sum += inp_buff[i]; - if (i % 1000 == 1){ - //printf(" %e\n", adc_data[i]); - } - } - */ - } - }else if (mode == FLUSH){ - ; - } - //printf("try: %04d, words ready: %06d, receive_error_code: %05d, data_sum: %d \n", data_receive_trys_counter, ready_cnt, recv_Err_code, data_sum); - //} - fclose(logfile_ptr); -} - - @@ -1023,24 +746,6 @@ int main(int argc, char** argv) { - - - -/* - X502_Raw_User_Data_Parser(inp_buff, inp_values_N, - adc_data, adc_chans_N, adc_readouts_N, - &LFSM_res_tmp, &LFSM_res, - &FFT_res_tmp, &FFT_res); - */ -//*/ - -/* - X502_Raw_User_Data_Parser(inp_buff, inp_values_N, - adc_data, adc_chans_N, adc_readouts_N, - user_data, user_data_chans_N, user_data_readouts_N); -*/ - - ////******* Получение списка устройств и выбор, с каким будем работать *****************// hnd = f_dev_select_open(argc, argv); @@ -1107,38 +812,8 @@ int main(int argc, char** argv) { uint32_t BF_cmd_receive_code = 0; - - /*//working executing remote cmd - uint16_t cmd_code = 3; - uint32_t par = 87; - const uint32_t snd_data[] = {1,1,2,2,3,4,5,56,67,23,1}; - uint32_t snd_size = 11; - uint32_t rcv_data[13] = {0,}; - uint32_t rcv_size = 13; - uint32_t tout = 1; - uint32_t recvd_size = 0; -*/ printf("\n\n\n"); - //setup ADC: - - //t_x502_hnd hnd, uint16_t cmd_code, uint32_t cmd_arg, uint8_t verbosity_lvl - //BF_exec_cmd_simple(hnd, L502_BF_CMD_CODE_GET_PARAM, 87, 2); - //BF_exec_cmd_simple(hnd, L502_BF_CMD_CODE_GET_PARAM, 87, 1); - //BF_exec_cmd_simple(hnd, L502_BF_CMD_CODE_GET_PARAM, 87, 0); - - - //BF_exec_cmd_simple(hnd, L502_BF_USR_CMD_CODE_ECHO, 87, 1); - //BF_exec_cmd_simple(hnd, L502_BF_USR_CMD_CODE_DATA_ECHO, 87, 1); - - //BF_exec_cmd_with_arr(t_x502_hnd hnd, uint16_t cmd_code, uint32_t cmd_par, uint32_t* snd_data, uint32_t snd_data_size, uint8_t verbosity_lvl); - - //uint32_t tx_data[] = {0,1,2,3,4,53,4,2,2,1,0}; - //uint32_t tx_data_size = 11; - - //BF_exec_cmd_with_arr(hnd, L502_BF_USR_CMD_CODE_DATA_ECHO, 328, tx_data, tx_data_size, 2); - //BF_exec_cmd_with_arr(hnd, L502_BF_USR_CMD_CODE_DATA_ECHO, 328, tx_data, tx_data_size, 1); - //setup ADC: uint32_t tx_data[] = {0,1,2,3,4,53,4,2,2,1,0}; @@ -1147,20 +822,8 @@ int main(int argc, char** argv) { tx_data[0] = 2000000; //valid values: 2000000, 1500000 Hz //printf("\n"); - //BF_exec_cmd_with_arr(hnd, L502_BF_CMD_CODE_SET_PARAM, L502_BF_PARAM_REF_FREQ_SRC, tx_data, tx_data_size, 2); - - //printf("run tests\n"); - //BF_exec_cmd_simple(hnd, 0x8010, 17, 1); //test SPORT0 - //BF_exec_cmd_simple(hnd, 0x8003U, 0, 1); - //printf("setup ADC\n"); - //BF_exec_cmd_with_arr(hnd, 0x8003U, 0, NULL, 0, 1); //setup ADC. Values in array are configuring functions return codes - - //some delay to allow ADC to acquire some data - - //printf("L502_REGS_IOHARD_OUTSWAP_BFCTL reg:"); - //BF_exec_cmd_simple(hnd, 0x8006, L502_REGS_IOHARD_OUTSWAP_BFCTL, 1); //reaf fpga reg uint32_t streams_enable_Err = 0; streams_enable_Err = X502_StreamsEnable(hnd, X502_STREAM_ADC | X502_STREAM_DIN ); @@ -1253,13 +916,6 @@ int main(int argc, char** argv) { receive_to_file(hnd, logfilename, inp_buff, max_total_words); - //receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE); -/* - data_receive_trys_counter = 100; - max_total_words = 10000; - - receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE); -*/ printf("\n\nget counters of calls of SPORT_RX, SPORT_TX, HDMA_RX, HDMA_TX\n"); BF_exec_cmd_with_arr(hnd, 0x8005U, 100, NULL, 0, 1); @@ -1281,9 +937,6 @@ 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 @@ -1296,12 +949,6 @@ int main(int argc, char** argv) { X502_StreamsStart(hnd); - //BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging - //BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent - - -// printf("waiting a bit...\n"); -// for(uint32_t wait_i = 1e4; wait_i; --wait_i){printf("");} // for(uint32_t wait_i = 1e6; wait_i; --wait_i){;} printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd)); @@ -1326,8 +973,6 @@ int main(int argc, char** argv) { clock_gettime(CLOCK_MONOTONIC, &time_receive_started); receive_to_file(hnd, logfilename, inp_buff, max_total_words); -// receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, FLUSH); - //receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE); clock_gettime(CLOCK_MONOTONIC, &time_receive_ended); @@ -1339,66 +984,6 @@ int main(int argc, char** argv) { printf("\n Receive time: %g, %g sec/value \n", receive_time, receive_time/max_total_words); -// 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); - - - - - - - - -*/ - - @@ -1424,67 +1009,12 @@ int main(int argc, char** argv) { // printf("\n dbg value: "); // BF_exec_cmd_simple(hnd, 0x800A, 10, 1); receive_to_file(hnd, logfilename, inp_buff, max_total_words); - //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); //*/ -/* - while((--data_receive_trys_counter)&& (max_total_words)){ - - ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt); - recv_Err_code = X502_Recv(hnd, inp_buff, ready_cnt, 10); - printf("\n\nget counters of calls of SPORT_RX, SPORT_TX, HDMA_RX, HDMA_TX\n"); - BF_exec_cmd_with_arr(hnd, 0x8005U, 100, NULL, 0, 1); - if (ready_cnt){ - printf("Ready count: %d, Err: %d \n", ready_cnt, ready_cnt_Err); - for (int i = 0; i < ready_cnt; ++i){ - //printf("\nabort value: %d\n", abort_crtl_C); - if (abort_crtl_C){ - break; - } - --max_total_words; - if (max_total_words == 0){ - break; - } - char bin_str_val[9] = {0,}; - uin32_t_to_bin(inp_buff[i], bin_str_val); - printf(" 0x%08X,", inp_buff[i]); - fprintf(logfile_ptr, "0x%08X \n", inp_buff[i]); - //printf(" 0b%s,", bin_str_val); - ++values_in_line; - if (values_in_line == 10){ - printf("\n"); - values_in_line = 0; - } - } - - uint32_t process_data_Err = 0; - uint32_t adc_data_size = ready_cnt; - X502_Raw_User_Data_Parser(inp_buff, inp_values_N, - adc_data, adc_chans_N, adc_readouts_N, - &LFSM_res_tmp, &LFSM_res, - &FFT_res_tmp, &FFT_res); - //process_data_Err = X502_ProcessData(hnd, inp_buff, ready_cnt, X502_PROC_FLAGS_VOLT, adc_data, &adc_data_size, NULL, NULL); - uint64_t data_sum = 0; - for (int i = 0; i < ready_cnt; ++i){ - data_sum += inp_buff[i]; - if (i % 1000 == 1){ - //printf(" %e\n", adc_data[i]); - } - } - - } - //printf("try: %04d, words ready: %06d, receive_error_code: %05d, data_sum: %d \n", data_receive_trys_counter, ready_cnt, recv_Err_code, data_sum); - } - - - */ - - - //fclose(logfile_ptr); printf("\n\nreceive done. Exiting...\n\n\n");