8000 Interrupt defines by dbc · Pull Request #1565 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Interrupt defines #1565

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

Closed
wants to merge 1 commit into from
Closed

Interrupt defines #1565

wants to merge 1 commit into from

Conversation

dbc
Copy link
Contributor
@dbc dbc commented Oct 31, 2015

As noted in issue #1555 , for the stmhal currently the interrupt priorities are hard-coded and spread across several source files. This patch is purely a code clean-up text substitution, creating #defines for interrupt levels in the new file stm_hal/interrupt_priorities.h.

It might be debatable whether or not a small hand full of defines need their own file. mphalport.h might be a reasonable place for them, reducing file clutter in the main development directory. Some also might object to the length of the file name.

@dbc
Copy link
Contributor Author
dbc commented Oct 31, 2015

It seems I might have left some clutter in the commit history. I can fix that if necessary.

@pfalcon
Copy link
Contributor
pfalcon commented Oct 31, 2015

It seems I might have left some clutter in the commit history. I can fix that if necessary.

Yes, please consider using rebase-based devel workflow to avoid that automagically: https://github.com/micropython/micropython/wiki/DevelWorkflow

@dbc
Copy link
Contributor Author
dbc commented Oct 31, 2015

Yes, I know about the work flow, I simply forgot this time after resolving merge conflicts -- it seems I am in a race with someone merging tweaks to can.c so I need to refresh anyway.

@dhylands
Copy link
Contributor

irq.h might also be a resonable place to put these (since that's where the enabled_irq/disable_irq functions go.

If I did that, I'd probably use IRQ_ rather then INTR_ as a prefix.

Pro Tip: If I need to do those types of renames, I then create a patch file, and do a search/replace on the patch file. I use git format-patch to create the patch file.

@dbc
Copy link
Contributor Author
dbc commented Oct 31, 2015

irq.h also seems a reasonable place. I'll re-submit after we get a decision:
() irq.h
() mphalport.h
() interrupt_priorities.h
() other

@dpgeorge
Copy link
Member
dpgeorge commented Oct 31, 2015 via email

@dbc
Copy link
Contributor Author
dbc commented Oct 31, 2015

OK, irq.h it will be. Also, as @dhylands points out, IRQ_ is more consistent with ARM naming conventions, so that seems worth changing.

@dbc dbc force-pushed the interrupt_defines branch from 18b2c64 to 1487cbe Compare November 1, 2015 18:03
@dbc
Copy link
Contributor Author
dbc commented Nov 1, 2015

Should be ready for review/merge.

@dbc
Copy link
Contributor Author
dbc commented Nov 1, 2015

@dhylands
Why? Is there anything not answered in the first post of this thread and in your issue #1555? I'm confused.

Should RTC be just a tad higher? So that its above PENDSV?

Not at issue in the pull request. This pull request intentionally has zero functionality impact. It is a maintainability improvement. I think you should open a new issue(s) for interrupt priority adjustments. The point of this patch is to contain those adjustments to a single, obvious, file.

@dhylands
Copy link
Contributor
dhylands commented Nov 1, 2015

@dhylands
Why? Is there anything not answered in the first post of this thread and in your issue #1555? I'm confused.

Well the #1555 thread actually has nothing to do with FLASH. It was UART/SD and interrupt priority wasn't a factor (the issue seems to be about interrupts being disabled).

So - my comment wasn't really about your PR, but more about the comment relating to FLASH. I can't imagine trying to do I/O from an ISR? Or maybe this is referring the relationship between the storage timer (which triggers periodic flushes) and the FLASH IRQ?

@dbc
Copy link
Contributor Author
dbc commented Nov 1, 2015

OK, there is something missing here. You only said:

Hmm. What does that really mean? And why?

And somehow from that we are to understand you are talking about a code comment relating to FLASH? That could have been better sign-posted.

I will assume you are talking about:

// Flash IRQ must be higher priority than interrupts of all those components
// that rely on the flash storage.
#define IRQ_PRI_FLASH 0x1
#define IRQ_SUBPRI_FLASH 0x1

which if you go and review the source code being changed, is simply copying the comment from where the irq priority was previously being set, to the new file. Leaving it only in the file where the #define is used is inviting trouble. If it was important to document that restriction yesterday, it is important to document the restriction today, and to have it documented in the place where someone is looking at it to change it. As to the deeper meaning of why the flash irq needs to be at such a high priority, I have nothing to say. Again, the point here was to make a functionality-neutral improvement in maintainability.

@dhylands
Copy link
Contributor
dhylands commented Nov 1, 2015

Yep - I assumed that because it was a line comment with a position, it was clear that I was talking about the FLASH_IRQ.

And like the RTC comment, I wouldn't consider this a reason not to go ahead with the PR. It was just something I noticed while looking at the PR, and as you suggested with the RTC one, any actual changes should probably go in a separate PR. This is just discussion.

To be clear- I'm all in favor of your PR.

@dbc
Copy link
Contributor Author
dbc commented Nov 1, 2015

@dhylands OK, understood.

I am curious as to why the flash irq needs to be such a high priority. I was planning to dig into that a little bit in the context of getting the UART to work at faster than a slow jog.

@dpgeorge
Copy link
Member
dpgeorge commented Nov 1, 2015

With the priority mechanism that we use (PRIORITYGROUP_4) subpriorities have no meaning, so they should all be 0.

But, that's something we can fix later. And, it's nice to have SUBPRI #defines so we can change them in one place if one ever uses a different grouping scheme.

@dpgeorge
Copy link
Member
dpgeorge commented Nov 1, 2015

Merged in 32b3549.

@dpgeorge dpgeorge closed this Nov 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0