October 2017
Intermediate to advanced
586 pages
14h 8m
English
On the other hand, there are GPIO controllers wired on buses such as SPI and I2C. Since functions accessing those buses may lead to sleep, the gpio_cansleep() function should always return true (it is up to the GPIO controller to take of returning true). In this case, you should not access those GPIOs from within the IRQ handles, at least not in the top half (the hard IRQ). Moreover, the accessors you have to use as your general-purpose access should be suffixed with _cansleep:
static int gpio_get_value_cansleep(unsigned gpio); void gpio_set_value_cansleep(unsigned gpio, int value);
They behave exactly like accessors without the _cansleep() name suffix, with the only difference being that they prevent ...