STM32 F7 SDMMC: Use new interrupt argument facility.

This commit is contained in:
Gregory Nutt 2017-03-05 10:56:32 -06:00
parent 8c3d2769f9
commit 810fe33c3c

View File

@ -347,13 +347,11 @@ struct stm32_dev_s
/* STM32-specific extensions */ /* STM32-specific extensions */
uint32_t base; uint32_t base;
int nirq; int nirq;
xcpt_t handler;
#ifdef CONFIG_ARCH_IRQPRIO #ifdef CONFIG_ARCH_IRQPRIO
int irqprio; int irqprio;
#endif #endif
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
uint32_t d0_gpio; uint32_t d0_gpio;
xcpt_t wrchandler;
#endif #endif
#ifdef CONFIG_STM32F7_SDMMC_DMA #ifdef CONFIG_STM32F7_SDMMC_DMA
uint32_t dmapri; uint32_t dmapri;
@ -470,22 +468,9 @@ static void stm32_endtransfer(struct stm32_dev_s *priv, sdio_eventset_t wkupeven
/* Interrupt Handling *******************************************************/ /* Interrupt Handling *******************************************************/
static int stm32_sdmmc_interrupt(struct stm32_dev_s *sdmmc_dev); static int stm32_sdmmc_interrupt(int irq, void *context, void *arg);
#ifdef CONFIG_STM32F7_SDMMC1
static int stm32_sdmmc1_interrupt(int irq, void *context, void *arg);
#endif
#ifdef CONFIG_STM32F7_SDMMC2
static int stm32_sdmmc2_interrupt(int irq, void *context, void *arg);
#endif
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
#ifdef CONFIG_STM32F7_SDMMC1 static int stm32_sdmmc_rdyinterrupt(int irq, void *context, void *arg);
static int stm32_sdmmc1_rdyinterrupt(int irq, void *context, void *arg);
#endif
#ifdef CONFIG_STM32F7_SDMMC2
static int stm32_sdmmc2_rdyinterrupt(int irq, void *context, void *arg);
#endif
#endif #endif
/* SDIO interface methods ***************************************************/ /* SDIO interface methods ***************************************************/
@ -609,13 +594,11 @@ struct stm32_dev_s g_sdmmcdev1 =
}, },
.base = STM32_SDMMC1_BASE, .base = STM32_SDMMC1_BASE,
.nirq = STM32_IRQ_SDMMC1, .nirq = STM32_IRQ_SDMMC1,
.handler = stm32_sdmmc1_interrupt,
#ifdef CONFIG_SDMMC1_PRI #ifdef CONFIG_SDMMC1_PRI
.irqprio = CONFIG_SDMMC1_PRI, .irqprio = CONFIG_SDMMC1_PRI,
#endif #endif
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
.d0_gpio = GPIO_SDMMC1_D0, .d0_gpio = GPIO_SDMMC1_D0,
.wrchandler = stm32_sdmmc1_rdyinterrupt,
#endif #endif
#ifdef CONFIG_STM32F7_SDMMC1_DMAPRIO #ifdef CONFIG_STM32F7_SDMMC1_DMAPRIO
.dmapri = CONFIG_STM32F7_SDMMC1_DMAPRIO, .dmapri = CONFIG_STM32F7_SDMMC1_DMAPRIO,
@ -665,13 +648,11 @@ struct stm32_dev_s g_sdmmcdev2 =
}, },
.base = STM32_SDMMC2_BASE, .base = STM32_SDMMC2_BASE,
.nirq = STM32_IRQ_SDMMC2, .nirq = STM32_IRQ_SDMMC2,
.handler = stm32_sdmmc2_interrupt,
#ifdef CONFIG_SDMMC2_PRI #ifdef CONFIG_SDMMC2_PRI
.irqprio = CONFIG_SDMMC2_PRI, .irqprio = CONFIG_SDMMC2_PRI,
#endif #endif
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
.d0_gpio = GPIO_SDMMC2_D0, .d0_gpio = GPIO_SDMMC2_D0,
.wrchandler = stm32_sdmmc2_rdyinterrupt,
#endif #endif
#ifdef CONFIG_STM32F7_SDMMC2_DMAPRIO #ifdef CONFIG_STM32F7_SDMMC2_DMAPRIO
.dmapri = CONFIG_STM32F7_SDMMC2_DMAPRIO, .dmapri = CONFIG_STM32F7_SDMMC2_DMAPRIO,
@ -847,7 +828,7 @@ static void stm32_configwaitints(struct stm32_dev_s *priv, uint32_t waitmask,
/* Arm the SDMMC_D Ready and install Isr */ /* Arm the SDMMC_D Ready and install Isr */
(void)stm32_gpiosetevent(pinset, true, false, false, (void)stm32_gpiosetevent(pinset, true, false, false,
priv->wrchandler, priv); stm32_sdmmc_rdyinterrupt, priv);
} }
/* Disarm SDMMC_D ready */ /* Disarm SDMMC_D ready */
@ -1507,30 +1488,19 @@ static void stm32_endtransfer(struct stm32_dev_s *priv,
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
# if defined(CONFIG_STM32F7_SDMMC1) static int stm32_sdmmc_rdyinterrupt(int irq, void *context, void *arg)
static int stm32_sdmmc1_rdyinterrupt(int irq, void *context, void *arg)
{ {
struct stm32_dev_s *priv = (struct stm32_dev_s *)arg; struct stm32_dev_s *priv = (struct stm32_dev_s *)arg;
stm32_endwait(priv, SDIOWAIT_WRCOMPLETE); stm32_endwait(priv, SDIOWAIT_WRCOMPLETE);
return OK; return OK;
} }
# endif
# if defined(CONFIG_STM32F7_SDMMC2)
static int stm32_sdmmc2_rdyinterrupt(int irq, void *context, void *arg)
{
struct stm32_dev_s *priv = (struct stm32_dev_s *)arg;
stm32_endwait(priv, SDIOWAIT_WRCOMPLETE);
return OK;
}
# endif
#endif #endif
/**************************************************************************** /****************************************************************************
* Name: stm32_sdmmc_interrupt * Name: stm32_sdmmc_interrupt
* *
* Description: * Description:
* SDMMC common interrupt handler * SDMMC interrupt handler
* *
* Input Parameters: * Input Parameters:
* priv - Instance of the SDMMC private state structure. * priv - Instance of the SDMMC private state structure.
@ -1540,11 +1510,14 @@ static int stm32_sdmmc2_rdyinterrupt(int irq, void *context, void *arg)
* *
****************************************************************************/ ****************************************************************************/
static int stm32_sdmmc_interrupt(struct stm32_dev_s *priv) static int stm32_sdmmc_interrupt(int irq, void *context, void *arg);
{ {
struct stm32_dev_s *priv =(struct stm32_dev_s *)arg;
uint32_t enabled; uint32_t enabled;
uint32_t pending; uint32_t pending;
DEBUGASSERT(priv != NULL);
/* Loop while there are pending interrupts. Check the SDIO status /* Loop while there are pending interrupts. Check the SDIO status
* register. Mask out all bits that don't correspond to enabled * register. Mask out all bits that don't correspond to enabled
* interrupts. (This depends on the fact that bits are ordered * interrupts. (This depends on the fact that bits are ordered
@ -1728,49 +1701,6 @@ static int stm32_sdmmc_interrupt(struct stm32_dev_s *priv)
return OK; return OK;
} }
/****************************************************************************
* Name: stm32_sdmmc1_interrupt
*
* Description:
* SDMMC 1 interrupt handler wrapper
*
* Input Parameters:
* irq - not used
* context - not used
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_STM32F7_SDMMC1
static int stm32_sdmmc1_interrupt(int irq, void *context, void *arg)
{
return stm32_sdmmc_interrupt(&g_sdmmcdev1);
}
#endif
/****************************************************************************
* Name: stm32_sdmmc2_interrupt
*
* Description:
* SDMMC 2 interrupt handler wrapper
*
* Input Parameters:
* irq - not used
* context - not used
*
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_STM32F7_SDMMC2
static int stm32_sdmmc2_interrupt(int irq, void *context, void *arg)
{
return stm32_sdmmc_interrupt(&g_sdmmcdev2);
}
#endif
/**************************************************************************** /****************************************************************************
* SDIO Interface Methods * SDIO Interface Methods
****************************************************************************/ ****************************************************************************/
@ -2023,8 +1953,7 @@ static int stm32_attach(FAR struct sdio_dev_s *dev)
/* Attach the SDIO interrupt handler */ /* Attach the SDIO interrupt handler */
ret = irq_attach(priv->nirq, priv->handler, NULL); ret = irq_attach(priv->nirq, stm32_sdmmc_interrupt, priv);
if (ret == OK) if (ret == OK)
{ {
@ -3066,6 +2995,7 @@ static int stm32_dmasendsetup(FAR struct sdio_dev_s *dev,
/**************************************************************************** /****************************************************************************
* Initialization/uninitialization/reset * Initialization/uninitialization/reset
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: stm32_callback * Name: stm32_callback
* *