ECU/GSM/dist/src/USART_program.c
Error_Status USART_enumDMAReceive(u8 UART_Channel, u8 DMA_Channel, volatile u32* buffer, u32 Count) {
	UART_REG * selectedChannel = USART1;

	switch(UART_Channel) {
 		case 1:
 			;
			break;
 		case 2:
			selectedChannel = USART2;
 			break;
 		case 3:
			selectedChannel = USART3;
			break;
 		case 4:
 			selectedChannel = USART4;
 			break;
 		case 5:
 			selectedChannel = USART5;
 			break;
 		default:
 			return NOK;
 	}

	DMA_Transfer(DMA_Channel, buffer, &(selectedChannel->DR), Count);
	return OK;
}
/**
 * @brief  Waits for character receive and puts it into a buffer by DMA
 * @param  @param  Channel:	Number of the UART Channel to use.
 * 							Can be USART_CHANNEL_x where x is from 1 to 5
 * @param  Channel:	Number of the DMA Channel to use.
 * 					Can be DMA_CHANNEL_x where x is from 1 to 6
 * @param  buffer: Pointer to a 32-bit array to hold the received data
 * @param  Count: The number of data units anticipated
 * @retval u8 the 8/9 bits received in the data register
 */
@brief  Waits for character receive and puts it into a buffer by DMA
@param  @param  Channel:     Number of the UART Channel to use.
Can be USART_CHANNEL_x where x is from 1 to 5
@param  Channel:     Number of the DMA Channel to use.
Can be DMA_CHANNEL_x where x is from 1 to 6
@param  buffer: Pointer to a 32-bit array to hold the received data
@param  Count: The number of data units anticipated
@retval u8 the 8/9 bits received in the data register
@brief Waits for character receive and puts it into a buffer by DMA @param @param Channel : Number of the UART Channel to use . Can be USART_CHANNEL_x where x is from 1 to 5 @param Channel : Number of the DMA Channel to use . Can be DMA_CHANNEL_x where x is from 1 to 6 @param buffer : Pointer to a 32 - bit array to hold the received data @param Count : The number of data units anticipated @retval u8 the 8 / 9 bits received in the data register
Error_Status USART_enumDMAReceive(u8 UART_Channel, u8 DMA_Channel, volatile u32* buffer, u32 Count) {
	UART_REG * selectedChannel = USART1;
	switch(UART_Channel) {
 		case 1:
 			;
			break;
 		case 2:
			selectedChannel = USART2;
 			break;
 		case 3:
			selectedChannel = USART3;
			break;
 		case 4:
 			selectedChannel = USART4;
 			break;
 		case 5:
 			selectedChannel = USART5;
 			break;
 		default:
 			return NOK;
 	}
	DMA_Transfer(DMA_Channel, buffer, &(selectedChannel->DR), Count);
	return OK;
}
Error_Status USART_enumDMAReceive ( u8 UART_Channel , u8 DMA_Channel , volatile u32 * buffer , u32 Count ) { UART_REG * selectedChannel = USART1 ; switch ( UART_Channel ) { case 1 : ; break ; case 2 : selectedChannel = USART2 ; break ; case 3 : selectedChannel = USART3 ; break ; case 4 : selectedChannel = USART4 ; break ; case 5 : selectedChannel = USART5 ; break ; default : return NOK ; } DMA_Transfer ( DMA_Channel , buffer , & ( selectedChannel -> DR ) , Count ) ; return OK ; }
@brief  Waits for character receive and puts it into a buffer by DMA
 @param  @param  Channel:     Number of the UART Channel to use.
@brief Waits for character receive and puts it into a buffer by DMA @param @param Channel : Number of the UART Channel to use .