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

[mega65] Add DMA hardware registers and DMA examples #347

Merged
merged 19 commits into from
Jul 30, 2024

Conversation

mlund
Copy link
Contributor

@mlund mlund commented Jul 14, 2024

The following adds support for the DMA controller on the MEGA65.

  • Add _dmagic.h C header
  • Add volatile MMIO access to F018 "DMAgic" controller
  • Add C++ support library for constructing arbitrary DMA jobs as well as fill and copy functions.
  • Add minimal C++ example with DMA fill and copy on screen. There is still an issue with DMA fill/copy routines likely due to code being optimized away. Will try to solve this on Discord.
  • Add C++ example of vertical raster bars using the DMA hold feature as described in the MEGA65 Book. Below is a screenshot of the effect.
    vertical_raster
  • Add DMA audio example for playing digitized sound samples. Preview:
    https://github.com/user-attachments/assets/8b6207fb-d81e-4daa-86e5-a050f1df026e

mos-platform/mega65/dma.hpp Outdated Show resolved Hide resolved
@mlund mlund marked this pull request as ready for review July 26, 2024 14:54

// Configure DMA job; see The MEGA65 Book, Appendix O.
dma::DMAJob<2, DMAList_F018A> dma;
dma.options[0] = DST_ADDR_BITS_OPT;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here an initializer list would have been nice, but it doesn't seem to be supported by the compiler. That is dma.options = {DST_ADDR_BITS_OPT, 0xff};

// C++ support for MEGA65 DMA operations.
//

#pragma once
Copy link
Member

Choose a reason for hiding this comment

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

Prefer include guards for nit-picky compiler-person reasons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

mos-platform/mega65/dma.hpp Show resolved Hide resolved
@mysterymath mysterymath merged commit ae3a96f into llvm-mos:main Jul 30, 2024
@mlund mlund deleted the dma branch July 30, 2024 11:13
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.

2 participants