/* This function is used to Start the DMA controller.  */
unsigned char tls_dma_start(unsigned char ch, struct tls_dma_descriptor *dma_desc, unsigned char auto_reload)
/* This function is used to Start the DMA controller.  */
unsigned char tls_dma_start(unsigned char ch, struct tls_dma_descriptor *dma_desc, unsigned char auto_reload)
{
	if((ch > 7) && !dma_desc) return 1;
	if ((dma_used_bit &(1<<ch)) == 0)
	{
		dma_used_bit |= (1<<ch);
	}
	DMA_SRCADDR_REG(ch) = dma_desc->src_addr;
	DMA_DESTADDR_REG(ch) = dma_desc->dest_addr;
	DMA_CTRL_REG(ch) = ((dma_desc->dma_ctrl & 0x7fffff) << 1) | (auto_reload ? 0x1: 0x0);
	DMA_CHNLCTRL_REG(ch) |= DMA_CHNL_CTRL_CHNL_ON;
	return 0;
}