TIM1 GPIO remapping + gpio_port_config_lock().

Thanks to Philip Court <philip@greenstage.co.nz> for the patch.
This commit is contained in:
Uwe Hermann
2010-12-17 06:04:28 +01:00
parent 9539f3bf06
commit eebbd508fc
2 changed files with 24 additions and 0 deletions

View File

@@ -106,3 +106,17 @@ void gpio_port_write(u32 gpioport, u16 data)
{
GPIO_ODR(gpioport) = data;
}
void gpio_port_config_lock(u32 gpioport, u16 gpios)
{
u32 reg32;
/* Special "Lock Key Writing Sequence", see datasheet. */
GPIO_LCKR(gpioport) = GPIO_LCKK | gpios; /* Set LCKK. */
GPIO_LCKR(gpioport) = ~GPIO_LCKK & gpios; /* Clear LCKK. */
GPIO_LCKR(gpioport) = GPIO_LCKK | gpios; /* Set LCKK. */
reg32 = GPIO_LCKR(gpioport); /* Read LCKK. */
reg32 = GPIO_LCKR(gpioport); /* Read LCKK again. */
/* If (reg32 & GPIO_LCKK) is true, the lock is now active. */
}