/* Gets a handle to a DMA channel. 
This function returns a handle, representing a control block of a particular DMA channel */
dmacHw_HANDLE_t dmacHw_getChannelHandle(dmacHw_ID_t channelId)
/* Gets a handle to a DMA channel. 
This function returns a handle, representing a control block of a particular DMA channel */
dmacHw_HANDLE_t dmacHw_getChannelHandle(dmacHw_ID_t channelId)
{
	int idx;
	switch ((channelId >> 8)) {
	case 0:
		dmacHw_ASSERT((channelId & 0xff) < dmaChannelCount_0);
		idx = (channelId & 0xff);
		break;
	case 1:
		dmacHw_ASSERT((channelId & 0xff) < dmaChannelCount_1);
		idx = dmaChannelCount_0 + (channelId & 0xff);
		break;
	default:
		dmacHw_ASSERT(0);
		return (dmacHw_HANDLE_t) -1;
	}
	return dmacHw_CBLK_TO_HANDLE(&dmacHw_gCblk[idx]);
}