/* This function is used to Wait until DMA operation completes.  */
int tls_dma_wait_complt(unsigned char ch)
/* This function is used to Wait until DMA operation completes.  */
int tls_dma_wait_complt(unsigned char ch)
{
	unsigned long timeout = 0;
	while(DMA_CHNLCTRL_REG(ch) & DMA_CHNL_CTRL_CHNL_ON) 
	{
		tls_os_time_delay(1);
		timeout ++;
		if(timeout > 500)
			return -1;
	}
	return 0;
}