Simplify some computations

This commit is contained in:
Gregory Nutt
2016-07-23 08:13:25 -06:00
parent 0984fcda44
commit 14de4b99f8
5 changed files with 8 additions and 53 deletions
+2 -12
View File
@@ -93,10 +93,6 @@ volatile uint32_t *g_current_regs[1];
extern uint32_t _vectors[];
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -261,15 +257,9 @@ static int efm32_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
{
if (irq < NR_VECTORS)
{
n = irq - EFM32_IRQ_INTERRUPTS;
n = irq - EFM32_IRQ_INTERRUPTS;
*regaddr = NVIC_IRQ_ENABLE(n) + offset;
while (n >= 32)
{
n -= 32;
}
*bit = 1 << n;
*bit = (uint32_t)1 << (n & 0x1f);
}
else
{
+2 -12
View File
@@ -91,10 +91,6 @@ volatile uint32_t *g_current_regs[1];
extern uint32_t _vectors[];
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -250,15 +246,9 @@ static int lpc43_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
if (irq >= LPC43_IRQ_EXTINT)
{
n = irq - LPC43_IRQ_EXTINT;
n = irq - LPC43_IRQ_EXTINT;
*regaddr = NVIC_IRQ_ENABLE(n) + offset;
while (n >= 32)
{
n -= 32;
}
*bit = 1 << n;
*bit = (uint32_t)1 << (n & 0x1f);
}
/* Handle processor exceptions. Only a few can be disabled */
-8
View File
@@ -53,10 +53,6 @@
#include "stm32_gpio.h"
#include "stm32_exti.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
@@ -65,10 +61,6 @@
static xcpt_t stm32_exti_callback;
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
+2 -8
View File
@@ -253,15 +253,9 @@ static int stm32_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
if (irq >= STM32_IRQ_FIRST)
{
n = irq - STM32_IRQ_FIRST;
n = irq - STM32_IRQ_FIRST;
*regaddr = NVIC_IRQ_ENABLE(n) + offset;
while (n >= 32)
{
n -= 32;
}
*bit = 1 << n;
*bit = (uint32_t)1 << (n & 0x1f);
}
/* Handle processor exceptions. Only a few can be disabled */
+2 -13
View File
@@ -1,8 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_irq.c
* arch/arm/src/chip/stm32l4_irq.c
*
* Copyright (C) 2009-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -90,10 +89,6 @@ volatile uint32_t *g_current_regs[1];
extern uint32_t _vectors[];
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -254,13 +249,7 @@ static int stm32l4_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
{
n = irq - STM32L4_IRQ_FIRST;
*regaddr = NVIC_IRQ_ENABLE(n) + offset;
while (n >= 32)
{
n -= 32;
}
*bit = 1 << n;
*bit = (uint32_t)1 << (n & 0x1f);
}
/* Handle processor exceptions. Only a few can be disabled */