I am trying a write a code which can be easily ported to any MCU. This MCU will act as a host and communicate with another audio codec chip. When communicating with the chip, host MCU will write a request to chip and will wait for an interrupt line to go high and then read the response from the chip.
Currently, I am using a Raspberry Pi as a host and hence I can poll
the sysfs
entries of the interrupt line. How can I achieve this in a primitive system which may not have a poll
method. I am thinking I can update a global variable in the interrupt ISR and check this global variable repeatedly. And herein lies the problem that I want to avoid. Main program loop itself may be getting called from one of the Timer interrupt handlers and busy waiting may not be a good option.
Any ideas?