Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/interrupt_controller: stm32: Complete driver factorization #12463

Merged
merged 2 commits into from
Jan 24, 2019

Conversation

erwango
Copy link
Member

@erwango erwango commented Jan 14, 2019

Complete code factorization in stm32 exti drivers.

Tested and validated against all STM32 series

Signed-off-by: Erwan Gouriou erwan.gouriou@linaro.org

@erwango erwango added the platform: STM32 ST Micro STM32 label Jan 14, 2019
@erwango erwango requested a review from galak January 14, 2019 10:34
@erwango erwango requested a review from andrewboie as a code owner January 14, 2019 10:34
@codecov-io
Copy link

codecov-io commented Jan 14, 2019

Codecov Report

Merging #12463 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #12463   +/-   ##
=======================================
  Coverage   53.96%   53.96%           
=======================================
  Files         242      242           
  Lines       27671    27671           
  Branches     6720     6720           
=======================================
  Hits        14934    14934           
  Misses       9932     9932           
  Partials     2805     2805

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0289a41...e21b592. Read the comment docs.

@tagunil
Copy link
Collaborator

tagunil commented Jan 14, 2019

Looks like L0 and L4 code became duplicated somehow. These series are mentioned in shared code, but also have their own copies of it.

@erwango
Copy link
Member Author

erwango commented Jan 14, 2019

@tagunil , txs for review, this should be fixed now

@tagunil
Copy link
Collaborator

tagunil commented Jan 14, 2019

@erwango, thanks, this driver looks so much better now. By the way, could you please also make #ifdefs/#ifs around EXTI_LINES more coherent?

@erwango
Copy link
Member Author

erwango commented Jan 14, 2019

recheck

Complete code factorization in stm32 exti drivers.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@erwango
Copy link
Member Author

erwango commented Jan 15, 2019

@tagunil , can you review again?

@tagunil
Copy link
Collaborator

tagunil commented Jan 15, 2019

@erwango, it may be outside the scope of this cleanup PR, but why we still treat F2/F4/F7 differently by enabling IRQs for lines >=16 on these series and not enabling on others? Which way it should be done actually?
Otherwise LGTM.

@erwango
Copy link
Member Author

erwango commented Jan 15, 2019

@tagunil, this is right, support could be enhanced, but this was not the aim of this PR. We can log a ticket for that purpose.

@erwango erwango requested review from avisconti and ydamigos January 22, 2019 13:02
@avisconti
Copy link
Collaborator

@erwango
quickly tested with microphone and sensor samples for ArgonKey and seems good.

case 23:
irqnum = LPTIM1_IRQn;
break;
#endif
default:
return;
}
}
Copy link
Collaborator

@avisconti avisconti Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case F2/F4/F7 seems in line with previous code.
But I'm not sure about F1/F3. In these case if line is above 15 what happens? It seems irqnum is
not assigned.

Copy link
Member Author

@erwango erwango Jan 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avisconti, I reworked a bit the change to be closer to previous code for L4.
For F1/F3, line > 15, code was obviously wrong, also we missed handling for not supported lines for F2/F4/F7 so reporting an error now.

This PR was meant for refactoring. So I guess some more effort would be required to enhance functionality, but I don't want to address that now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For F1/F3, line > 15, code was obviously wrong, also we missed handling for not supported lines for F2/F4/F7 so reporting an error now.

OK, got it now.

Copy link
Collaborator

@avisconti avisconti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is complex...

@erwango
Copy link
Member Author

erwango commented Jan 23, 2019

@avisconti , can you review?

@@ -476,7 +384,8 @@ static void __stm32_exti_connect_irqs(struct device *dev)
{
ARG_UNUSED(dev);

#ifdef CONFIG_SOC_SERIES_STM32F0X
#if defined(CONFIG_SOC_SERIES_STM32F0X) || \
defined(CONFIG_SOC_SERIES_STM32L0X)
IRQ_CONNECT(EXTI0_1_IRQn,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So L4 is same as F1/F3 and L0 is same as F0. Is that wanted?

drivers/interrupt_controller/exti_stm32.c Show resolved Hide resolved
@avisconti
Copy link
Collaborator

I also re-tested the two commits on ArgonKey (microphone and sensor samples) and on
disco_l475_iot1 (with lsm6dsl + trigger sample). It works fine.

*
* Chapter 10.2: External interrupt/event controller (EXTI)
* Driver is currently implemented to support following EXTI lines
* STM32F0/STM32L0/STM32L4: Lines 0 to 15. Lines > 15 not supported
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is F1/F3/L4. Correct?

Complete code factorization in stm32 exti drivers.
Add return value in case line is not implemented.
Except returned error code, refactor has been done iso-feature
compared to previous code. Hence error is reported only when
support was not available on previous series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Copy link
Collaborator

@avisconti avisconti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, now seems fine. Thx for the comment at the top of the file. It helps.
I have also re-tested once more on ArgonKey and it works fine.

@galak galak merged commit 14dcd13 into zephyrproject-rtos:master Jan 24, 2019
@erwango erwango deleted the fix_exti_factor branch September 3, 2019 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants