mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Simplify some computations
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
****************************************************************************/
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user