apb.h
Upload User: yyyd609
Upload Date: 2022-07-18
Package Size: 183k
Code Size: 3k
Development Platform:

C/C++

  1. /******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
  2. * File Name          : apb.h
  3. * Author             : MCD Application Team
  4. * Date First Issued  : 05/30/2003
  5. * Description        : This file contains all the functions prototypes for the
  6. *                      APB bridge software library.
  7. ********************************************************************************
  8. * History:
  9. *  01/01/2004 : V1.2
  10. *  14/07/2004 : V1.3
  11. *******************************************************************************/
  12. #ifndef __APB_H
  13. #define __APB_H
  14. #include "71x_lib.h"
  15. /* APB1 Peripherals */
  16. #define  I2C0_Periph      0x0002
  17. #define  I2C1_Periph      0x0004
  18. #define  UART0_Periph     0x0010
  19. #define  UART1_Periph     0x0020
  20. #define  UART2_Periph     0x0040
  21. #define  UART3_Periph     0x0080
  22. #define  USB_Periph       0x0100
  23. #define  CAN_Periph       0x0200
  24. #define  BSPI0_Periph     0x0400
  25. #define  BSPI1_Periph     0x0800
  26. #define  HDLC_Periph      0x2000
  27. /* APB2 Peripherals */
  28. #define  XTI_Periph       0x0002
  29. #define  GPIO0_Periph     0x0004
  30. #define  GPIO1_Periph     0x0008
  31. #define  GPIO2_Periph     0x0010
  32. #define  ADC12_Periph     0x0080
  33. #define  TIM0_Periph      0x0200
  34. #define  TIM1_Periph      0x0400
  35. #define  TIM2_Periph      0x0800
  36. #define  TIM3_Periph      0x1000
  37. #define  RTC_Periph       0x2000
  38. #define  WDG_Periph       0x4000
  39. #define  EIC_Periph       0x8000
  40. /*******************************************************************************
  41. * Function Name  : APB_ClockConfig
  42. * Description    : Enables/Disables the Clock gating for peripherals on the APB
  43. *                  bridge passed in parameters.
  44. * Input          : APBx ( APB1 or APB2 )
  45. *                  NewState ENABLE or DISABLE
  46. *                  NewValue (u16)
  47. * Return         : None
  48. *******************************************************************************/
  49. inline void APB_ClockConfig ( APB_TypeDef *APBx,
  50.                               FunctionalState NewState,
  51.                               u16 NewValue )
  52. {
  53.   if (NewState == ENABLE) APBx->CKDIS &= ~NewValue;
  54.     else APBx->CKDIS |= NewValue;
  55. }
  56. /*******************************************************************************
  57. * Function Name  : APB_SwResetConfig
  58. * Description    : Enables/Disables the software Reset for peripherals on the APB
  59. *                  bridge passed in parameters.
  60. * Input          : APBx ( APB1 or APB2 )
  61. *                  NewState ENABLE or DISABLE
  62. *                  NewValue (u16)
  63. * Return         : None
  64. *******************************************************************************/
  65. inline void APB_SwResetConfig ( APB_TypeDef *APBx,
  66.                                 FunctionalState NewState,
  67.                                 u16 NewValue )
  68. {
  69.   if (NewState == ENABLE) APBx->SWRES |= NewValue;
  70.     else APBx->SWRES &= ~NewValue;
  71. }
  72. #endif // __APB_H
  73. /******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/