-
Notifications
You must be signed in to change notification settings - Fork 165
bcm283x: Implement bit stream functions, not enabled yet. #207
Conversation
- Based on @maruel's implementation. - DMA driven stream shares a fixed PWM and DREQ clock. Oversampling is used to get desired resolution.
Codecov Report
@@ Coverage Diff @@
## master #207 +/- ##
=========================================
- Coverage 83.97% 80.27% -3.7%
=========================================
Files 66 68 +2
Lines 5515 5811 +296
=========================================
+ Hits 4631 4665 +34
- Misses 761 1021 +260
- Partials 123 125 +2
Continue to review full report at Codecov.
|
return err | ||
} | ||
|
||
// The first channel must be a full bandwidth one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maruel Could you explain why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the "light" ones are effectively a single one, which means that they are interleaved. If both are "light" then the jitter is largely increased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I experimented dual channel method but it seems that two channels easily get out of sync. I guess it DREQ clock can be missed.
runIO(pCB, l <= maxLite) | ||
// We have to wait PCM to be finished even after DMA finished. | ||
for pcmMemory.cs&pcmTXErr == 0 { | ||
Nanospin(10 * time.Nanosecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory it should try to wait the exact right amount of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just wanted avoid a busy loop. Maybe, we should wait 1 PCM clock.
dmaChannel.wait() is a busy loop now.
for i, ch := range dmaMemory.channels { | ||
fmt.Println(i, ch.cs.String()) | ||
if ch.cs&dmaActive != 0 { | ||
fmt.Printf("%x: %s", ch.cbAddr, ch.GoString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer log instead of fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #209.
used to get desired resolution.