]> git.sur5r.net Git - freertos/blobdiff - Demo/CORTEX_STM32F103_GCC_Rowley/ST Library/src/stm32f10x_gpio.c
Add FreeRTOS-Plus directory.
[freertos] / Demo / CORTEX_STM32F103_GCC_Rowley / ST Library / src / stm32f10x_gpio.c
diff --git a/Demo/CORTEX_STM32F103_GCC_Rowley/ST Library/src/stm32f10x_gpio.c b/Demo/CORTEX_STM32F103_GCC_Rowley/ST Library/src/stm32f10x_gpio.c
deleted file mode 100644 (file)
index 9fbcd16..0000000
+++ /dev/null
@@ -1,580 +0,0 @@
-/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************\r
-* File Name          : stm32f10x_gpio.c\r
-* Author             : MCD Application Team\r
-* Version            : V2.0.1\r
-* Date               : 06/13/2008\r
-* Description        : This file provides all the GPIO firmware functions.\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 TIME.\r
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
-* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
-*******************************************************************************/\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32f10x_gpio.h"\r
-#include "stm32f10x_rcc.h"\r
-\r
-/* Private typedef -----------------------------------------------------------*/\r
-/* Private define ------------------------------------------------------------*/\r
-/* ------------ RCC registers bit address in the alias region ----------- */\r
-#define AFIO_OFFSET                 (AFIO_BASE - PERIPH_BASE)\r
-\r
-/* --- EVENTCR Register ---*/\r
-/* Alias word address of EVOE bit */\r
-#define EVCR_OFFSET                 (AFIO_OFFSET + 0x00)\r
-#define EVOE_BitNumber              ((u8)0x07)\r
-#define EVCR_EVOE_BB                (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))\r
-\r
-#define EVCR_PORTPINCONFIG_MASK     ((u16)0xFF80)\r
-#define LSB_MASK                    ((u16)0xFFFF)\r
-#define DBGAFR_POSITION_MASK        ((u32)0x000F0000)\r
-#define DBGAFR_SWJCFG_MASK          ((u32)0xF0FFFFFF)\r
-#define DBGAFR_LOCATION_MASK        ((u32)0x00200000)\r
-#define DBGAFR_NUMBITS_MASK         ((u32)0x00100000)\r
-\r
-/* Private macro -------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private function prototypes -----------------------------------------------*/\r
-/* Private functions ---------------------------------------------------------*/\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_DeInit\r
-* Description    : Deinitializes the GPIOx peripheral registers to their default\r
-*                  reset values.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  switch (*(u32*)&GPIOx)\r
-  {\r
-    case GPIOA_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, DISABLE);\r
-      break;\r
-\r
-    case GPIOB_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, DISABLE);\r
-      break;\r
-\r
-    case GPIOC_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, DISABLE);\r
-      break;\r
-\r
-    case GPIOD_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, DISABLE);\r
-      break;\r
-      \r
-    case GPIOE_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, DISABLE);\r
-      break; \r
-\r
-    case GPIOF_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, DISABLE);\r
-      break;\r
-\r
-    case GPIOG_BASE:\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, ENABLE);\r
-      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, DISABLE);\r
-      break;                       \r
-\r
-    default:\r
-      break;\r
-  }\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_AFIODeInit\r
-* Description    : Deinitializes the Alternate Functions (remap, event control\r
-*                  and EXTI configuration) registers to their default reset\r
-*                  values.\r
-* Input          : None\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_AFIODeInit(void)\r
-{\r
-  RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE);\r
-  RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE);\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_Init\r
-* Description    : Initializes the GPIOx peripheral according to the specified\r
-*                  parameters in the GPIO_InitStruct.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that\r
-*                    contains the configuration information for the specified GPIO\r
-*                    peripheral.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)\r
-{\r
-  u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;\r
-  u32 tmpreg = 0x00, pinmask = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));\r
-  assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));  \r
-  \r
-/*---------------------------- GPIO Mode Configuration -----------------------*/\r
-  currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F);\r
-\r
-  if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00)\r
-  { \r
-    /* Check the parameters */\r
-    assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));\r
-    /* Output mode */\r
-    currentmode |= (u32)GPIO_InitStruct->GPIO_Speed;\r
-  }\r
-\r
-/*---------------------------- GPIO CRL Configuration ------------------------*/\r
-  /* Configure the eight low port pins */\r
-  if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00)\r
-  {\r
-    tmpreg = GPIOx->CRL;\r
-\r
-    for (pinpos = 0x00; pinpos < 0x08; pinpos++)\r
-    {\r
-      pos = ((u32)0x01) << pinpos;\r
-      /* Get the port pins position */\r
-      currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;\r
-\r
-      if (currentpin == pos)\r
-      {\r
-        pos = pinpos << 2;\r
-        /* Clear the corresponding low control register bits */\r
-        pinmask = ((u32)0x0F) << pos;\r
-        tmpreg &= ~pinmask;\r
-\r
-        /* Write the mode configuration in the corresponding bits */\r
-        tmpreg |= (currentmode << pos);\r
-\r
-        /* Reset the corresponding ODR bit */\r
-        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)\r
-        {\r
-          GPIOx->BRR = (((u32)0x01) << pinpos);\r
-        }\r
-        /* Set the corresponding ODR bit */\r
-        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)\r
-        {\r
-          GPIOx->BSRR = (((u32)0x01) << pinpos);\r
-        }\r
-      }\r
-    }\r
-    GPIOx->CRL = tmpreg;\r
-  }\r
-\r
-/*---------------------------- GPIO CRH Configuration ------------------------*/\r
-  /* Configure the eight high port pins */\r
-  if (GPIO_InitStruct->GPIO_Pin > 0x00FF)\r
-  {\r
-    tmpreg = GPIOx->CRH;\r
-    for (pinpos = 0x00; pinpos < 0x08; pinpos++)\r
-    {\r
-      pos = (((u32)0x01) << (pinpos + 0x08));\r
-      /* Get the port pins position */\r
-      currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);\r
-      if (currentpin == pos)\r
-      {\r
-        pos = pinpos << 2;\r
-        /* Clear the corresponding high control register bits */\r
-        pinmask = ((u32)0x0F) << pos;\r
-        tmpreg &= ~pinmask;\r
-\r
-        /* Write the mode configuration in the corresponding bits */\r
-        tmpreg |= (currentmode << pos);\r
-\r
-        /* Reset the corresponding ODR bit */\r
-        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)\r
-        {\r
-          GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));\r
-        }\r
-        /* Set the corresponding ODR bit */\r
-        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)\r
-        {\r
-          GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));\r
-        }\r
-      }\r
-    }\r
-    GPIOx->CRH = tmpreg;\r
-  }\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_StructInit\r
-* Description    : Fills each GPIO_InitStruct member with its default value.\r
-* Input          : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure\r
-*                    which will be initialized.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)\r
-{\r
-  /* Reset GPIO init structure parameters values */\r
-  GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_All;\r
-  GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;\r
-  GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_ReadInputDataBit\r
-* Description    : Reads the specified input port pin.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                : - GPIO_Pin:  specifies the port bit to read.\r
-*                    This parameter can be GPIO_Pin_x where x can be (0..15).\r
-* Output         : None\r
-* Return         : The input port pin value.\r
-*******************************************************************************/\r
-u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)\r
-{\r
-  u8 bitstatus = 0x00;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); \r
-  \r
-  if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET)\r
-  {\r
-    bitstatus = (u8)Bit_SET;\r
-  }\r
-  else\r
-  {\r
-    bitstatus = (u8)Bit_RESET;\r
-  }\r
-  return bitstatus;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_ReadInputData\r
-* Description    : Reads the specified GPIO input data port.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-* Output         : None\r
-* Return         : GPIO input data port value.\r
-*******************************************************************************/\r
-u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  return ((u16)GPIOx->IDR);\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_ReadOutputDataBit\r
-* Description    : Reads the specified output data port bit.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                : - GPIO_Pin:  specifies the port bit to read.\r
-*                    This parameter can be GPIO_Pin_x where x can be (0..15).\r
-* Output         : None\r
-* Return         : The output port pin value.\r
-*******************************************************************************/\r
-u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)\r
-{\r
-  u8 bitstatus = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); \r
-  \r
-  if ((GPIOx->ODR & GPIO_Pin) != (u32)Bit_RESET)\r
-  {\r
-    bitstatus = (u8)Bit_SET;\r
-  }\r
-  else\r
-  {\r
-    bitstatus = (u8)Bit_RESET;\r
-  }\r
-  return bitstatus;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_ReadOutputData\r
-* Description    : Reads the specified GPIO output data port.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-* Output         : None\r
-* Return         : GPIO output data port value.\r
-*******************************************************************************/\r
-u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-    \r
-  return ((u16)GPIOx->ODR);\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_SetBits\r
-* Description    : Sets the selected data port bits.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - GPIO_Pin: specifies the port bits to be written.\r
-*                    This parameter can be any combination of GPIO_Pin_x where \r
-*                    x can be (0..15).\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  GPIOx->BSRR = GPIO_Pin;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_ResetBits\r
-* Description    : Clears the selected data port bits.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - GPIO_Pin: specifies the port bits to be written.\r
-*                    This parameter can be any combination of GPIO_Pin_x where \r
-*                    x can be (0..15).\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  GPIOx->BRR = GPIO_Pin;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_WriteBit\r
-* Description    : Sets or clears the selected data port bit.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - GPIO_Pin: specifies the port bit to be written.\r
-*                    This parameter can be one of GPIO_Pin_x where x can be (0..15).\r
-*                  - BitVal: specifies the value to be written to the selected bit.\r
-*                    This parameter can be one of the BitAction enum values:\r
-*                       - Bit_RESET: to clear the port pin\r
-*                       - Bit_SET: to set the port pin\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin));\r
-  assert_param(IS_GPIO_BIT_ACTION(BitVal)); \r
-  \r
-  if (BitVal != Bit_RESET)\r
-  {\r
-    GPIOx->BSRR = GPIO_Pin;\r
-  }\r
-  else\r
-  {\r
-    GPIOx->BRR = GPIO_Pin;\r
-  }\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_Write\r
-* Description    : Writes data to the specified GPIO data port.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - PortVal: specifies the value to be written to the port output\r
-*                    data register.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  GPIOx->ODR = PortVal;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_PinLockConfig\r
-* Description    : Locks GPIO Pins configuration registers.\r
-* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.\r
-*                  - GPIO_Pin: specifies the port bit to be written.\r
-*                    This parameter can be any combination of GPIO_Pin_x where \r
-*                    x can be (0..15).\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)\r
-{\r
-  u32 tmp = 0x00010000;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  tmp |= GPIO_Pin;\r
-  /* Set LCKK bit */\r
-  GPIOx->LCKR = tmp;\r
-  /* Reset LCKK bit */\r
-  GPIOx->LCKR =  GPIO_Pin;\r
-  /* Set LCKK bit */\r
-  GPIOx->LCKR = tmp;\r
-  /* Read LCKK bit*/\r
-  tmp = GPIOx->LCKR;\r
-  /* Read LCKK bit*/\r
-  tmp = GPIOx->LCKR;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_EventOutputConfig\r
-* Description    : Selects the GPIO pin used as Event output.\r
-* Input          : - GPIO_PortSource: selects the GPIO port to be used as source\r
-*                    for Event output.\r
-*                    This parameter can be GPIO_PortSourceGPIOx where x can be\r
-*                    (A..E).\r
-*                  - GPIO_PinSource: specifies the pin for the Event output.\r
-*                    This parameter can be GPIO_PinSourcex where x can be (0..15).\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)\r
-{\r
-  u32 tmpreg = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource));\r
-  assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));\r
-    \r
-  tmpreg = AFIO->EVCR;\r
-  /* Clear the PORT[6:4] and PIN[3:0] bits */\r
-  tmpreg &= EVCR_PORTPINCONFIG_MASK;\r
-  tmpreg |= (u32)GPIO_PortSource << 0x04;\r
-  tmpreg |= GPIO_PinSource;\r
-\r
-  AFIO->EVCR = tmpreg;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_EventOutputCmd\r
-* Description    : Enables or disables the Event Output.\r
-* Input          : - NewState: new state of the Event output.\r
-*                    This parameter can be: ENABLE or DISABLE.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_EventOutputCmd(FunctionalState NewState)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_FUNCTIONAL_STATE(NewState));\r
-  \r
-  *(vu32 *) EVCR_EVOE_BB = (u32)NewState;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_PinRemapConfig\r
-* Description    : Changes the mapping of the specified pin.\r
-* Input          : - GPIO_Remap: selects the pin to remap.\r
-*                    This parameter can be one of the following values:\r
-*                       - GPIO_Remap_SPI1\r
-*                       - GPIO_Remap_I2C1\r
-*                       - GPIO_Remap_USART1\r
-*                       - GPIO_Remap_USART2\r
-*                       - GPIO_PartialRemap_USART3\r
-*                       - GPIO_FullRemap_USART3\r
-*                       - GPIO_PartialRemap_TIM1\r
-*                       - GPIO_FullRemap_TIM1\r
-*                       - GPIO_PartialRemap1_TIM2\r
-*                       - GPIO_PartialRemap2_TIM2\r
-*                       - GPIO_FullRemap_TIM2\r
-*                       - GPIO_PartialRemap_TIM3\r
-*                       - GPIO_FullRemap_TIM3\r
-*                       - GPIO_Remap_TIM4\r
-*                       - GPIO_Remap1_CAN\r
-*                       - GPIO_Remap2_CAN\r
-*                       - GPIO_Remap_PD01\r
-*                       - GPIO_Remap_TIM5CH4_LSI\r
-*                       - GPIO_Remap_ADC1_ETRGINJ\r
-*                       - GPIO_Remap_ADC1_ETRGREG\r
-*                       - GPIO_Remap_ADC2_ETRGINJ\r
-*                       - GPIO_Remap_ADC2_ETRGREG\r
-*                       - GPIO_Remap_SWJ_NoJTRST\r
-*                       - GPIO_Remap_SWJ_JTAGDisable\r
-*                       - GPIO_Remap_SWJ_Disable\r
-*                  - NewState: new state of the port pin remapping.\r
-*                    This parameter can be: ENABLE or DISABLE.\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState)\r
-{\r
-  u32 tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_REMAP(GPIO_Remap));\r
-  assert_param(IS_FUNCTIONAL_STATE(NewState));  \r
-  \r
-  tmpreg = AFIO->MAPR;\r
-\r
-  tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;\r
-  tmp = GPIO_Remap & LSB_MASK;\r
-\r
-  if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK))\r
-  {\r
-    tmpreg &= DBGAFR_SWJCFG_MASK;\r
-    AFIO->MAPR &= DBGAFR_SWJCFG_MASK;\r
-  }\r
-  else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)\r
-  {\r
-    tmp1 = ((u32)0x03) << tmpmask;\r
-    tmpreg &= ~tmp1;\r
-    tmpreg |= ~DBGAFR_SWJCFG_MASK;\r
-  }\r
-  else\r
-  {\r
-    tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));\r
-    tmpreg |= ~DBGAFR_SWJCFG_MASK;\r
-  }\r
-\r
-  if (NewState != DISABLE)\r
-  {\r
-    tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));\r
-  }\r
-\r
-  AFIO->MAPR = tmpreg;\r
-}\r
-\r
-/*******************************************************************************\r
-* Function Name  : GPIO_EXTILineConfig\r
-* Description    : Selects the GPIO pin used as EXTI Line.\r
-* Input          : - GPIO_PortSource: selects the GPIO port to be used as\r
-*                    source for EXTI lines.\r
-*                    This parameter can be GPIO_PortSourceGPIOx where x can be\r
-*                    (A..G).\r
-*                  - GPIO_PinSource: specifies the EXTI line to be configured.\r
-*                   This parameter can be GPIO_PinSourcex where x can be (0..15).\r
-* Output         : None\r
-* Return         : None\r
-*******************************************************************************/\r
-void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)\r
-{\r
-  u32 tmp = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));\r
-  assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));\r
-  \r
-  tmp = ((u32)0x0F) << (0x04 * (GPIO_PinSource & (u8)0x03));\r
-\r
-  AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;\r
-  AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((u32)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (u8)0x03)));\r
-}\r
-\r
-/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/\r