Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | #ifndef __HAL_BTIFD_DMA_PUB_H_ |
2 | #define __HAL_BTIFD_DMA_PUB_H_ | |
3 | ||
4 | #include <linux/dma-mapping.h> | |
5 | ||
6 | #include "hal_pub.h" | |
7 | ||
8 | typedef enum _ENUM_DMA_CTRL_ { | |
9 | DMA_CTRL_DISABLE = 0, | |
10 | DMA_CTRL_ENABLE = DMA_CTRL_DISABLE + 1, | |
11 | DMA_CTRL_BOTH, | |
12 | } ENUM_DMA_CTRL; | |
13 | ||
14 | /***************************************************************************** | |
15 | * FUNCTION | |
16 | * hal_tx_dma_info_get | |
17 | * DESCRIPTION | |
18 | * get btif tx dma channel's information | |
19 | * PARAMETERS | |
20 | * dma_dir [IN] DMA's direction | |
21 | * RETURNS | |
22 | * pointer to btif dma's information structure | |
23 | *****************************************************************************/ | |
24 | P_MTK_DMA_INFO_STR hal_btif_dma_info_get(ENUM_DMA_DIR dma_dir); | |
25 | ||
26 | /***************************************************************************** | |
27 | * FUNCTION | |
28 | * hal_btif_dma_hw_init | |
29 | * DESCRIPTION | |
30 | * control clock output enable/disable of DMA module | |
31 | * PARAMETERS | |
32 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
33 | * RETURNS | |
34 | * 0 means success, negative means fail | |
35 | *****************************************************************************/ | |
36 | int hal_btif_dma_hw_init(P_MTK_DMA_INFO_STR p_dma_info); | |
37 | ||
38 | /***************************************************************************** | |
39 | * FUNCTION | |
40 | * hal_btif_clk_ctrl | |
41 | * DESCRIPTION | |
42 | * control clock output enable/disable of DMA module | |
43 | * PARAMETERS | |
44 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
45 | * RETURNS | |
46 | * 0 means success, negative means fail | |
47 | *****************************************************************************/ | |
48 | int hal_btif_dma_clk_ctrl(P_MTK_DMA_INFO_STR p_dma_info, ENUM_CLOCK_CTRL flag); | |
49 | ||
50 | /***************************************************************************** | |
51 | * FUNCTION | |
52 | * hal_tx_dma_ctrl | |
53 | * DESCRIPTION | |
54 | * enable/disable Tx DMA channel | |
55 | * PARAMETERS | |
56 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
57 | * ctrl_id [IN] enable/disable ID | |
58 | * dma_dir [IN] DMA's direction | |
59 | * RETURNS | |
60 | * 0 means success; negative means fail | |
61 | *****************************************************************************/ | |
62 | int hal_btif_dma_ctrl(P_MTK_DMA_INFO_STR p_dma_info, ENUM_DMA_CTRL ctrl_id); | |
63 | ||
64 | /***************************************************************************** | |
65 | * FUNCTION | |
66 | * hal_btif_dma_rx_cb_reg | |
67 | * DESCRIPTION | |
68 | * register rx callback function to dma module | |
69 | * PARAMETERS | |
70 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
71 | * rx_cb [IN] function pointer to btif | |
72 | * RETURNS | |
73 | * 0 means success; negative means fail | |
74 | *****************************************************************************/ | |
75 | int hal_btif_dma_rx_cb_reg(P_MTK_DMA_INFO_STR p_dma_info, | |
76 | dma_rx_buf_write rx_cb); | |
77 | ||
78 | /***************************************************************************** | |
79 | * FUNCTION | |
80 | * hal_tx_vfifo_reset | |
81 | * DESCRIPTION | |
82 | * reset tx virtaul fifo information, except memory information | |
83 | * PARAMETERS | |
84 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
85 | * dma_dir [IN] DMA's direction | |
86 | * RETURNS | |
87 | * 0 means success, negative means fail | |
88 | *****************************************************************************/ | |
89 | int hal_btif_vfifo_reset(P_MTK_DMA_INFO_STR p_dma_info); | |
90 | ||
91 | /***************************************************************************** | |
92 | * FUNCTION | |
93 | * hal_tx_dma_irq_handler | |
94 | * DESCRIPTION | |
95 | * lower level tx interrupt handler | |
96 | * PARAMETERS | |
97 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
98 | * RETURNS | |
99 | * 0 means success, negative means fail | |
100 | *****************************************************************************/ | |
101 | int hal_tx_dma_irq_handler(P_MTK_DMA_INFO_STR p_dma_info); | |
102 | ||
103 | /***************************************************************************** | |
104 | * FUNCTION | |
105 | * hal_dma_send_data | |
106 | * DESCRIPTION | |
107 | * send data through btif in DMA mode | |
108 | * PARAMETERS | |
109 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
110 | * p_buf [IN] pointer to rx data buffer | |
111 | * max_len [IN] tx buffer length | |
112 | * RETURNS | |
113 | * 0 means success, negative means fail | |
114 | *****************************************************************************/ | |
115 | int hal_dma_send_data(P_MTK_DMA_INFO_STR p_dma_info, | |
116 | const unsigned char *p_buf, const unsigned int buf_len); | |
117 | ||
118 | /***************************************************************************** | |
119 | * FUNCTION | |
120 | * hal_dma_is_tx_complete | |
121 | * DESCRIPTION | |
122 | * get tx complete flag | |
123 | * PARAMETERS | |
124 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
125 | * RETURNS | |
126 | * true means tx complete, false means tx in process | |
127 | *****************************************************************************/ | |
128 | bool hal_dma_is_tx_complete(P_MTK_DMA_INFO_STR p_dma_info); | |
129 | ||
130 | /***************************************************************************** | |
131 | * FUNCTION | |
132 | * hal_dma_get_ava_room | |
133 | * DESCRIPTION | |
134 | * get tx available room | |
135 | * PARAMETERS | |
136 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
137 | * RETURNS | |
138 | * available room size | |
139 | *****************************************************************************/ | |
140 | int hal_dma_get_ava_room(P_MTK_DMA_INFO_STR p_dma_info); | |
141 | ||
142 | /***************************************************************************** | |
143 | * FUNCTION | |
144 | * hal_dma_is_tx_allow | |
145 | * DESCRIPTION | |
146 | * is tx operation allowed by DMA | |
147 | * PARAMETERS | |
148 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
149 | * RETURNS | |
150 | * true if tx operation is allowed; false if tx is not allowed | |
151 | *****************************************************************************/ | |
152 | bool hal_dma_is_tx_allow(P_MTK_DMA_INFO_STR p_dma_info); | |
153 | ||
154 | /***************************************************************************** | |
155 | * FUNCTION | |
156 | * hal_rx_dma_irq_handler | |
157 | * DESCRIPTION | |
158 | * lower level rx interrupt handler | |
159 | * PARAMETERS | |
160 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
161 | * p_buf [IN/OUT] pointer to rx data buffer | |
162 | * max_len [IN] max length of rx buffer | |
163 | * RETURNS | |
164 | * 0 means success, negative means fail | |
165 | *****************************************************************************/ | |
166 | int hal_rx_dma_irq_handler(P_MTK_DMA_INFO_STR p_dma_info, | |
167 | unsigned char *p_buf, const unsigned int max_len); | |
168 | ||
169 | /***************************************************************************** | |
170 | * FUNCTION | |
171 | * hal_dma_dump_reg | |
172 | * DESCRIPTION | |
173 | * dump BTIF module's information when needed | |
174 | * PARAMETERS | |
175 | * p_dma_info [IN] pointer to BTIF dma channel's information | |
176 | * flag [IN] register id flag | |
177 | * RETURNS | |
178 | * 0 means success, negative means fail | |
179 | *****************************************************************************/ | |
180 | int hal_dma_dump_reg(P_MTK_DMA_INFO_STR p_dma_info, ENUM_BTIF_REG_ID flag); | |
181 | ||
182 | int hal_dma_pm_ops(P_MTK_DMA_INFO_STR p_dma_info, MTK_BTIF_PM_OPID opid); | |
183 | ||
184 | #endif /*__HAL_BTIFD_DMA_PUB_H_*/ |