aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/eemcs/lte_dev_test_lib.h
blob: c119d3cd54c8a42d5163c2a3220596dceda65c7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef __SDIOAT_LIB_H__
#define __SDIOAT_LIB_H__


#ifdef MTK_TEST_LIB
#define AUTOEXT
#else 
#define AUTOEXT  extern
#endif


#define SEND_ERR_RETRY	10000
#define SEND_ERR_TIMEOUT	1000


typedef struct _attest_option{
    bool    show_dl_content;
    bool    exam_dl_content;

    bool    auto_receive_pkt;
}attest_option_t;


/*the information to re-assemble the fragment packets*/
typedef struct _recv_fragment_ctrl{
	unsigned int expected_xfer_len;
	unsigned int xfered_len;
	unsigned int xfered_pkt_idx;
	unsigned int max_frag_unit_sz;
	AT_PKT_HEADER pkt_head;
	unsigned char next_expected_char;
}recv_fragment_ctrl_t;

typedef enum _tx_basic_tst_case {
	ATCASE_UL_BASIC_SEND,
	ATCASE_UL_BASIC_SEND_RAND,
	ATCASE_UL_BASIC_MANY_QUE,
	ATCASE_DL_BASIC_RECV,
}tx_basic_tst_case_e;


typedef enum _lb_data_pattern {
	ATCASE_LB_DATA_5A,
	ATCASE_LB_DATA_A5,
	ATCASE_LB_DATA_INC,
	/*
	 *	@brief	device fragment original auto pattern pakcet into several packets
	*/
	ATCASE_LB_DATA_FRAGMENT,
	ATCASE_LB_DATA_AUTO
}lb_data_pattern_e;

typedef enum _rgpd_allowlen_tst_case {
	ATCASE_2RBD_ALLOW_LEN_CASE1,
	ATCASE_2RBD_ALLOW_LEN_CASE2,
	ATCASE_3RBD_ALLOW_LEN_CASE1,
	ATCASE_3RBD_ALLOW_LEN_CASE2,
	ATCASE_2RBD_ALLOW_LEN_STRESS,
	ATCASE_3RBD_ALLOW_LEN_SLT,
}rgpd_allowlen_tst_case_e;



struct timespec time_diff(struct timespec start , struct timespec end);


void f_calc_cs_byte(void *startingAddr_p, unsigned int lengthToCalculate, unsigned char *checksum_p);

int sdio_send_pkt(int ulq_no,int data_length, unsigned char ul_que, unsigned char dl_que);

int sdio_dl_npkt(athif_dl_tgpd_cfg_t *p_dl_cfg);

int f_compare_recv_pkt(struct sk_buff *dl_skb, unsigned int que_num);

int f_wait_recv_pkt_cnt(unsigned int expect_num , unsigned int timeout_ms);

int f_ul_rgpd_allow_len_tst(unsigned int txq_no ,athif_ul_rgpd_format_t *p_rgpd_format, unsigned int pkt_len_start, unsigned int pkt_len_end);

int sdio_dl_npkt_sp(athif_dl_tgpd_cfg_t *p_dl_cfg);

int f_small_pkt_lb(lb_data_pattern_e pattern);

int f_tx_rx_ep0_perf_lb(unsigned int loop, unsigned int offset, unsigned int pkt_md,
	unsigned int q_md, unsigned int pkt_len, perf_tst_case_e lb_md);

int f_rx_perf_tst(unsigned int loop, unsigned int offset, unsigned int pkt_num,
	unsigned int q_md, unsigned int pkt_len, perf_tst_case_e lb_md);

int f_ul_cs_err_tst(unsigned int cs_len, unsigned int is_bd);

int f_dl_cs_err_tst(unsigned int cs_len, unsigned int is_bd);

int tx_perf_hw_limit(unsigned int loop, unsigned int offset, unsigned int pkt_md,
	unsigned int q_md, unsigned int pkt_len, perf_tst_case_e lb_md);

int f_brom_pkt_lb(lb_data_pattern_e pattern, unsigned int min_size, unsigned int max_size);



/* ************************************ */
/*   Funciton below is not complete porting yet  */
/* ************************************ */
int sdio_dl_n_rand_pkt(unsigned int pkt_num , unsigned int que_num);
int sdio_dl_n_rand_stress(unsigned int pkt_num, unsigned int que_num);



#endif