48 #define AFIO_OFFSET (AFIO_BASE - PERIPH_BASE)
53 #define EVCR_OFFSET (AFIO_OFFSET + 0x00)
54 #define EVOE_BitNumber ((uint8_t)0x07)
55 #define EVCR_EVOE_BB (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))
60 #define MAPR_OFFSET (AFIO_OFFSET + 0x04)
61 #define MII_RMII_SEL_BitNumber ((u8)0x17)
62 #define MAPR_MII_RMII_SEL_BB (PERIPH_BB_BASE + (MAPR_OFFSET * 32) + (MII_RMII_SEL_BitNumber * 4))
65 #define EVCR_PORTPINCONFIG_MASK ((uint16_t)0xFF80)
66 #define LSB_MASK ((uint16_t)0xFFFF)
67 #define DBGAFR_POSITION_MASK ((uint32_t)0x000F0000)
68 #define DBGAFR_SWJCFG_MASK ((uint32_t)0xF0FFFFFF)
69 #define DBGAFR_LOCATION_MASK ((uint32_t)0x00200000)
70 #define DBGAFR_NUMBITS_MASK ((uint32_t)0x00100000)
118 else if (GPIOx ==
GPIOB)
123 else if (GPIOx ==
GPIOC)
128 else if (GPIOx ==
GPIOD)
133 else if (GPIOx ==
GPIOE)
138 else if (GPIOx ==
GPIOF)
175 uint32_t currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
176 uint32_t tmpreg = 0x00, pinmask = 0x00;
183 currentmode = ((uint32_t)GPIO_InitStruct->
GPIO_Mode) & ((uint32_t)0x0F);
184 if ((((uint32_t)GPIO_InitStruct->
GPIO_Mode) & ((uint32_t)0x10)) != 0x00)
189 currentmode |= (uint32_t)GPIO_InitStruct->
GPIO_Speed;
193 if (((uint32_t)GPIO_InitStruct->
GPIO_Pin & ((uint32_t)0x00FF)) != 0x00)
196 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
198 pos = ((uint32_t)0x01) << pinpos;
200 currentpin = (GPIO_InitStruct->
GPIO_Pin) & pos;
201 if (currentpin == pos)
205 pinmask = ((uint32_t)0x0F) << pos;
208 tmpreg |= (currentmode << pos);
212 GPIOx->
BRR = (((uint32_t)0x01) << pinpos);
219 GPIOx->
BSRR = (((uint32_t)0x01) << pinpos);
228 if (GPIO_InitStruct->
GPIO_Pin > 0x00FF)
231 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
233 pos = (((uint32_t)0x01) << (pinpos + 0x08));
235 currentpin = ((GPIO_InitStruct->
GPIO_Pin) & pos);
236 if (currentpin == pos)
240 pinmask = ((uint32_t)0x0F) << pos;
243 tmpreg |= (currentmode << pos);
247 GPIOx->
BRR = (((uint32_t)0x01) << (pinpos + 0x08));
252 GPIOx->
BSRR = (((uint32_t)0x01) << (pinpos + 0x08));
283 uint8_t bitstatus = 0x00;
295 bitstatus = (uint8_t)Bit_RESET;
310 return ((uint16_t)GPIOx->
IDR);
322 uint8_t bitstatus = 0x00;
333 bitstatus = (uint8_t)Bit_RESET;
348 return ((uint16_t)GPIOx->
ODR);
364 GPIOx->
BSRR = GPIO_Pin;
380 GPIOx->
BRR = GPIO_Pin;
403 GPIOx->
BSRR = GPIO_Pin;
407 GPIOx->
BRR = GPIO_Pin;
422 GPIOx->
ODR = PortVal;
434 uint32_t tmp = 0x00010000;
444 GPIOx->
LCKR = GPIO_Pin;
464 uint32_t tmpreg = 0x00;
472 tmpreg |= (uint32_t)GPIO_PortSource << 0x04;
473 tmpreg |= GPIO_PinSource;
551 uint32_t tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;
557 if((GPIO_Remap & 0x80000000) == 0x80000000)
559 tmpreg =
AFIO->MAPR2;
576 tmp1 = ((uint32_t)0x03) << tmpmask;
582 tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));
588 tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));
591 if((GPIO_Remap & 0x80000000) == 0x80000000)
593 AFIO->MAPR2 = tmpreg;
616 tmp = ((uint32_t)0x0F) << (0x04 * (GPIO_PinSource & (uint8_t)0x03));
617 AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
618 AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((uint32_t)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (uint8_t)0x03)));