/***********************************************************************//** * @file : lpc17xx_gpdma.h * @brief : Contains all macro definitions and function prototypes * support for GPDMA firmware library on LPC17xx * @version : 1.0 * @date : 20. Apr. 2009 * @author : HieuNguyen ************************************************************************** * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * products. This software is supplied "AS IS" without any warranties. * NXP Semiconductors assumes no responsibility or liability for the * use of the software, conveys no license or title under any patent, * copyright, or mask work right to the product. NXP Semiconductors * reserves the right to make changes in the software without * notification. NXP Semiconductors also make no representation or * warranty that such application will be suitable for the specified * use without further testing or modification. **************************************************************************/ /* Peripheral group ----------------------------------------------------------- */ /** @defgroup GPDMA * @ingroup LPC1700CMSIS_FwLib_Drivers * @{ */ #ifndef LPC17XX_GPDMA_H_ #define LPC17XX_GPDMA_H_ /* Includes ------------------------------------------------------------------- */ #include "LPC17xx.h" #include "lpc_types.h" #ifdef __cplusplus extern "C" { #endif /* Private Macros ------------------------------------------------------------- */ /** @defgroup GPDMA_Private_Macros * @{ */ /** @defgroup DMA_REGISTER_BIT_DEFINITIONS * @{ */ /** Macros define for DMA interrupt */ /** DMA Interrupt Status register */ #define GPDMA_DMACIntStat_Ch(n) (((1UL<=0) && (n<=7)) /** DMA Connection number definitions */ #define GPDMA_CONN_SSP0_Tx ((0UL)) /**< SSP0 Tx */ #define GPDMA_CONN_SSP0_Rx ((1UL)) /**< SSP0 Rx */ #define GPDMA_CONN_SSP1_Tx ((2UL)) /**< SSP1 Tx */ #define GPDMA_CONN_SSP1_Rx ((3UL)) /**< SSP1 Rx */ #define GPDMA_CONN_ADC ((4UL)) /**< ADC */ #define GPDMA_CONN_I2S_Channel_0 ((5UL)) /**< I2S channel 0 */ #define GPDMA_CONN_I2S_Channel_1 ((6UL)) /**< I2S channel 1 */ #define GPDMA_CONN_DAC ((7UL)) /**< DAC */ #define GPDMA_CONN_UART0_Tx ((8UL)) /**< UART0 Tx */ #define GPDMA_CONN_UART0_Rx ((9UL)) /**< UART0 Rx */ #define GPDMA_CONN_UART1_Tx ((10UL)) /**< UART1 Tx */ #define GPDMA_CONN_UART1_Rx ((11UL)) /**< UART1 Rx */ #define GPDMA_CONN_UART2_Tx ((12UL)) /**< UART2 Tx */ #define GPDMA_CONN_UART2_Rx ((13UL)) /**< UART2 Rx */ #define GPDMA_CONN_UART3_Tx ((14UL)) /**< UART3 Tx */ #define GPDMA_CONN_UART3_Rx ((15UL)) /**< UART3 Rx */ #define GPDMA_CONN_MAT0_0 ((16UL)) /**< MAT0.0 */ #define GPDMA_CONN_MAT0_1 ((17UL)) /**< MAT0.1 */ #define GPDMA_CONN_MAT1_0 ((18UL)) /**< MAT1.0 */ #define GPDMA_CONN_MAT1_1 ((19UL)) /**< MAT1.1 */ #define GPDMA_CONN_MAT2_0 ((20UL)) /**< MAT2.0 */ #define GPDMA_CONN_MAT2_1 ((21UL)) /**< MAT2.1 */ #define GPDMA_CONN_MAT3_0 ((22UL)) /**< MAT3.0 */ #define GPDMA_CONN_MAT3_1 ((23UL)) /**< MAT3.1 */ #define PARAM_GPDMA_CONN(n) ((n==GPDMA_CONN_SSP0_Tx) || (n==GPDMA_CONN_SSP0_Rx) \ || (n==GPDMA_CONN_SSP1_Tx) || (n==GPDMA_CONN_SSP1_Rx) \ || (n==GPDMA_CONN_ADC) || (n==GPDMA_CONN_I2S_Channel_0) \ || (n==GPDMA_CONN_I2S_Channel_1) || (n==GPDMA_CONN_DAC) \ || (n==GPDMA_CONN_UART0_Tx) || (n==GPDMA_CONN_UART0_Rx) \ || (n==GPDMA_CONN_UART1_Tx) || (n==GPDMA_CONN_UART1_Rx) \ || (n==GPDMA_CONN_UART2_Tx) || (n==GPDMA_CONN_UART2_Rx) \ || (n==GPDMA_CONN_UART3_Tx) || (n==GPDMA_CONN_UART3_Rx) \ || (n==GPDMA_CONN_MAT0_0) || (n==GPDMA_CONN_MAT0_1) \ || (n==GPDMA_CONN_MAT1_0) || (n==GPDMA_CONN_MAT1_1) \ || (n==GPDMA_CONN_MAT2_0) || (n==GPDMA_CONN_MAT2_1) \ || (n==GPDMA_CONN_MAT3_0) || (n==GPDMA_CONN_MAT3_1)) /** GPDMA Transfer type definitions */ #define GPDMA_TRANSFERTYPE_M2M ((0UL)) /**< Memory to memory - DMA control */ #define GPDMA_TRANSFERTYPE_M2P ((1UL)) /**< Memory to peripheral - DMA control */ #define GPDMA_TRANSFERTYPE_P2M ((2UL)) /**< Peripheral to memory - DMA control */ #define GPDMA_TRANSFERTYPE_P2P ((3UL)) /**< Source peripheral to destination peripheral - DMA control */ #define PARAM_GPDMA_TRANSFERTYPE(n) ((n==GPDMA_TRANSFERTYPE_M2M)||(n==GPDMA_TRANSFERTYPE_M2P) \ ||(n==GPDMA_TRANSFERTYPE_P2M)||(n==GPDMA_TRANSFERTYPE_P2P)) /** Burst size in Source and Destination definitions */ #define GPDMA_BSIZE_1 ((0UL)) /**< Burst size = 1 */ #define GPDMA_BSIZE_4 ((1UL)) /**< Burst size = 4 */ #define GPDMA_BSIZE_8 ((2UL)) /**< Burst size = 8 */ #define GPDMA_BSIZE_16 ((3UL)) /**< Burst size = 16 */ #define GPDMA_BSIZE_32 ((4UL)) /**< Burst size = 32 */ #define GPDMA_BSIZE_64 ((5UL)) /**< Burst size = 64 */ #define GPDMA_BSIZE_128 ((6UL)) /**< Burst size = 128 */ #define GPDMA_BSIZE_256 ((7UL)) /**< Burst size = 256 */ #define PARAM_GPDMA_BSIZE(n) ((n==GPDMA_BSIZE_1) || (n==GPDMA_BSIZE_4) \ || (n==GPDMA_BSIZE_8) || (n==GPDMA_BSIZE_16) \ || (n==GPDMA_BSIZE_32) || (n==GPDMA_BSIZE_64) \ || (n==GPDMA_BSIZE_128) || (n==GPDMA_BSIZE_256)) /** Width in Source transfer width and Destination transfer width definitions */ #define GPDMA_WIDTH_BYTE ((0UL)) /**< Width = 1 byte */ #define GPDMA_WIDTH_HALFWORD ((1UL)) /**< Width = 2 bytes */ #define GPDMA_WIDTH_WORD ((2UL)) /**< Width = 4 bytes */ #define PARAM_GPDMA_WIDTH(n) ((n==GPDMA_WIDTH_BYTE) || (n==GPDMA_WIDTH_HALFWORD) \ || (n==GPDMA_WIDTH_WORD)) /** DMA Request Select Mode definitions */ #define GPDMA_REQSEL_UART ((0UL)) /**< UART TX/RX is selected */ #define GPDMA_REQSEL_TIMER ((1UL)) /**< Timer match is selected */ #define PARAM_GPDMA_REQSEL(n) ((n==GPDMA_REQSEL_UART) || (n==GPDMA_REQSEL_TIMER)) /** GPDMA Status type definitions */ /** GPDMA Interrupt Status */ #define GPDMA_STAT_INT ((0UL)) /** GPDMA Interrupt Terminal Count Request Status */ #define GPDMA_STAT_INTTC ((1UL)) /** GPDMA Interrupt Error Status */ #define GPDMA_STAT_INTERR ((2UL)) /** GPDMA Raw Interrupt Terminal Count Status */ #define GPDMA_STAT_RAWINTTC ((3UL)) /** GPDMA Raw Error Interrupt Status */ #define GPDMA_STAT_RAWINTERR ((4UL)) /** DMA Enabled Channel Status */ #define GPDMA_STAT_ENABLED_CH ((5UL)) #define PARAM_GPDMA_STAT(n) ((n==GPDMA_STAT_INT) || (n==GPDMA_STAT_INTTC) \ || (n==GPDMA_STAT_INTERR) || (n==GPDMA_STAT_RAWINTTC) \ || (n==GPDMA_STAT_RAWINTERR) || (n==GPDMA_STAT_ENABLED_CH)) /** GPDMA status type definition that can be clear */ /** GPDMA Interrupt Terminal Count Request Clear */ #define GPDMA_STATCLR_INTTC ((0UL)) /** GPDMA Interrupt Error Clear */ #define GPDMA_STATCLR_INTERR ((1UL)) #define GPDMA_STATCLR(n) ((n==GPDMA_STATCLR_INTTC) || (n==GPDMA_STATCLR_INTERR)) /** * @} */ /* Public Functions ----------------------------------------------------------- */ /** @defgroup GPDMA_Public_Functions * @{ */ void GPDMA_Init(void); Status GPDMA_Setup(GPDMA_Channel_CFG_Type *GPDMAChannelConfig, fnGPDMACbs_Type *pfnGPDMACbs); void GPDMA_ChannelCmd(uint8_t channelNum, FunctionalState NewState); void GPDMA_IntHandler(void); /** * @} */ #ifdef __cplusplus } #endif #endif /* LPC17XX_GPDMA_H_ */ /** * @} */ /* --------------------------------- End Of File ------------------------------ */