1 /*
2  * ==========================================================
3  *
4  *    Copyright (C) 2020 QuickLogic Corporation
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  * 		http://www.apache.org/licenses/LICENSE-2.0
9  *    Unless required by applicable law or agreed to in writing, software
10  *    distributed under the License is distributed on an "AS IS" BASIS,
11  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  *    See the License for the specific language governing permissions and
13  *    limitations under the License.
14  *
15  *    File      : eoss3_hal_sdma.h
16  *    Purpose   :
17  *
18  *
19  * ===========================================================
20  *
21  */
22 
23 #ifndef __EOSS3_HAL_SDMA_H_
24 #define __EOSS3_HAL_SDMA_H_
25 #include "test_types.h"
26 #include "eoss3_hal_def.h"
27 typedef enum
28 {
29     SDMA_XFER_INVALID = 0,
30     SDMA_XFER_BYTE,
31     SDMA_XFER_HWORD,
32     SDMA_XFER_WORD
33 } SDMA_XFER_FORMAT;
34 
35 /*!
36  * @brief Supported HAL SDMA Address location width sizes
37  */
38 typedef enum
39 {
40     SDMA_ADDR_WIDTH_BYTE,
41     SDMA_ADDR_WIDTH_HWORD,
42     SDMA_ADDR_WIDTH_WORD,
43     SDMA_ADDR_WIDTH_NOINC
44 } SDMA_ADDR_WIDTH;
45 
46 /**
47   * @brief SDMA Channel properties structure
48   */
49 typedef struct
50 {
51    SDMA_XFER_FORMAT data_size;   /* source and destination should have same data size */
52    SDMA_ADDR_WIDTH  src_addr_inc;
53    SDMA_ADDR_WIDTH  dest_addr_inc;
54    uint32_t         rpowerCode;
55 } SDMA_ch_cfg_t;
56 
57 HAL_StatusTypeDef HAL_SDMA_Init(void);
58 //32 bit transfer
59 HAL_StatusTypeDef HAL_SDMA_xferWord(int chan, uint32_t * srcptr, uint32_t *dstptr, int wordLen);
60 HAL_StatusTypeDef HAL_SDMA_xfer(int chan, uint32_t * srcptr, uint32_t *dstptr, int wordLen, SDMA_ch_cfg_t *chCfg);
61 HAL_StatusTypeDef HAL_SDMA_Register_FPGA_DmaChan_Comp_Notifier(void (*comp_notifier)(void*));
62 HAL_StatusTypeDef HAL_SDMA_Reg_CB(int channel_number, void (*triggerSdma)(int chan),  void (*comp_notifier)(int chan));
63 
64 
65 #endif /* __EOSS3_HAL_SDMA_H_ */
66