1 /*******************************************************************************
2 * @file  rsi_udma_wrapper.h
3  *******************************************************************************
4  * # License
5  * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
6  *******************************************************************************
7  *
8  * SPDX-License-Identifier: Zlib
9  *
10  * The licensor of this software is Silicon Laboratories Inc.
11  *
12  * This software is provided 'as-is', without any express or implied
13  * warranty. In no event will the authors be held liable for any damages
14  * arising from the use of this software.
15  *
16  * Permission is granted to anyone to use this software for any purpose,
17  * including commercial applications, and to alter it and redistribute it
18  * freely, subject to the following restrictions:
19  *
20  * 1. The origin of this software must not be misrepresented; you must not
21  *    claim that you wrote the original software. If you use this software
22  *    in a product, an acknowledgment in the product documentation would be
23  *    appreciated but is not required.
24  * 2. Altered source versions must be plainly marked as such, and must not be
25  *    misrepresented as being the original software.
26  * 3. This notice may not be removed or altered from any source distribution.
27  *
28  ******************************************************************************/
29 /**===========================================================================
30  * @brief This files contains functions prototypes releated to UDMA peripheral
31  * @section Description :
32  * This file contains the list of function prototypes for the UDMA and low level function definations
33  * Following are list of API's which need to be defined in this file.
34 ============================================================================**/
35 // Include Files
36 
37 #include "rsi_ccp_common.h"
38 #include "rsi_error.h"
39 #include "rsi_packing.h"
40 #include "UDMA.h"
41 
42 #ifndef RSI_UDMA_WRAPPER_H
43 #define RSI_UDMA_WRAPPER_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #ifndef UNUSED_PARAMETER
50 #define UNUSED_PARAMETER(x) (void)(x)
51 #endif // UNUSED_PARAMETER
52 
53 typedef struct {
54   uint32_t SrcAddr;
55   uint32_t DestAddr;
56   uint32_t Size;
57   uint32_t Cnt;
58   UDMA_SignalEvent_t cb_event;
59 } UDMA_Channel_Info;
60 
61 RSI_UDMA_HANDLE_T uDMAx_Initialize(const UDMA_RESOURCES *udma,
62                                    RSI_UDMA_DESC_T *UDMA_Table,
63                                    RSI_UDMA_HANDLE_T udmaHandle,
64                                    uint32_t *mem);
65 int32_t uDMAx_Uninitialize(const UDMA_RESOURCES *udma);
66 int32_t uDMAx_ChannelConfigure(const UDMA_RESOURCES *udma,
67                                uint8_t ch,
68                                uint32_t src_addr,
69                                uint32_t dest_addr,
70                                uint32_t size,
71                                RSI_UDMA_CHA_CONFIG_DATA_T control,
72                                const RSI_UDMA_CHA_CFG_T *config,
73                                UDMA_SignalEvent_t cb_event,
74                                UDMA_Channel_Info *chnl_info,
75                                RSI_UDMA_HANDLE_T udmaHandle);
76 int32_t uDMAx_ChannelEnable(uint8_t ch, const UDMA_RESOURCES *udma, RSI_UDMA_HANDLE_T udmaHandle);
77 int32_t uDMAx_DMAEnable(const UDMA_RESOURCES *udma, RSI_UDMA_HANDLE_T udmaHandle);
78 int32_t uDMAx_ChannelDisable(uint8_t ch, const UDMA_RESOURCES *udma, RSI_UDMA_HANDLE_T udmaHandle);
79 uint32_t uDMAx_ChannelGetCount(uint8_t ch,
80                                RSI_UDMA_CHA_CONFIG_DATA_T control,
81                                RSI_UDMA_CHA_CFG_T config,
82                                const UDMA_RESOURCES *udma,
83                                RSI_UDMA_HANDLE_T udmaHandle);
84 void uDMAx_IRQHandler(UDMA_RESOURCES *udma, RSI_UDMA_DESC_T *UDMA_Table, UDMA_Channel_Info *chnl_info);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif // RSI_UDMA_WRAPPER_H
91