EFM32, STM32, and STM32 F7 I2C: Update to use the standard parameter passing to interrupt handlers.

This commit is contained in:
Gregory Nutt 2017-04-30 11:56:06 -06:00
parent dee736bd0d
commit c172d7cf63
6 changed files with 105 additions and 377 deletions

View File

@ -220,7 +220,6 @@ struct efm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr) (int, void *, void *); /* Interrupt handler */
uint32_t irq; /* Event IRQ */ uint32_t irq; /* Event IRQ */
#endif #endif
}; };
@ -294,15 +293,10 @@ static void efm32_i2c_tracedump(FAR struct efm32_i2c_priv_s *priv);
static void efm32_i2c_setclock(FAR struct efm32_i2c_priv_s *priv, static void efm32_i2c_setclock(FAR struct efm32_i2c_priv_s *priv,
uint32_t frequency); uint32_t frequency);
static int efm32_i2c_isr(struct efm32_i2c_priv_s *priv); static int efm32_i2c_isr_process(struct efm32_i2c_priv_s *priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_EFM32_I2C0 static int efm32_i2c_isr(int irq, void *context, FAR void *arg);
static int efm32_i2c0_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_EFM32_I2C1
static int efm32_i2c1_isr(int irq, void *context, FAR void *arg);
#endif
#endif /* !CONFIG_I2C_POLLED */ #endif /* !CONFIG_I2C_POLLED */
static void efm32_i2c_hwreset(FAR struct efm32_i2c_priv_s *priv); static void efm32_i2c_hwreset(FAR struct efm32_i2c_priv_s *priv);
@ -343,7 +337,6 @@ static const struct efm32_i2c_config_s efm32_i2c0_config =
.scl_pin = BOARD_I2C0_SCL, .scl_pin = BOARD_I2C0_SCL,
.sda_pin = BOARD_I2C0_SDA, .sda_pin = BOARD_I2C0_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = efm32_i2c0_isr,
.irq = EFM32_IRQ_I2C0 .irq = EFM32_IRQ_I2C0
#endif #endif
}; };
@ -371,7 +364,6 @@ static const struct efm32_i2c_config_s efm32_i2c1_config =
.scl_pin = BOARD_I2C1_SCL, .scl_pin = BOARD_I2C1_SCL,
.sda_pin = BOARD_I2C1_SDA, .sda_pin = BOARD_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = efm32_i2c1_isr,
.irq = EFM32_IRQ_I2C1 .irq = EFM32_IRQ_I2C1
#endif #endif
}; };
@ -632,7 +624,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
* that it is done. * that it is done.
*/ */
efm32_i2c_isr(priv); efm32_i2c_isr_process(priv);
/* Calculate the elapsed time */ /* Calculate the elapsed time */
@ -869,14 +861,14 @@ static void efm32_i2c_setclock(FAR struct efm32_i2c_priv_s *priv,
} }
/**************************************************************************** /****************************************************************************
* Name: efm32_i2c_isr * Name: efm32_i2c_isr_process
* *
* Description: * Description:
* Common Interrupt Service Routine * Common Interrupt Service Routine
* *
****************************************************************************/ ****************************************************************************/
static int efm32_i2c_isr(struct efm32_i2c_priv_s *priv) static int efm32_i2c_isr_process(struct efm32_i2c_priv_s *priv)
{ {
for (; ; ) for (; ; )
{ {
@ -1279,44 +1271,24 @@ done:
return OK; return OK;
} }
/****************************************************************************
* Name: efm32_i2c_isr
*
* Description:
* Common I2C interrupt service routine
*
****************************************************************************/
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
static int efm32_i2c_isr(int irq, void *context, FAR void *arg)
/****************************************************************************
* Name: efm32_i2c0_isr
*
* Description:
* I2C0 interrupt service routine
*
****************************************************************************/
#ifdef CONFIG_EFM32_I2C0
static int efm32_i2c0_isr(int irq, void *context, FAR void *arg)
{ {
return efm32_i2c_isr(&efm32_i2c0_priv); struct efm32_i2c_priv_s *priv = (struct efm32_i2c_priv_s *)arg;
DEBUGASSERT(priv != NULL);
return efm32_i2c_isr_process(priv);
} }
#endif #endif
/****************************************************************************
* Name: efm32_i2c1_isr
*
* Description:
* I2C1 interrupt service routine
*
****************************************************************************/
#ifdef CONFIG_EFM32_I2C1
static int efm32_i2c1_isr(int irq, void *context, FAR void *arg)
{
return efm32_i2c_isr(&efm32_i2c1_priv);
}
#endif
#endif
/****************************************************************************
* Private Initialization and Deinitialization
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: efm32_i2c_hwreset * Name: efm32_i2c_hwreset
* *
@ -1389,7 +1361,7 @@ static int efm32_i2c_init(FAR struct efm32_i2c_priv_s *priv)
/* Attach ISRs */ /* Attach ISRs */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
irq_attach(priv->config->irq, priv->config->isr, NULL); irq_attach(priv->config->irq, efm32_i2c_isr, priv);
up_enable_irq(priv->config->irq); up_enable_irq(priv->config->irq);
#endif #endif
@ -1523,7 +1495,7 @@ static int efm32_i2c_transfer(FAR struct i2c_master_s *dev,
* be enabled in efm32_i2c_sem_waitdone if CONFIG_I2C_POLLED is NOT defined * be enabled in efm32_i2c_sem_waitdone if CONFIG_I2C_POLLED is NOT defined
*/ */
efm32_i2c_isr(priv); efm32_i2c_isr_process(priv);
/* Wait for an ISR, if there was a timeout, fetch latest status to get the /* Wait for an ISR, if there was a timeout, fetch latest status to get the
* BUSY flag. * BUSY flag.

View File

@ -230,7 +230,6 @@ struct stm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */ uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */ uint32_t er_irq; /* Error IRQ */
#endif #endif
@ -313,18 +312,10 @@ static inline uint32_t stm32_i2c_disablefsmc(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_enablefsmc(uint32_t ahbenr); static inline void stm32_i2c_enablefsmc(uint32_t ahbenr);
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); static int stm32_i2c_isr_process(struct stm32_i2c_priv_s * priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg);
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg);
#endif
#endif /* !CONFIG_I2C_POLLED */ #endif /* !CONFIG_I2C_POLLED */
static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv);
@ -379,7 +370,6 @@ static const struct stm32_i2c_config_s stm32_i2c1_config =
.scl_pin = GPIO_I2C1_SCL, .scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA, .sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c1_isr,
.ev_irq = STM32_IRQ_I2C1EV, .ev_irq = STM32_IRQ_I2C1EV,
.er_irq = STM32_IRQ_I2C1ER .er_irq = STM32_IRQ_I2C1ER
#endif #endif
@ -409,7 +399,6 @@ static const struct stm32_i2c_config_s stm32_i2c2_config =
.scl_pin = GPIO_I2C2_SCL, .scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA, .sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c2_isr,
.ev_irq = STM32_IRQ_I2C2EV, .ev_irq = STM32_IRQ_I2C2EV,
.er_irq = STM32_IRQ_I2C2ER .er_irq = STM32_IRQ_I2C2ER
#endif #endif
@ -439,7 +428,6 @@ static const struct stm32_i2c_config_s stm32_i2c3_config =
.scl_pin = GPIO_I2C3_SCL, .scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA, .sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c3_isr,
.ev_irq = STM32_IRQ_I2C3EV, .ev_irq = STM32_IRQ_I2C3EV,
.er_irq = STM32_IRQ_I2C3ER .er_irq = STM32_IRQ_I2C3ER
#endif #endif
@ -678,7 +666,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
* reports that it is done. * reports that it is done.
*/ */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
/* Loop until the transfer is complete. */ /* Loop until the transfer is complete. */
@ -1172,14 +1160,14 @@ static inline void stm32_i2c_enablefsmc(uint32_t ahbenr)
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_process
* *
* Description: * Description:
* Common Interrupt Service Routine * Common Interrupt Service Routine
* *
************************************************************************************/ ************************************************************************************/
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
{ {
uint32_t status = stm32_i2c_getstatus(priv); uint32_t status = stm32_i2c_getstatus(priv);
@ -1459,56 +1447,23 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c1_isr * Name: stm32_i2c_isr
* *
* Description: * Description:
* I2C1 interrupt service routine * Common I2C interrupt service routine
* *
************************************************************************************/ ************************************************************************************/
#ifndef CONFIG_I2C_POLLED #ifdef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c1_priv);
}
#endif
/************************************************************************************
* Name: stm32_i2c2_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) static int stm32_i2c2_isr(int irq, void *context, FAR void *arg)
{ {
return stm32_i2c_isr(&stm32_i2c2_priv); struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)arg;
DEBUGASSERT(priv != NULL);
return stm32_i2c_isr_process(priv);
} }
#endif #endif
/************************************************************************************
* Name: stm32_i2c3_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c3_priv);
}
#endif
#endif
/************************************************************************************
* Private Initialization and Deinitialization
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_init * Name: stm32_i2c_init
* *
@ -1543,8 +1498,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
/* Attach ISRs */ /* Attach ISRs */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
irq_attach(priv->config->ev_irq, priv->config->isr, NULL); irq_attach(priv->config->ev_irq, stm32_i2c_isr, priv);
irq_attach(priv->config->er_irq, priv->config->isr, NULL); irq_attach(priv->config->er_irq, stm32_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq); up_enable_irq(priv->config->er_irq);
#endif #endif

View File

@ -257,7 +257,6 @@ struct stm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */ uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */ uint32_t er_irq; /* Error IRQ */
#endif #endif
@ -342,18 +341,10 @@ static inline uint32_t stm32_i2c_disablefsmc(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_enablefsmc(uint32_t ahbenr); static inline void stm32_i2c_enablefsmc(uint32_t ahbenr);
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); static int stm32_i2c_isr_process(struct stm32_i2c_priv_s * priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg);
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg);
#endif
#endif /* !CONFIG_I2C_POLLED */ #endif /* !CONFIG_I2C_POLLED */
static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv);
@ -387,7 +378,6 @@ static const struct stm32_i2c_config_s stm32_i2c1_config =
.scl_pin = GPIO_I2C1_SCL, .scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA, .sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c1_isr,
.ev_irq = STM32_IRQ_I2C1EV, .ev_irq = STM32_IRQ_I2C1EV,
.er_irq = STM32_IRQ_I2C1ER .er_irq = STM32_IRQ_I2C1ER
#endif #endif
@ -417,7 +407,6 @@ static const struct stm32_i2c_config_s stm32_i2c2_config =
.scl_pin = GPIO_I2C2_SCL, .scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA, .sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c2_isr,
.ev_irq = STM32_IRQ_I2C2EV, .ev_irq = STM32_IRQ_I2C2EV,
.er_irq = STM32_IRQ_I2C2ER .er_irq = STM32_IRQ_I2C2ER
#endif #endif
@ -447,7 +436,6 @@ static const struct stm32_i2c_config_s stm32_i2c3_config =
.scl_pin = GPIO_I2C3_SCL, .scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA, .sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c3_isr,
.ev_irq = STM32_IRQ_I2C3EV, .ev_irq = STM32_IRQ_I2C3EV,
.er_irq = STM32_IRQ_I2C3ER .er_irq = STM32_IRQ_I2C3ER
#endif #endif
@ -686,7 +674,7 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
* reports that it is done. * reports that it is done.
*/ */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
/* Loop until the transfer is complete. */ /* Loop until the transfer is complete. */
@ -1180,7 +1168,7 @@ static inline void stm32_i2c_enablefsmc(uint32_t ahbenr)
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_process
* *
* Description: * Description:
* Common interrupt service routine (ISR) that handles I2C protocol logic. * Common interrupt service routine (ISR) that handles I2C protocol logic.
@ -1202,7 +1190,7 @@ static inline void stm32_i2c_enablefsmc(uint32_t ahbenr)
* *
************************************************************************************/ ************************************************************************************/
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
{ {
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
uint32_t regval; uint32_t regval;
@ -1892,56 +1880,23 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c1_isr * Name: stm32_i2c_isr
* *
* Description: * Description:
* I2C1 interrupt service routine * Common I2C interrupt service routine
* *
************************************************************************************/ ************************************************************************************/
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg)
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg)
{ {
return stm32_i2c_isr(&stm32_i2c1_priv); struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s )arg;
DEBUGASSERT(priv != NULL);
return stm32_i2c_isr_process(priv);
} }
#endif #endif
/************************************************************************************
* Name: stm32_i2c2_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c2_priv);
}
#endif
/************************************************************************************
* Name: stm32_i2c3_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c3_priv);
}
#endif
#endif
/************************************************************************************
* Private Initialization and Deinitialization
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_init * Name: stm32_i2c_init
* *
@ -1976,8 +1931,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
/* Attach ISRs */ /* Attach ISRs */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
irq_attach(priv->config->ev_irq, priv->config->isr, NULL); irq_attach(priv->config->ev_irq, stm32_i2c_isr, priv);
irq_attach(priv->config->er_irq, priv->config->isr, NULL); irq_attach(priv->config->er_irq, stm32_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq); up_enable_irq(priv->config->er_irq);
#endif #endif

View File

@ -222,7 +222,6 @@ struct stm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */ uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */ uint32_t er_irq; /* Error IRQ */
#endif #endif
@ -301,17 +300,9 @@ static inline void stm32_i2c_sendstart(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_clrstart(FAR struct stm32_i2c_priv_s *priv); static inline void stm32_i2c_clrstart(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sendstop(FAR struct stm32_i2c_priv_s *priv); static inline void stm32_i2c_sendstop(FAR struct stm32_i2c_priv_s *priv);
static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv); static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv);
static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); static int stm32_i2c_isr_process(struct stm32_i2c_priv_s * priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg);
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg);
#endif
#endif #endif
static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv);
static int stm32_i2c_deinit(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_deinit(FAR struct stm32_i2c_priv_s *priv);
@ -344,7 +335,6 @@ static const struct stm32_i2c_config_s stm32_i2c1_config =
.scl_pin = GPIO_I2C1_SCL, .scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA, .sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c1_isr,
.ev_irq = STM32_IRQ_I2C1EV, .ev_irq = STM32_IRQ_I2C1EV,
.er_irq = STM32_IRQ_I2C1ER .er_irq = STM32_IRQ_I2C1ER
#endif #endif
@ -374,7 +364,6 @@ static const struct stm32_i2c_config_s stm32_i2c2_config =
.scl_pin = GPIO_I2C2_SCL, .scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA, .sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c2_isr,
.ev_irq = STM32_IRQ_I2C2EV, .ev_irq = STM32_IRQ_I2C2EV,
.er_irq = STM32_IRQ_I2C2ER .er_irq = STM32_IRQ_I2C2ER
#endif #endif
@ -404,7 +393,6 @@ static const struct stm32_i2c_config_s stm32_i2c3_config =
.scl_pin = GPIO_I2C3_SCL, .scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA, .sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c3_isr,
.ev_irq = STM32_IRQ_I2C3EV, .ev_irq = STM32_IRQ_I2C3EV,
.er_irq = STM32_IRQ_I2C3ER .er_irq = STM32_IRQ_I2C3ER
#endif #endif
@ -712,7 +700,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
* reports that it is done. * reports that it is done.
*/ */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
/* Loop until the transfer is complete. */ /* Loop until the transfer is complete. */
@ -1243,7 +1231,7 @@ static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_startmessage
* *
* Description: * Description:
* Common logic when a message is started. Just adds the even to the trace buffer * Common logic when a message is started. Just adds the even to the trace buffer
@ -1276,14 +1264,14 @@ static inline void stm32_i2c_clearinterrupts(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_process
* *
* Description: * Description:
* Common Interrupt Service Routine * Common Interrupt Service Routine
* *
************************************************************************************/ ************************************************************************************/
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
{ {
uint32_t status = stm32_i2c_getstatus(priv); uint32_t status = stm32_i2c_getstatus(priv);
@ -1485,56 +1473,23 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c1_isr * Name: stm32_i2c_isr
* *
* Description: * Description:
* I2C1 interrupt service routine * Common I2C interrupt service routine
* *
************************************************************************************/ ************************************************************************************/
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg)
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg)
{ {
return stm32_i2c_isr(&stm32_i2c1_priv); struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)arg;
DEBUGASSERT(priv != NULL);
return stm32_i2c_isr_process(priv);
} }
#endif #endif
/************************************************************************************
* Name: stm32_i2c2_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c2_priv);
}
#endif
/************************************************************************************
* Name: stm32_i2c3_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c3_priv);
}
#endif
#endif
/************************************************************************************
* Private Initialization and Deinitialization
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_init * Name: stm32_i2c_init
* *
@ -1569,8 +1524,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
/* Attach ISRs */ /* Attach ISRs */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
irq_attach(priv->config->ev_irq, priv->config->isr, NULL); irq_attach(priv->config->ev_irq, stm32_i2c_isr, priv);
irq_attach(priv->config->er_irq, priv->config->isr, NULL); irq_attach(priv->config->er_irq, stm32_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq); up_enable_irq(priv->config->er_irq);
#endif #endif

View File

@ -245,7 +245,6 @@ struct stm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */ uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */ uint32_t er_irq; /* Error IRQ */
#endif #endif
@ -339,18 +338,10 @@ static inline uint32_t stm32_i2c_disablefsmc(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_enablefsmc(uint32_t ahbenr); static inline void stm32_i2c_enablefsmc(uint32_t ahbenr);
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg);
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg);
#endif
#endif /* !CONFIG_I2C_POLLED */ #endif /* !CONFIG_I2C_POLLED */
static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv);
@ -364,8 +355,8 @@ static int stm32_i2c_reset(FAR struct i2c_master_s *dev);
/* DMA support */ /* DMA support */
#ifdef CONFIG_STM32_I2C_DMA #ifdef CONFIG_STM32_I2C_DMA
static void stm32_i2c_dmarxcallback(DMA_HANDLE handle, uint8_t isr, void *arg); static void stm32_i2c_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
static void stm32_i2c_dmatxcallback(DMA_HANDLE handle, uint8_t isr, void *arg); static void stm32_i2c_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif #endif
/************************************************************************************ /************************************************************************************
@ -412,7 +403,6 @@ static const struct stm32_i2c_config_s stm32_i2c1_config =
.scl_pin = GPIO_I2C1_SCL, .scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA, .sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c1_isr,
.ev_irq = STM32_IRQ_I2C1EV, .ev_irq = STM32_IRQ_I2C1EV,
.er_irq = STM32_IRQ_I2C1ER .er_irq = STM32_IRQ_I2C1ER
#endif #endif
@ -451,7 +441,6 @@ static const struct stm32_i2c_config_s stm32_i2c2_config =
.scl_pin = GPIO_I2C2_SCL, .scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA, .sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c2_isr,
.ev_irq = STM32_IRQ_I2C2EV, .ev_irq = STM32_IRQ_I2C2EV,
.er_irq = STM32_IRQ_I2C2ER .er_irq = STM32_IRQ_I2C2ER
#endif #endif
@ -488,7 +477,6 @@ static const struct stm32_i2c_config_s stm32_i2c3_config =
.scl_pin = GPIO_I2C3_SCL, .scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA, .sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c3_isr,
.ev_irq = STM32_IRQ_I2C3EV, .ev_irq = STM32_IRQ_I2C3EV,
.er_irq = STM32_IRQ_I2C3ER .er_irq = STM32_IRQ_I2C3ER
#endif #endif
@ -734,7 +722,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
* reports that it is done. * reports that it is done.
*/ */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
/* Loop until the transfer is complete. */ /* Loop until the transfer is complete. */
@ -1229,14 +1217,14 @@ static inline void stm32_i2c_enablefsmc(uint32_t ahbenr)
#endif /* I2C1_FSMC_CONFLICT */ #endif /* I2C1_FSMC_CONFLICT */
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_process
* *
* Description: * Description:
* Common Interrupt Service Routine * Common Interrupt Service Routine
* *
************************************************************************************/ ************************************************************************************/
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
{ {
uint32_t status; uint32_t status;
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
@ -2069,6 +2057,24 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
return OK; return OK;
} }
/************************************************************************************
* Name: stm32_i2c_isr
*
* Description:
* Common I2C interrupt service routine
*
************************************************************************************/
#ifndef CONFIG_I2C_POLLED
static int stm32_i2c_isr(int irq, void *context, FAR void *arg)
{
struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)arg;
DEBUGASSERT(priv != NULL);
return stm32_i2c_isr_process(priv);
}
#endif
/***************************************************************************** /*****************************************************************************
* Name: stm32_i2c_dmarxcallback * Name: stm32_i2c_dmarxcallback
* *
@ -2119,7 +2125,7 @@ static void stm32_i2c_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *arg
/* let the ISR routine take care of shutting down or switching to next msg */ /* let the ISR routine take care of shutting down or switching to next msg */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
#endif /* ifdef CONFIG_STM32_I2C_DMA */ #endif /* ifdef CONFIG_STM32_I2C_DMA */
@ -2158,57 +2164,6 @@ static void stm32_i2c_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *arg
} }
#endif /* ifdef CONFIG_STM32_I2C_DMA */ #endif /* ifdef CONFIG_STM32_I2C_DMA */
/************************************************************************************
* Name: stm32_i2c1_isr
*
* Description:
* I2C1 interrupt service routine
*
************************************************************************************/
#ifndef CONFIG_I2C_POLLED
#ifdef CONFIG_STM32_I2C1
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c1_priv);
}
#endif
/************************************************************************************
* Name: stm32_i2c2_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c2_priv);
}
#endif
/************************************************************************************
* Name: stm32_i2c3_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c3_priv);
}
#endif
#endif /* CONFIG_I2C_POLLED */
/************************************************************************************
* Private Initialization and Deinitialization
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_init * Name: stm32_i2c_init
* *
@ -2243,8 +2198,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
/* Attach ISRs */ /* Attach ISRs */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
irq_attach(priv->config->ev_irq, priv->config->isr, NULL); irq_attach(priv->config->ev_irq, stm32_i2c_isr, priv);
irq_attach(priv->config->er_irq, priv->config->isr, NULL); irq_attach(priv->config->er_irq, stm32_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq); up_enable_irq(priv->config->er_irq);
#endif #endif

View File

@ -402,7 +402,6 @@ struct stm32_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */ uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */ uint32_t er_irq; /* Error IRQ */
#endif #endif
@ -484,20 +483,9 @@ static void stm32_i2c_setclock(FAR struct stm32_i2c_priv_s *priv,
static inline void stm32_i2c_sendstart(FAR struct stm32_i2c_priv_s *priv); static inline void stm32_i2c_sendstart(FAR struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sendstop(FAR struct stm32_i2c_priv_s *priv); static inline void stm32_i2c_sendstop(FAR struct stm32_i2c_priv_s *priv);
static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv); static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv);
static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); static int stm32_i2c_isr_process(struct stm32_i2c_priv_s * priv);
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
# ifdef CONFIG_STM32F7_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg);
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg);
# endif
# ifdef CONFIG_STM32F7_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg);
# endif
# ifdef CONFIG_STM32F7_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg);
# endif
# ifdef CONFIG_STM32F7_I2C4
static int stm32_i2c4_isr(int irq, void *context, FAR void *arg);
# endif
#endif #endif
static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv);
static int stm32_i2c_deinit(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_deinit(FAR struct stm32_i2c_priv_s *priv);
@ -523,7 +511,6 @@ static const struct stm32_i2c_config_s stm32_i2c1_config =
.scl_pin = GPIO_I2C1_SCL, .scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA, .sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c1_isr,
.ev_irq = STM32_IRQ_I2C1EV, .ev_irq = STM32_IRQ_I2C1EV,
.er_irq = STM32_IRQ_I2C1ER .er_irq = STM32_IRQ_I2C1ER
#endif #endif
@ -553,7 +540,6 @@ static const struct stm32_i2c_config_s stm32_i2c2_config =
.scl_pin = GPIO_I2C2_SCL, .scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA, .sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c2_isr,
.ev_irq = STM32_IRQ_I2C2EV, .ev_irq = STM32_IRQ_I2C2EV,
.er_irq = STM32_IRQ_I2C2ER .er_irq = STM32_IRQ_I2C2ER
#endif #endif
@ -583,7 +569,6 @@ static const struct stm32_i2c_config_s stm32_i2c3_config =
.scl_pin = GPIO_I2C3_SCL, .scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA, .sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c3_isr,
.ev_irq = STM32_IRQ_I2C3EV, .ev_irq = STM32_IRQ_I2C3EV,
.er_irq = STM32_IRQ_I2C3ER .er_irq = STM32_IRQ_I2C3ER
#endif #endif
@ -613,7 +598,6 @@ static const struct stm32_i2c_config_s stm32_i2c4_config =
.scl_pin = GPIO_I2C4_SCL, .scl_pin = GPIO_I2C4_SCL,
.sda_pin = GPIO_I2C4_SDA, .sda_pin = GPIO_I2C4_SDA,
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
.isr = stm32_i2c4_isr,
.ev_irq = STM32_IRQ_I2C4EV, .ev_irq = STM32_IRQ_I2C4EV,
.er_irq = STM32_IRQ_I2C4ER .er_irq = STM32_IRQ_I2C4ER
#endif #endif
@ -905,7 +889,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
* reports that it is done. * reports that it is done.
*/ */
stm32_i2c_isr(priv); stm32_i2c_isr_process(priv);
} }
/* Loop until the transfer is complete. */ /* Loop until the transfer is complete. */
@ -1538,7 +1522,7 @@ static inline void stm32_i2c_clearinterrupts(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_isr * Name: stm32_i2c_isr_process
* *
* Description: * Description:
* Common interrupt service routine (ISR) that handles I2C protocol logic. * Common interrupt service routine (ISR) that handles I2C protocol logic.
@ -1555,7 +1539,7 @@ static inline void stm32_i2c_clearinterrupts(struct stm32_i2c_priv_s *priv)
* *
************************************************************************************/ ************************************************************************************/
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
{ {
uint32_t status; uint32_t status;
@ -2144,71 +2128,23 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
} }
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c1_isr * Name: stm32_i2c_isr
* *
* Description: * Description:
* I2C1 interrupt service routine * Common I2C interrupt service routine
* *
************************************************************************************/ ************************************************************************************/
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
# ifdef CONFIG_STM32F7_I2C1 static int stm32_i2c_isr(int irq, void *context, FAR void *arg)
static int stm32_i2c1_isr(int irq, void *context, FAR void *arg)
{ {
return stm32_i2c_isr(&stm32_i2c1_priv); struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)arg;
DEBUGASSERT(priv != NULL);
return stm32_i2c_isr_process(&stm32_i2c1_priv);
} }
# endif
/************************************************************************************
* Name: stm32_i2c2_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
# ifdef CONFIG_STM32F7_I2C2
static int stm32_i2c2_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c2_priv);
}
# endif
/************************************************************************************
* Name: stm32_i2c3_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
# ifdef CONFIG_STM32F7_I2C3
static int stm32_i2c3_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c3_priv);
}
# endif
/************************************************************************************
* Name: stm32_i2c4_isr
*
* Description:
* I2C2 interrupt service routine
*
************************************************************************************/
# ifdef CONFIG_STM32F7_I2C4
static int stm32_i2c4_isr(int irq, void *context, FAR void *arg)
{
return stm32_i2c_isr(&stm32_i2c4_priv);
}
# endif
#endif #endif
/************************************************************************************
* Private Initialization and Deinitialization
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Name: stm32_i2c_init * Name: stm32_i2c_init
* *
@ -2243,8 +2179,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
#ifndef CONFIG_I2C_POLLED #ifndef CONFIG_I2C_POLLED
/* Attach error and event interrupts to the ISRs */ /* Attach error and event interrupts to the ISRs */
irq_attach(priv->config->ev_irq, priv->config->isr, NULL); irq_attach(priv->config->ev_irq, stm32_i2c_isr, priv);
irq_attach(priv->config->er_irq, priv->config->isr, NULL); irq_attach(priv->config->er_irq, stm32_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq); up_enable_irq(priv->config->er_irq);
#endif #endif