Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 196 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** |
1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** |
2 | * File Name : 91x_uart.c |
2 | * File Name : 91x_uart.c |
3 | * Author : MCD Application Team |
3 | * Author : MCD Application Team |
- | 4 | * Version : V2.1 |
|
4 | * Date First Issued : 05/18/2006 : Version 1.0 |
5 | * Date : 12/22/2008 |
5 | * Description : This file provides all the UART software functions. |
6 | * Description : This file provides all the UART firmware functions. |
6 | ******************************************************************************** |
- | |
7 | * History: |
- | |
8 | * 05/22/2007 : Version 1.2 |
- | |
9 | * 05/24/2006 : Version 1.1 |
- | |
10 | * 05/18/2006 : Version 1.0 |
- | |
11 | ******************************************************************************** |
7 | ******************************************************************************** |
12 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
14 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
15 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
Line 492... | Line 488... | ||
492 | * Output : None |
488 | * Output : None |
493 | * Return : None |
489 | * Return : None |
494 | *******************************************************************************/ |
490 | *******************************************************************************/ |
495 | void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState) |
491 | void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState) |
496 | { |
492 | { |
497 | UART_TypeDef* UARTx; |
493 | UART_TypeDef* UARTx =0; |
Line 498... | Line 494... | ||
498 | 494 | ||
499 | switch(IrDAx) |
495 | switch(IrDAx) |
500 | { |
496 | { |
501 | case IrDA0: UARTx = UART0; |
497 | case IrDA0: UARTx = UART0; |
502 | break; |
498 | break; |
503 | case IrDA1: UARTx = UART1; |
499 | case IrDA1: UARTx = UART1; |
504 | break; |
500 | break; |
505 | case IrDA2: UARTx = UART2; |
501 | case IrDA2: UARTx = UART2; |
- | 502 | break; |
|
506 | break; |
503 | default : break; |
Line 507... | Line 504... | ||
507 | } |
504 | } |
508 | 505 | ||
509 | if (NewState == ENABLE) |
506 | if (NewState == ENABLE) |
Line 524... | Line 521... | ||
524 | * Output : None |
521 | * Output : None |
525 | * Return : None |
522 | * Return : None |
526 | *******************************************************************************/ |
523 | *******************************************************************************/ |
527 | void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter) |
524 | void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter) |
528 | { |
525 | { |
529 | UART_TypeDef* UARTx; |
526 | UART_TypeDef* UARTx =0; |
530 | u32 APBClock; |
527 | u32 APBClock; |
531 | switch(IrDAx) |
528 | switch(IrDAx) |
532 | { |
529 | { |
533 | case IrDA0: UARTx = UART0; |
530 | case IrDA0: UARTx = UART0; |
534 | break; |
531 | break; |
535 | case IrDA1: UARTx = UART1; |
532 | case IrDA1: UARTx = UART1; |
536 | break; |
533 | break; |
537 | case IrDA2: UARTx = UART2; |
534 | case IrDA2: UARTx = UART2; |
538 | break; |
535 | break; |
- | 536 | default : break; |
|
539 | } |
537 | } |
540 | /* Get the APB frequency */ |
538 | /* Get the APB frequency */ |
541 | APBClock = (SCU_GetPCLKFreqValue())*1000; |
539 | APBClock = (SCU_GetPCLKFreqValue())*1000; |
542 | /* Determine the Counter Divisor part */ |
540 | /* Determine the Counter Divisor part */ |
543 | UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10; |
541 | UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10; |
Line 552... | Line 550... | ||
552 | * Output : None |
550 | * Output : None |
553 | * Return : None |
551 | * Return : None |
554 | *******************************************************************************/ |
552 | *******************************************************************************/ |
555 | void UART_IrDACmd(u8 IrDAx, FunctionalState NewState) |
553 | void UART_IrDACmd(u8 IrDAx, FunctionalState NewState) |
556 | { |
554 | { |
557 | UART_TypeDef* UARTx; |
555 | UART_TypeDef* UARTx = 0; |
Line 558... | Line 556... | ||
558 | 556 | ||
559 | switch(IrDAx) |
557 | switch(IrDAx) |
560 | { |
558 | { |
561 | case IrDA0: UARTx = UART0; |
559 | case IrDA0: UARTx = UART0; |
562 | break; |
560 | break; |
563 | case IrDA1: UARTx = UART1; |
561 | case IrDA1: UARTx = UART1; |
564 | break; |
562 | break; |
565 | case IrDA2: UARTx = UART2; |
563 | case IrDA2: UARTx = UART2; |
- | 564 | break; |
|
566 | break; |
565 | default : break; |
567 | } |
566 | } |
568 | if(NewState == ENABLE) |
567 | if(NewState == ENABLE) |
569 | { |
568 | { |
570 | /* Enable the IrDA mode of the specified UART */ |
569 | /* Enable the IrDA mode of the specified UART */ |
Line 654... | Line 653... | ||
654 | else |
653 | else |
655 | { |
654 | { |
656 | UART0->CR &= UART_DTR_HighLevel_Mask; |
655 | UART0->CR &= UART_DTR_HighLevel_Mask; |
657 | } |
656 | } |
658 | } |
657 | } |
659 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
658 | /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ |