irq: Support sleeping when mcu is idle

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-07-12 22:16:16 -04:00
parent 969485c754
commit 118fd21cb8
13 changed files with 101 additions and 10 deletions

View File

@@ -135,8 +135,7 @@ static void
process_io(void)
{
for (;;) {
if (!(read_r31() & (1 << (WAKE_PRU0_IRQ + R31_IRQ_OFFSET))))
continue;
asm("slp 1");
CT_INTC.SECR0 = (1 << KICK_PRU0_FROM_ARM_EVENT) | (1 << KICK_PRU0_EVENT);
check_can_send();
check_can_read();
@@ -327,6 +326,10 @@ main(void)
, CHAN_DESC, CHAN_PORT) != PRU_RPMSG_SUCCESS)
;
// Allow PRU0 and PRU1 to wake from sleep
PRU0_CTRL.WAKEUP_EN = 1 << (WAKE_PRU0_IRQ + R31_IRQ_OFFSET);
PRU1_CTRL.WAKEUP_EN = 1 << (WAKE_PRU1_IRQ + R31_IRQ_OFFSET);
// Wait for PRU1 to be ready
memset(SHARED_MEM, 0, sizeof(*SHARED_MEM));
writel(&SHARED_MEM->signal, SIGNAL_PRU0_WAITING);