cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer
Observer
362 Views
Registered: ‎03-05-2019

platform_poll on Cortex R5 ZynqMP

I am working with OpenAMP echo-test on ZynqMP. Everything works but I do not understand a part of the platfrom poll function.

This is the code:

 

int platform_poll(void *priv)
{
	struct remoteproc *rproc = priv;
	struct remoteproc_priv *prproc;
	unsigned int flags;

	prproc = rproc->priv;
	while(1) {
		flags = metal_irq_save_disable();  // <- this disables interrupts
		if (!(atomic_flag_test_and_set(&prproc->ipi_nokick))) {
			metal_irq_restore_enable(flags);
			remoteproc_get_notification(rproc, RSC_NOTIFY_ID_ANY);
			break;
		}
		_rproc_wait(); // <- this waits for an interrupt
		metal_irq_restore_enable(flags); // <- this enables interrupts back
	}
	return 0;
}

How can it be, that first irqs are disabled , and then there is a `wait for interrupt` instruction? Why do we do this? Please help me understand this part.

 

0 Kudos