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

Clean up DMA module #262

Merged
merged 10 commits into from Jul 29, 2020
Merged

Clean up DMA module #262

merged 10 commits into from Jul 29, 2020

Commits on Jul 28, 2020

  1. Make Channel registers pub(super)

    I plan to move the `start_transfer` method to `Transfer`, and in the
    future we will need to add more methods there, to control and query the
    ongoing transfer. Those methods will probably need most of these
    registers, so I figured why not just make all of them available.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    2756ac6 View commit details
    Browse the repository at this point in the history
  2. Move Channel::start_transfer to Transfer

    I'm going to add more methods that need to access channel registers
    there anyway, and the start method seems to fit there better. Plus, all
    the compiler fence stuff is now concentrated in `Channel`.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    6f92850 View commit details
    Browse the repository at this point in the history
  3. Replace use of RegProxy for shared registers

    Use a custom abstraction instead.
    
    cc #211
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    f934e6d View commit details
    Browse the repository at this point in the history
  4. Don't require user to pass DMA descriptor table

    This makes using the DMA peripheral more convenient and opens the door
    for further simplications, at the cost of requiring more memory when the
    DMA peripheral isn't used (actually I believe that as of this commit,
    the compiler can optimize the static out, if DMA is not used; I'm
    working on further changes that would make this impossible).
    
    I think the added memory use if far from ideal, but right now I'd like
    to focus on a simpler and more flexible API. We can restore efficiency
    later, if desired, by being a bit more clever about using the static and
    allowing the compiler to optimize it.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    fbbe11b View commit details
    Browse the repository at this point in the history
  5. Make DescriptorTable private

    It's an internal implementation detail now.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    10feb3a View commit details
    Browse the repository at this point in the history
  6. Merge dma::Parts into DMA

    Since the descriptor table is no longer supplied by the user, a separate
    `split` step is no longer necessary.
    
    Please see the description of one of the previous commit for some notes
    on the consequences this change has on efficiency.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    e64bb8b View commit details
    Browse the repository at this point in the history
  7. Refactor

    hannobraun committed Jul 28, 2020
    Copy the full SHA
    10c4463 View commit details
    Browse the repository at this point in the history
  8. Enable/disable DMA peripheral as a whole

    This removes the need for carrying a reference in every enabled channel,
    thereby removing the lifetime from channels and transfers, while
    offering the same guarantees. This makes the API much more convenient in
    non-trivial use cases.
    
    In addition, it allows for disabling the peripheral after a channel has
    been disabled, which has not been possible with the old API.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    4656eb2 View commit details
    Browse the repository at this point in the history
  9. Move generated DMA types to dedicated module

    This follows the example from other modules, limits the wildcard
    re-export to that one module, and makes the `channels` module much
    lighter.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    3f519e2 View commit details
    Browse the repository at this point in the history
  10. Rename ChannelTrait to channels::Instance

    I believe the new name is much nicer and better reflects the difference
    between `Channel` and the trait. It also follows the example set by the
    peripheral APIs, so the consistency is an added bonus.
    hannobraun committed Jul 28, 2020
    Copy the full SHA
    211930b View commit details
    Browse the repository at this point in the history