Build libraries for stm32l1xx and stm32f10x
[fw/stlink] / example / libs_stm / src / stm32f10x / stm32f10x_dbgmcu.c
diff --git a/example/libs_stm/src/stm32f10x/stm32f10x_dbgmcu.c b/example/libs_stm/src/stm32f10x/stm32f10x_dbgmcu.c
new file mode 100644 (file)
index 0000000..6cfceba
--- /dev/null
@@ -0,0 +1,161 @@
+/**\r
+  ******************************************************************************\r
+  * @file    stm32f10x_dbgmcu.c\r
+  * @author  MCD Application Team\r
+  * @version V3.3.0\r
+  * @date    04/16/2010\r
+  * @brief   This file provides all the DBGMCU firmware functions.\r
+  ******************************************************************************\r
+  * @copy\r
+  *\r
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
+  */ \r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32f10x_dbgmcu.h"\r
+\r
+/** @addtogroup STM32F10x_StdPeriph_Driver\r
+  * @{\r
+  */\r
+\r
+/** @defgroup DBGMCU \r
+  * @brief DBGMCU driver modules\r
+  * @{\r
+  */ \r
+\r
+/** @defgroup DBGMCU_Private_TypesDefinitions\r
+  * @{\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup DBGMCU_Private_Defines\r
+  * @{\r
+  */\r
+\r
+#define IDCODE_DEVID_Mask    ((uint32_t)0x00000FFF)\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup DBGMCU_Private_Macros\r
+  * @{\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup DBGMCU_Private_Variables\r
+  * @{\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup DBGMCU_Private_FunctionPrototypes\r
+  * @{\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup DBGMCU_Private_Functions\r
+  * @{\r
+  */\r
+\r
+/**\r
+  * @brief  Returns the device revision identifier.\r
+  * @param  None\r
+  * @retval Device revision identifier\r
+  */\r
+uint32_t DBGMCU_GetREVID(void)\r
+{\r
+   return(DBGMCU->IDCODE >> 16);\r
+}\r
+\r
+/**\r
+  * @brief  Returns the device identifier.\r
+  * @param  None\r
+  * @retval Device identifier\r
+  */\r
+uint32_t DBGMCU_GetDEVID(void)\r
+{\r
+   return(DBGMCU->IDCODE & IDCODE_DEVID_Mask);\r
+}\r
+\r
+/**\r
+  * @brief  Configures the specified peripheral and low power mode behavior\r
+  *   when the MCU under Debug mode.\r
+  * @param  DBGMCU_Periph: specifies the peripheral and low power mode.\r
+  *   This parameter can be any combination of the following values:\r
+  *     @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode              \r
+  *     @arg DBGMCU_STOP: Keep debugger connection during STOP mode               \r
+  *     @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode            \r
+  *     @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted          \r
+  *     @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted           \r
+  *     @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted\r
+  *     @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted\r
+  *     @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted          \r
+  *     @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted\r
+  *     @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted \r
+  *     @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted                \r
+  *     @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted\r
+  *     @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted\r
+  * @param  NewState: new state of the specified peripheral in Debug mode.\r
+  *   This parameter can be: ENABLE or DISABLE.\r
+  * @retval None\r
+  */\r
+void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)\r
+{\r
+  /* Check the parameters */\r
+  assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));\r
+  assert_param(IS_FUNCTIONAL_STATE(NewState));\r
+\r
+  if (NewState != DISABLE)\r
+  {\r
+    DBGMCU->CR |= DBGMCU_Periph;\r
+  }\r
+  else\r
+  {\r
+    DBGMCU->CR &= ~DBGMCU_Periph;\r
+  }\r
+}\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r