1 /****************************************************************************** 2 * @file UDMA.h 3 ******************************************************************************* 4 * # License 5 * <b>Copyright 2023,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 #ifndef __UDMA_H__ 31 #define __UDMA_H__ 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include "rsi_ccp_common.h" 38 #include "Driver_Common.h" 39 #include "rsi_udma.h" 40 41 #define UDMA_EVENT_XFER_DONE (1) 42 #define UDMA_EVENT_ERROR (2) 43 44 void IRQ033_Handler (void); 45 void IRQ010_Handler (void); 46 #if defined(DAC_FIFO_MODE_EN) || defined(ADC_MULTICHANNEL_WITH_EXT_DMA) 47 #define DAC_UDMA_CHANNEL 10 48 #define ADC_UDMA_CHANNEL 11 49 #endif 50 51 /* UDMA Resource Configuration */ 52 typedef struct 53 { 54 UDMA0_Type *reg; // UDMA register interface 55 IRQn_Type udma_irq_num; // UDMA Event IRQ Numbe 56 RSI_UDMA_DESC_T *desc; // Run-Time control information 57 } UDMA_RESOURCES; 58 59 /* Number of UDMA channels */ 60 #define UDMA_NUMBER_OF_CHANNELS ((uint8_t) 32) 61 #define ULP_UDMA_NUMBER_OF_CHANNELS ((uint8_t) 12) 62 63 64 #define CONTROL_STRUCT0 (UDMA_NUMBER_OF_CHANNELS * 2) 65 #define CONTROL_STRUCT1 (ULP_UDMA_NUMBER_OF_CHANNELS * 2) 66 67 /** 68 * @fn void UDMA_SignalEvent_t (uint32_t event) 69 * @brief Signal UDMA Events. 70 * @param[in] event UDMA Event mask 71 * @param[in] ch Channel no 72 * @return none 73 */ 74 typedef void (*UDMA_SignalEvent_t) (uint32_t event, uint32_t ch); 75 76 77 /** 78 \brief Access structure of the UDMA Driver. 79 */ 80 typedef struct _RSI_DRIVER_UDMA { 81 82 int32_t (*Initialize) ( void ); 83 int32_t (*Uninitialize) ( void ); 84 int32_t (*ChannelConfigure)( uint8_t ch, 85 uint32_t src_addr, 86 uint32_t dest_addr, 87 uint32_t size, 88 RSI_UDMA_CHA_CONFIG_DATA_T control, 89 RSI_UDMA_CHA_CFG_T *config, 90 UDMA_SignalEvent_t cb_event ); 91 int32_t (*ChannelEnable) ( uint8_t ch ); 92 int32_t (*ChannelDisable) ( uint8_t ch ); 93 uint32_t (*ChannelGetCount) ( uint8_t ch, 94 RSI_UDMA_CHA_CONFIG_DATA_T control, 95 RSI_UDMA_CHA_CFG_T config ); 96 int32_t (*DMAEnable) ( void ); 97 } const RSI_DRIVER_UDMA; 98 99 #ifdef __cplusplus 100 } 101 #endif 102 #endif // __UDMA_H__ 103 104 105