1.[bsp][sam9260] Modify the define of irq get and ack function.
This commit is contained in:
parent
a13132b302
commit
cc6b290640
|
@ -146,7 +146,7 @@ void at91_aic_init(rt_uint32_t *priority)
|
|||
*/
|
||||
for (i = 0; i < AIC_IRQS; i++) {
|
||||
/* Put irq number in Source Vector Register: */
|
||||
at91_sys_write(AT91_AIC_SVR(i), i);
|
||||
at91_sys_write(AT91_AIC_SVR(i), i); // no-used
|
||||
/* Active Low interrupt, with the specified priority */
|
||||
at91_sys_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);
|
||||
//AT91_AIC_SRCTYPE_FALLING
|
||||
|
@ -201,12 +201,11 @@ static void at91_gpio_irq_init()
|
|||
*/
|
||||
void rt_hw_interrupt_init(void)
|
||||
{
|
||||
rt_int32_t i;
|
||||
register rt_uint32_t idx;
|
||||
rt_uint32_t *priority = at91sam9260_default_irq_priority;
|
||||
|
||||
at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
|
||||
| (1 << AT91SAM9260_ID_IRQ2);
|
||||
at91_extern_irq = (1UL << AT91SAM9260_ID_IRQ0) | (1UL << AT91SAM9260_ID_IRQ1)
|
||||
| (1UL << AT91SAM9260_ID_IRQ2);
|
||||
|
||||
/* Initialize the AIC interrupt controller */
|
||||
at91_aic_init(priority);
|
||||
|
@ -341,7 +340,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
|||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
static int at91_aic_set_type(unsigned irq, unsigned type)
|
||||
{
|
||||
unsigned int smr, srctype;
|
||||
|
@ -354,13 +353,15 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
|
|||
srctype = AT91_AIC_SRCTYPE_RISING;
|
||||
break;
|
||||
case IRQ_TYPE_LEVEL_LOW:
|
||||
if ((irq == AT91_ID_FIQ) || is_extern_irq(irq)) /* only supported on external interrupts */
|
||||
// only supported on external interrupts
|
||||
if ((irq == AT91_ID_FIQ) || is_extern_irq(irq))
|
||||
srctype = AT91_AIC_SRCTYPE_LOW;
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case IRQ_TYPE_EDGE_FALLING:
|
||||
if ((irq == AT91_ID_FIQ) || is_extern_irq(irq)) /* only supported on external interrupts */
|
||||
// only supported on external interrupts
|
||||
if ((irq == AT91_ID_FIQ) || is_extern_irq(irq))
|
||||
srctype = AT91_AIC_SRCTYPE_FALLING;
|
||||
else
|
||||
return -1;
|
||||
|
@ -373,54 +374,36 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
|
|||
at91_sys_write(AT91_AIC_SMR(irq), smr | srctype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq, rt_uint32_t* id)
|
||||
*/
|
||||
rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq)
|
||||
{
|
||||
|
||||
rt_uint32_t irqstat;
|
||||
//volatile rt_uint32_t irqstat;
|
||||
rt_uint32_t id;
|
||||
if (fiq_irq == INT_FIQ)
|
||||
{
|
||||
*id = 0;
|
||||
}
|
||||
else //IRQ
|
||||
{
|
||||
/* get irq number */
|
||||
*id = (rt_uint32_t)at91_sys_read(AT91_AIC_IVR);
|
||||
/* clear pending register */
|
||||
irqstat = (rt_uint32_t)at91_sys_read(AT91_AIC_ISR);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return irqstat;
|
||||
//IRQ
|
||||
/* AIC need this dummy read */
|
||||
at91_sys_read(AT91_AIC_IVR);
|
||||
/* clear pending register */
|
||||
id = at91_sys_read(AT91_AIC_ISR);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_ack(rt_uint32_t fiq_irq)
|
||||
void rt_hw_interrupt_ack(rt_uint32_t fiq_irq, rt_uint32_t id)
|
||||
{
|
||||
if (fiq_irq == INT_FIQ)
|
||||
{
|
||||
/* new FIQ generation */
|
||||
if (fiq_irq == INT_FIQ)
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* new IRQ generation */
|
||||
// EIOCR must be write any value after interrupt,
|
||||
// or else can't response next interrupt
|
||||
/* new IRQ generation */
|
||||
at91_sys_write(AT91_AIC_EOICR, 0x55555555);
|
||||
}
|
||||
at91_sys_write(AT91_AIC_EOICR, 0x0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
void list_irq(void)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
/*
|
||||
* File : interrupt.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2011, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-07-06 Bernard first version
|
||||
* 2015-04-14 ArdaFu first version
|
||||
*/
|
||||
|
||||
#ifndef __INTERRUPT_H__
|
||||
#define __INTERRUPT_H__
|
||||
|
||||
|
@ -19,7 +28,4 @@
|
|||
#define INT_FIQ 0x01
|
||||
|
||||
|
||||
rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq, rt_uint32_t* id);
|
||||
void rt_hw_interrupt_ack(rt_uint32_t fiq_irq);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue