added time measurement of HDMA receive
This commit is contained in:
BIN
BF_companion
BIN
BF_companion
Binary file not shown.
54
main.c
54
main.c
@ -68,7 +68,10 @@
|
|||||||
#include "l502_fpga_regs.h"
|
#include "l502_fpga_regs.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DUMP_TO_FILE,
|
||||||
|
FLUSH,
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
unknown = 0x00,
|
unknown = 0x00,
|
||||||
@ -794,7 +797,7 @@ uint32_t X502_FlushRcv_buff(t_x502_hnd hnd){
|
|||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
void receive_data(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, int data_receive_trys_counter, uint32_t max_total_words){
|
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;
|
//int data_receive_trys_counter = 100;
|
||||||
//uint32_t max_total_words = 10000;
|
//uint32_t max_total_words = 10000;
|
||||||
uint32_t ready_cnt_Err = 0;
|
uint32_t ready_cnt_Err = 0;
|
||||||
@ -812,10 +815,11 @@ void receive_data(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, int dat
|
|||||||
|
|
||||||
ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt);
|
ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt);
|
||||||
recv_Err_code = X502_Recv(hnd, inp_buff, ready_cnt, 10);
|
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");
|
//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);
|
//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");
|
//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);
|
//BF_exec_cmd_simple(hnd, 0x8009, 10, 1);
|
||||||
|
if (mode == DUMP_TO_FILE){
|
||||||
if (ready_cnt){
|
if (ready_cnt){
|
||||||
printf("Ready count: %d, Err: %d \n", ready_cnt, ready_cnt_Err);
|
printf("Ready count: %d, Err: %d \n", ready_cnt, ready_cnt_Err);
|
||||||
for (int i = 0; i < ready_cnt; ++i){
|
for (int i = 0; i < ready_cnt; ++i){
|
||||||
@ -856,6 +860,9 @@ void receive_data(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, int dat
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
}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);
|
//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);
|
fclose(logfile_ptr);
|
||||||
@ -1144,12 +1151,12 @@ int main(int argc, char** argv) {
|
|||||||
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
|
||||||
|
|
||||||
|
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
|
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
|
||||||
/*
|
/*
|
||||||
data_receive_trys_counter = 100;
|
data_receive_trys_counter = 100;
|
||||||
max_total_words = 10000;
|
max_total_words = 10000;
|
||||||
|
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
|
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -1160,8 +1167,9 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// X502_StreamsStop(hnd);
|
// X502_StreamsStop(hnd);
|
||||||
// X502_StreamsStart(hnd);
|
// X502_StreamsStart(hnd);
|
||||||
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
|
//BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
|
||||||
// BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
|
BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
|
||||||
|
//BF_exec_cmd_simple(hnd, 0x800B, 2, 1); //start HDMA flood for speedtest
|
||||||
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
|
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
|
||||||
|
|
||||||
|
|
||||||
@ -1177,12 +1185,26 @@ int main(int argc, char** argv) {
|
|||||||
data_receive_trys_counter = 100;
|
data_receive_trys_counter = 100;
|
||||||
max_total_words = 100000;
|
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)
|
// 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);
|
||||||
|
|
||||||
|
struct timespec time_receive_started, time_receive_ended;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &time_receive_started);
|
||||||
|
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, FLUSH);
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &time_receive_ended);
|
||||||
|
|
||||||
|
|
||||||
|
double receive_time = (time_receive_ended.tv_sec - time_receive_started.tv_sec);
|
||||||
|
receive_time += time_receive_ended.tv_nsec*1e-9;
|
||||||
|
receive_time += time_receive_started.tv_nsec*1e-9;
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
|
||||||
|
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
|
|
||||||
printf("\n dbg value: ");
|
printf("\n dbg value: ");
|
||||||
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
|
|
||||||
@ -1198,7 +1220,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
printf("\n dbg value: ");
|
printf("\n dbg value: ");
|
||||||
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
|
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
|
||||||
printf("\n dbg value: ");
|
printf("\n dbg value: ");
|
||||||
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
|
|
||||||
@ -1214,7 +1236,7 @@ int main(int argc, char** argv) {
|
|||||||
printf("\n dbg value: ");
|
printf("\n dbg value: ");
|
||||||
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
|
|
||||||
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
|
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words, DUMP_TO_FILE);
|
||||||
printf("\n dbg value: ");
|
printf("\n dbg value: ");
|
||||||
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user