void dma_channel_test(){ int ch0 = -1; int ch1 = -1; int ch2 = -1; int ch3 = -1; int ch4 = -1; int ch5 = -1; int ch6 = -1; int ch7 = -1; int ch8 = -1; ch0 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART0_Tx); ch1 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART0_Rx); ch2 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART2_Tx); ch3 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART2_Rx); ch4 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART3_Tx); ch5 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART3_Rx); ch6 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART1_Rx); ch7 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_UART1_Tx); ch8 = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_SSP1_Rx); } |
/** * @briefGet a free GPDMA channel for one DMA connection * @parampGPDMA: The base of GPDMA on the chip * @paramPeripheralConnection_ID: Some chip fix each peripheral DMA connection on a specified channel ( have not used in 17xx/40xx ) * @returnThe channel number which is selected */ uint8_t Chip_GPDMA_GetFreeChannel(LPC_GPDMA_T *pGPDMA, uint32_t PeripheralConnection_ID); |
/* Get a free GPDMA channel for one DMA connection */ uint8_t Chip_GPDMA_GetFreeChannel(LPC_GPDMA_T *pGPDMA, uint32_t PeripheralConnection_ID) { uint8_t temp = 0; for (temp = 0; temp < GPDMA_NUMBER_CHANNELS; temp++) { if (!Chip_GPDMA_IntGetStatus(pGPDMA, GPDMA_STAT_ENABLED_CH, temp) && (ChannelHandlerArray[temp].ChannelStatus == DISABLE)) { ChannelHandlerArray[temp].ChannelStatus = ENABLE; return temp; } } return 0; } |