@@ -93,6 +93,11 @@ static void test_gpio_read(void)
93
93
94
94
value = readl (addr_idr );
95
95
g_assert_cmpint (value , = = , 0x81 );
96
+
97
+ set_irq_in ("/machine/stm32/gpio[a]" , 0 , 0 );
98
+
99
+ value = readl (addr_idr );
100
+ g_assert_cmpint (value , = = , 0x80 );
96
101
}
97
102
98
103
static void test_gpio_write (void )
@@ -123,6 +128,17 @@ static void test_gpio_write(void)
123
128
124
129
writel (addr_bsrr , 0x0000ffef );
125
130
131
+ // Make sure pin can be toggled between input and output
132
+ writel (addr_odr , 0x00000000 );
133
+ config_gpio (GPIOA_BASE_ADDR , 0x33333333 , 0x33333330 ); // Pin 0 is input
134
+ g_assert_cmpint (get_irq_for_gpio (gpio_a_out_id , 0x0 ), = = , 0 );
135
+ writel (addr_odr , 0x00000001 );
136
+ g_assert_cmpint (get_irq_for_gpio (gpio_a_out_id , 0x0 ), = = , 0 );
137
+ writel (addr_odr , 0x00000000 );
138
+ config_gpio (GPIOA_BASE_ADDR , 0x33333333 , 0x33333333 ); // Pin 0 is output
139
+ g_assert_cmpint (get_irq_for_gpio (gpio_a_out_id , 0x0 ), = = , 0 );
140
+ writel (addr_odr , 0x00000001 );
141
+ g_assert_cmpint (get_irq_for_gpio (gpio_a_out_id , 0x0 ), = = , 1 );
126
142
127
143
//config_gpio(GPIOB_BASE_ADDR, 0x33333333, 0x33333333); // All outputs
128
144
0 commit comments