xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/dp_htt.h (revision cd39549564686e1d60a410c477b7c6e9e19791fd)
1 /*
2  * Copyright (c) 2016 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _DP_HTT_H_
20 #define _DP_HTT_H_
21 
22 #include <qdf_types.h>
23 #include <qdf_lock.h>
24 #include <qdf_nbuf.h>
25 #include <htc_api.h>
26 
27 #define HTT_TX_MUTEX_TYPE qdf_spinlock_t
28 
29 #define HTT_TX_MUTEX_INIT(_mutex)				\
30 	qdf_spinlock_create(_mutex)
31 
32 #define HTT_TX_MUTEX_ACQUIRE(_mutex)			\
33 	qdf_spin_lock_bh(_mutex)
34 
35 #define HTT_TX_MUTEX_RELEASE(_mutex)			\
36 	qdf_spin_unlock_bh(_mutex)
37 
38 #define HTT_TX_MUTEX_DESTROY(_mutex)			\
39 	qdf_spinlock_destroy(_mutex)
40 
41 #define DP_HTT_MAX_SEND_QUEUE_DEPTH 64
42 
43 #ifndef HTT_MAC_ADDR_LEN
44 #define HTT_MAC_ADDR_LEN 6
45 #endif
46 
47 struct dp_htt_htc_pkt {
48 	void *soc_ctxt;
49 	qdf_dma_addr_t nbuf_paddr;
50 	HTC_PACKET htc_pkt;
51 };
52 
53 struct dp_htt_htc_pkt_union {
54 	union {
55 		struct dp_htt_htc_pkt pkt;
56 		struct dp_htt_htc_pkt_union *next;
57 	} u;
58 };
59 
60 struct htt_soc {
61 	void *osif_soc;
62 	void *dp_soc;
63 	void *hal_soc;
64 	HTC_HANDLE htc_soc;
65 	qdf_device_t osdev;
66 	HTC_ENDPOINT_ID htc_endpoint;
67 	struct dp_htt_htc_pkt_union *htt_htc_pkt_freelist;
68 	struct {
69 		u_int8_t major;
70 		u_int8_t minor;
71 	} tgt_ver;
72 	struct {
73 		u_int8_t major;
74 		u_int8_t minor;
75 	} wifi_ip_ver;
76 
77 	struct {
78 		int htc_err_cnt;
79 	} stats;
80 
81 	HTT_TX_MUTEX_TYPE htt_tx_mutex;
82 };
83 
84 void *
85 htt_soc_attach(void *txrx_soc, void *osif_soc, HTC_HANDLE htc_soc,
86 	void *hal_soc, qdf_device_t osdev);
87 
88 void htt_soc_detach(void *soc);
89 
90 int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
91 	int hal_ring_type);
92 
93 int htt_soc_attach_target(void *htt_soc);
94 
95 #endif /* _DP_HTT_H_ */
96