arch/arm/src/samdl: Correct a link time error if CONFIG_SAMDL_EIC is not enabled.

This commit is contained in:
Gregory Nutt 2018-01-17 11:15:43 -06:00
parent 667ff07e6a
commit 2d95fa6d2a
3 changed files with 73 additions and 31 deletions

View File

@ -126,7 +126,13 @@ void sam_eic_dumpregs(void)
* Name: sam_eic_initialize
*
* Description:
* Configure the external interrupt controller.
* Initialize the external interrupt controller (EIC).
*
* Input Parameters:
* gclkgen - GCLK Generator
*
* Returned Value:
* None
*
****************************************************************************/
@ -151,6 +157,20 @@ int sam_eic_initialize(uint8_t gclkgen)
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)
{
uint32_t config;
@ -165,6 +185,21 @@ int sam_eic_irq_enable(int irq)
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)
{
uint32_t reg;
@ -179,9 +214,15 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
val = EIC_CONFIG0_SENSE_BOTH(eirq);
if (pinset & PORT_INT_RISING)
{
val = EIC_CONFIG0_SENSE_RISE(eirq);
}
if (pinset & PORT_INT_FALLING)
{
val = EIC_CONFIG0_SENSE_FALL(eirq);
}
val |= EIC_CONFIG0_FILTEN(eirq);
}
else if (eirq < 16)
@ -206,6 +247,5 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
putreg32(EIC_EXTINT(eirq), SAM_EIC_INTENSET);
sam_eic_dumpregs();
return OK;
}

View File

@ -57,19 +57,7 @@
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Data
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
@ -82,14 +70,10 @@ extern "C"
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: sam_eic_configure
* Name: sam_eic_initialize
*
* Description:
* Configure the EIC
* Initialize the EIC
*
* Input Parameters:
* gclkgen - GCLK Generator
@ -100,6 +84,22 @@ extern "C"
****************************************************************************/
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);
#undef EXTERN

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References:
@ -204,9 +204,11 @@ static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset)
putreg32(regval, base + SAM_PORT_WRCONFIG_OFFSET);
#ifdef CONFIG_SAMDL_EIC
/* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */
sam_eic_config(pin, pinset);
#endif
#ifdef CONFIG_DEBUG_GPIO_INFO
sam_dumpport(pinset, "extint");