4 #include <linux/wakelock.h>
5 #include <linux/dmapool.h>
7 #define LOOP_BACK // loop back, or gen Rx data
10 #define STATISTIC // statistic data gathering for performance debug
12 //#define NO_RX_Q_LOCK // check comment in md_ut_rxq_process
13 #define NO_RX_Q_LOCK_IN_TX // check comment in md_ut_txq_process
16 #define MD_UT_MAJOR 169
17 #define MAX_QUEUE_LENGTH 32
18 #define QUEUE_BUDGET 16
21 HIF_EX_INIT
= 0, // interrupt
23 HIF_EX_INIT_DONE
, // polling
24 HIF_EX_CLEARQ_DONE
, //interrupt
25 HIF_EX_CLEARQ_ACK
, // AP->MD
26 HIF_EX_ALLQ_RESET
, // polling
32 struct ccci_modem
*modem
;
34 struct list_head req_list
;
38 wait_queue_head_t req_wq
;
39 // now only for Tx, Rx won't wait, just drop
42 unsigned int process_count
; // write or dispatch operation
43 unsigned int not_complet_count
; // have to wait due to list full
44 unsigned int data_count
; // packet size accumulation
49 struct md_ut_queue txq
[3];
50 struct md_ut_queue rxq
[3];
51 wait_queue_head_t sched_thread_wq
;
52 unsigned char sched_thread_kick
;
53 atomic_t reset_on_going
;
54 struct wake_lock trm_wake_lock
;
56 struct task_struct
*sched_thread
;
57 struct timer_list rx_gen_timer
;
59 struct timer_list statistic_timer
;
63 #define QUEUE_LEN(a) (sizeof(a)/sizeof(struct md_ut_queue))
65 static void inline md_ut_queue_struct_init(struct md_ut_queue
*queue
, struct ccci_modem
*md
,
66 DIRECTION dir
, unsigned char index
,
73 INIT_LIST_HEAD(&queue
->req_list
);
74 init_waitqueue_head(&queue
->req_wq
);
75 spin_lock_init(&queue
->req_lock
);
76 queue
->length_th
= th
;
80 queue
->process_count
= 0;
81 queue
->not_complet_count
= 0;
85 #endif //__MODEM_UT_H__