Permalink
Browse files

Fix bugs in GPIO code

The GPIO input and direction mask would not change back to 0 once they were
changed to 1.
  • Loading branch information...
beckus committed Jan 21, 2015
1 parent caf90a6 commit 3e846fc6272ea226cd3fa5bd255a71e30be0e9b5
Showing with 2 additions and 0 deletions.
  1. +2 −0 hw/gpio/stm32_gpio.c
View
@@ -83,6 +83,7 @@ static void stm32_gpio_in_trigger(void *opaque, int irq, int level)
assert(pin < STM32_GPIO_PIN_COUNT);
/* Update internal pin state. */
s->in &= ~(1 << pin);
s->in |= (level ? 1 : 0) << pin;
/* Propagate the trigger to the input IRQs. */
@@ -125,6 +126,7 @@ static void stm32_gpio_update_dir(Stm32Gpio *s, int cr_index)
/* If the mode is 0, the pin is input. Otherwise, it
* is output.
*/
s->dir_mask &= ~(1 << pin);
s->dir_mask |= (pin_dir ? 1 : 0) << pin;
}
}

1 comment on commit 3e846fc

@metc

This comment has been minimized.

Show comment
Hide comment
@metc

metc commented on 3e846fc Jun 6, 2015

👍

Please sign in to comment.