From 90a26718330f58a884d3ddb603e3e1c3cb333958 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 30 Jun 2010 07:08:10 +0000 Subject: [PATCH] i.MX31: Make DMA ISR call loop a bit more efficient. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27192 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/imx31/sdma-imx31.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/firmware/target/arm/imx31/sdma-imx31.c b/firmware/target/arm/imx31/sdma-imx31.c index 39f4e29554..68aa0aa35f 100644 --- a/firmware/target/arm/imx31/sdma-imx31.c +++ b/firmware/target/arm/imx31/sdma-imx31.c @@ -53,19 +53,13 @@ static void __attribute__((interrupt("IRQ"))) SDMA_HANDLER(void) SDMA_INTR = pending; /* Ack all ints */ pending &= sdma_enabled_ints; /* Only dispatch ints with callback */ - while (1) + while (pending) { - unsigned int channel; + unsigned int bit = pending & -pending; /* Isolate bottom bit */ + pending &= ~bit; /* Clear it */ - if (pending == 0) - break; /* No bits set */ - - channel = find_first_set_bit(pending); - - pending &= ~(1ul << channel); - - /* Call callback (required if using an interrupt) */ - ccb_array[channel].channel_desc->callback(); + /* Call callback (required if using an interrupt). bit number = channel */ + ccb_array[31 - __builtin_clz(bit)].channel_desc->callback(); } }