arch/arm/src/samdl: Correct a link time error if CONFIG_SAMDL_EIC is not enabled.
This commit is contained in:
parent
667ff07e6a
commit
2d95fa6d2a
@ -83,7 +83,7 @@ static int sam_eic_isr(int irq, FAR void *context, FAR void *arg)
|
|||||||
|
|
||||||
for(bit=0;bit<SAM_IRQ_NEXTINTS;bit++)
|
for(bit=0;bit<SAM_IRQ_NEXTINTS;bit++)
|
||||||
{
|
{
|
||||||
if(intflag >> bit & 0x1)
|
if (intflag >> bit & 0x1)
|
||||||
{
|
{
|
||||||
irq_dispatch(SAM_IRQ_EXTINT0 + bit, context);
|
irq_dispatch(SAM_IRQ_EXTINT0 + bit, context);
|
||||||
}
|
}
|
||||||
@ -126,7 +126,13 @@ void sam_eic_dumpregs(void)
|
|||||||
* Name: sam_eic_initialize
|
* Name: sam_eic_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Configure the external interrupt controller.
|
* Initialize the external interrupt controller (EIC).
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* gclkgen - GCLK Generator
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -151,12 +157,26 @@ int sam_eic_initialize(uint8_t gclkgen)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sam_eic_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Enable a external interrupt.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* irq - SAM_IRQ_EXTINTn IRQ to be enabled
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int sam_eic_irq_enable(int irq)
|
int sam_eic_irq_enable(int irq)
|
||||||
{
|
{
|
||||||
uint32_t config;
|
uint32_t config;
|
||||||
int eirq = irq - SAM_IRQ_EXTINT0;
|
int eirq = irq - SAM_IRQ_EXTINT0;
|
||||||
|
|
||||||
config = getreg32(SAM_EIC_CONFIG0);
|
config = getreg32(SAM_EIC_CONFIG0);
|
||||||
config |= EIC_CONFIG0_FILTEN(eirq) | EIC_CONFIG0_SENSE_FALL(eirq);
|
config |= EIC_CONFIG0_FILTEN(eirq) | EIC_CONFIG0_SENSE_FALL(eirq);
|
||||||
putreg32(config, SAM_EIC_CONFIG0);
|
putreg32(config, SAM_EIC_CONFIG0);
|
||||||
|
|
||||||
@ -165,6 +185,21 @@ int sam_eic_irq_enable(int irq)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sam_eic_config
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the interrupt edge sensitivity in CONFIGn register of the EIC
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* eirq - Pin to be configured
|
||||||
|
* pinset - Configuration of the pin
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
|
int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
|
||||||
{
|
{
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
@ -173,18 +208,24 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
|
|||||||
|
|
||||||
/* Determine which of the CONFIG[0:2] registers to write to */
|
/* Determine which of the CONFIG[0:2] registers to write to */
|
||||||
|
|
||||||
if(eirq < 8)
|
if (eirq < 8)
|
||||||
{
|
{
|
||||||
reg = SAM_EIC_CONFIG0;
|
reg = SAM_EIC_CONFIG0;
|
||||||
|
|
||||||
val = EIC_CONFIG0_SENSE_BOTH(eirq);
|
val = EIC_CONFIG0_SENSE_BOTH(eirq);
|
||||||
if(pinset & PORT_INT_RISING)
|
if (pinset & PORT_INT_RISING)
|
||||||
val = EIC_CONFIG0_SENSE_RISE(eirq);
|
{
|
||||||
if(pinset & PORT_INT_FALLING)
|
val = EIC_CONFIG0_SENSE_RISE(eirq);
|
||||||
val = EIC_CONFIG0_SENSE_FALL(eirq);
|
}
|
||||||
|
|
||||||
|
if (pinset & PORT_INT_FALLING)
|
||||||
|
{
|
||||||
|
val = EIC_CONFIG0_SENSE_FALL(eirq);
|
||||||
|
}
|
||||||
|
|
||||||
val |= EIC_CONFIG0_FILTEN(eirq);
|
val |= EIC_CONFIG0_FILTEN(eirq);
|
||||||
}
|
}
|
||||||
else if(eirq < 16)
|
else if (eirq < 16)
|
||||||
{
|
{
|
||||||
reg = SAM_EIC_CONFIG1;
|
reg = SAM_EIC_CONFIG1;
|
||||||
val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq);
|
val = EIC_CONFIG1_FILTEN(eirq) | EIC_CONFIG1_SENSE_FALL(eirq);
|
||||||
@ -197,7 +238,7 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
|
|||||||
|
|
||||||
/* Write the new config to the CONFIGn register */
|
/* Write the new config to the CONFIGn register */
|
||||||
|
|
||||||
config = getreg32(reg);
|
config = getreg32(reg);
|
||||||
config |= val;
|
config |= val;
|
||||||
putreg32(config, reg);
|
putreg32(config, reg);
|
||||||
|
|
||||||
@ -206,6 +247,5 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
|
|||||||
putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET);
|
putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET);
|
||||||
|
|
||||||
sam_eic_dumpregs();
|
sam_eic_dumpregs();
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -57,19 +57,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Types
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Inline Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@ -82,14 +70,10 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Name: sam_eic_initialize
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: sam_eic_configure
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Configure the EIC
|
* Initialize the EIC
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* gclkgen - GCLK Generator
|
* gclkgen - GCLK Generator
|
||||||
@ -100,6 +84,22 @@ extern "C"
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sam_eic_initialize(uint8_t gclkgen);
|
int sam_eic_initialize(uint8_t gclkgen);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sam_eic_config
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the interrupt edge sensitivity in CONFIGn register of the EIC
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* eirq - Pin to be configured
|
||||||
|
* pinset - Configuration of the pin
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int sam_eic_config(uint8_t eirq, port_pinset_t pinset);
|
int sam_eic_config(uint8_t eirq, port_pinset_t pinset);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/samdl/sam_port.c
|
* arch/arm/src/samdl/sam_port.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@ -204,9 +204,11 @@ static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset)
|
|||||||
|
|
||||||
putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET);
|
putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMDL_EIC
|
||||||
/* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */
|
/* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */
|
||||||
|
|
||||||
sam_eic_config(pin, pinset);
|
sam_eic_config(pin, pinset);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_GPIO_INFO
|
#ifdef CONFIG_DEBUG_GPIO_INFO
|
||||||
sam_dumpport(pinset, "extint");
|
sam_dumpport(pinset, "extint");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user