ECU/Application/dist/src/DMA_program.c
Error_Status DMA_enumInit(DMA_Config newDMA) {
	Error_Status returnVal = OK;

	if (newDMA.Channel >= 1 && newDMA.Channel < 7) {
		u32* currentChannel = ((u32*) (&DMA->CCR1 + (u32) (newDMA.Channel - 1) * 5));
		*currentChannel = 0;
		*currentChannel |= newDMA.MEM2MEM 	<< 	14;
		*currentChannel |= newDMA.Priority 	<< 	12;
		*currentChannel |= newDMA.SrcSIZE 	<< 	10;
		*currentChannel |= newDMA.DstSIZE 	<< 	8;
		*currentChannel |= newDMA.SrcINC 	<< 	7;
		*currentChannel |= newDMA.DstINC 	<< 	6;
		*currentChannel |= newDMA.CIRC 		<< 	5;
		*currentChannel |= newDMA.DIR 		<< 	4;
		*currentChannel |= newDMA.TEIE 		<< 	3;
		*currentChannel |= newDMA.HTIE 		<< 	2;
		*currentChannel |= newDMA.TCIE 		<< 	1;
		DMA_CallbackFunction[newDMA.Channel] = &DMA_Stub;
	} else {
		returnVal = indexOutOfRange;
	}

	return returnVal;
}
/**
  * @brief  Initiates the DMA and sets channel configuration
  * @param	newDMA: The channel configuration of type DMA_Config
  * @retval Error_Status
  */
@brief  Initiates the DMA and sets channel configuration
@param      newDMA: The channel configuration of type DMA_Config
@retval Error_Status
@brief Initiates the DMA and sets channel configuration @param newDMA : The channel configuration of type DMA_Config @retval Error_Status
Error_Status DMA_enumInit(DMA_Config newDMA) {
	Error_Status returnVal = OK;
	if (newDMA.Channel >= 1 && newDMA.Channel < 7) {
		u32* currentChannel = ((u32*) (&DMA->CCR1 + (u32) (newDMA.Channel - 1) * 5));
		*currentChannel = 0;
		*currentChannel |= newDMA.MEM2MEM 	<< 	14;
		*currentChannel |= newDMA.Priority 	<< 	12;
		*currentChannel |= newDMA.SrcSIZE 	<< 	10;
		*currentChannel |= newDMA.DstSIZE 	<< 	8;
		*currentChannel |= newDMA.SrcINC 	<< 	7;
		*currentChannel |= newDMA.DstINC 	<< 	6;
		*currentChannel |= newDMA.CIRC 		<< 	5;
		*currentChannel |= newDMA.DIR 		<< 	4;
		*currentChannel |= newDMA.TEIE 		<< 	3;
		*currentChannel |= newDMA.HTIE 		<< 	2;
		*currentChannel |= newDMA.TCIE 		<< 	1;
		DMA_CallbackFunction[newDMA.Channel] = &DMA_Stub;
	} else {
		returnVal = indexOutOfRange;
	}
	return returnVal;
}
Error_Status DMA_enumInit ( DMA_Config newDMA ) { Error_Status returnVal = OK ; if ( newDMA . Channel >= 1 && newDMA . Channel < 7 ) { u32 * currentChannel = ( ( u32 * ) ( & DMA -> CCR1 + ( u32 ) ( newDMA . Channel - 1 ) * 5 ) ) ; * currentChannel = 0 ; * currentChannel |= newDMA . MEM2MEM << 14 ; * currentChannel |= newDMA . Priority << 12 ; * currentChannel |= newDMA . SrcSIZE << 10 ; * currentChannel |= newDMA . DstSIZE << 8 ; * currentChannel |= newDMA . SrcINC << 7 ; * currentChannel |= newDMA . DstINC << 6 ; * currentChannel |= newDMA . CIRC << 5 ; * currentChannel |= newDMA . DIR << 4 ; * currentChannel |= newDMA . TEIE << 3 ; * currentChannel |= newDMA . HTIE << 2 ; * currentChannel |= newDMA . TCIE << 1 ; DMA_CallbackFunction [ newDMA . Channel ] = & DMA_Stub ; } else { returnVal = indexOutOfRange ; } return returnVal ; }
@brief  Initiates the DMA and sets channel configuration
 @param      newDMA: The channel configuration of type DMA_Config
 @retval Error_Status
@brief Initiates the DMA and sets channel configuration @param newDMA : The channel configuration of type DMA_Config @retval Error_Status