void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState) { uint32_t tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00; /* Check the parameters */ assert_param(IS_GPIO_REMAP(GPIO_Remap)); assert_param(IS_FUNCTIONAL_STATE(NewState)); tmpreg = AFIO->MAPR; tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10; tmp = GPIO_Remap & LSB_MASK; if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) { tmpreg &= DBGAFR_SWJCFG_MASK; AFIO->MAPR &= DBGAFR_SWJCFG_MASK; } else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK) { tmp1 = ((uint32_t)0x03) 0x15)*0x10)); tmpreg |= ~DBGAFR_SWJCFG_MASK; } if (NewState != DISABLE) { tmpreg |= (tmp > 0x15)*0x10)); } AFIO->MAPR = tmpreg; }//这人程序是开启can脚映射的,但是我不理解里面的俺码比如DBGAFR_LOCATION_MASK ,DBGAFR_NUMBITS_MASKDBGAFR_SWJCFG_MASK,这些掩码是根据什么算出来的? |