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

cli() in tone/waveform, needed? #4830

Closed
ghost opened this issue Jun 19, 2018 · 3 comments · Fixed by #4872
Closed

cli() in tone/waveform, needed? #4830

ghost opened this issue Jun 19, 2018 · 3 comments · Fixed by #4872
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Jun 19, 2018

Hi!

I found a cli() (disable interrupts right?) call here:

Is that needed at all? Why is it there? :)
It seems the only use in that source file, nowhere to re-enable interrupts, isn't that a problem?

Mostly trying to understand the code here, hope it's ok to have an issue for that :)

Thanks!

@devyte
Copy link
Collaborator

devyte commented Jun 19, 2018

The issue template has been completely ignored. However, given that the referenced code is brand new, and that the description looks valid to me, I'm keeping this open.
@earlephilhower is that cli() call left over, or is there a matching sei() call missing?

@ghost
Copy link
Author

ghost commented Jun 20, 2018

Oh, you never see the template if you create an issue by clicking a line of code in the repository, sorry :)

@earlephilhower
Copy link
Collaborator

Good eyes, @cranphin . It was leftover, or so I thought.

I re-read the code again this morning and I see that while I thought I had guaranteed safe waveform start/stop without disabling IRQs, there is a 2-4 instruction window where nextTimeHighCycles could be trashed by the IRQ if it's called and updates the state for this waveform (due to the bitfield packing used to save memory).

I'll throw in a patch with proper IRQ disable/enable around the startWaveform region of danger late this week or early next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants