1 /*
2  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
3  *
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _ADMA_H_
21 #define _ADMA_H_
22 
23 #include "hif_sdio_dev.h"
24 #include "htc_packet.h"
25 #include "htc_api.h"
26 #include "hif_internal.h"
27 
28 /* This should align with the underlying transport layer */
29 #define HIF_DEFAULT_IO_BLOCK_SIZE    512
30 #define HIF_BLOCK_SIZE               HIF_DEFAULT_IO_BLOCK_SIZE
31 #define HIF_DUMMY_SPACE_MASK         0x0FFFFFFF
32 
33 #define HIF_SDIO_MAX_AL_CHANNELS     2
34 
35 struct devRegisters {
36 	uint32_t dummy;
37 };
38 
39 #include "transfer.h"
40 #define DEV_REGISTERS_SIZE           sizeof(struct devRegisters)
41 
42 uint8_t hif_dev_map_adma_chan_to_pipe(struct hif_sdio_device *pdev,
43 				      uint8_t chan, bool upload);
44 
45 struct sdio_al_channel_handle *hif_dev_map_pipe_to_adma_chan
46 (
47 struct hif_sdio_device *pdev,
48 uint8_t pipeid
49 );
50 
51 void dl_xfer_cb(struct sdio_al_channel_handle *ch_handle,
52 		struct sdio_al_xfer_result *result,
53 		void *ctx);
54 void ul_xfer_cb(struct sdio_al_channel_handle *ch_handle,
55 		struct sdio_al_xfer_result *result,
56 		void *ctx);
57 
58 void dl_data_avail_cb(struct sdio_al_channel_handle *ch_handle,
59 		      unsigned int len);
60 
61 void hif_sdio_rx_q_alloc(void *ctx);
62 #endif
63