From e231b667aa349ca3ae8f1085dc56d035650a6d65 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 6 Dec 2023 13:17:55 +0800 Subject: [PATCH] scripts: build: gen_isr_tables: change naming of bitmask variables Rename the bitmask variables from `*_LVL_INTERRUPTS` to `INTERRUPT_LVL_BITMASK[]` array to be consistent with `INTERRUPT_BITS`, making it easier to loop over the bitmasks. Signed-off-by: Yong Cong Sin (cherry picked from commit b4db285c1fde9dcd287c1f0b084b7c6eaa691bfe) --- scripts/build/gen_isr_tables.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index c2d01ce21ae80a..dd54567c7beeb6 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -23,9 +23,7 @@ # into 1 line which then goes into the 1st level) # 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel # into 1 line which then goes into the 2nd level) -FIRST_LVL_INTERRUPTS = 0x000000FF -SECND_LVL_INTERRUPTS = 0x0000FF00 -THIRD_LVL_INTERRUPTS = 0x00FF0000 +INTERRUPT_LVL_BITMASK = [0x000000FF, 0x0000FF00, 0x00FF0000] INTERRUPT_BITS = [8, 8, 8] @@ -269,16 +267,12 @@ def bit_mask(bits): return mask def update_masks(): - global FIRST_LVL_INTERRUPTS - global SECND_LVL_INTERRUPTS - global THIRD_LVL_INTERRUPTS - if sum(INTERRUPT_BITS) > 32: raise ValueError("Too many interrupt bits") - FIRST_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[0]) - SECND_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) + INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] def main(): parse_args() @@ -368,9 +362,9 @@ def main(): else: # Figure out third level interrupt position debug('IRQ = ' + hex(irq)) - irq3 = (irq & THIRD_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - irq2 = (irq & SECND_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] - irq1 = irq & FIRST_LVL_INTERRUPTS + irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> INTERRUPT_BITS[0] + irq1 = irq & INTERRUPT_LVL_BITMASK[0] if irq3: irq_parent = irq2