Human68k CUI emulator with sound.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dmac.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <stdint.h>
  3. struct dmac_channel {
  4. uint8_t csr; /* 0x00 R/W Channel Status Register */
  5. uint8_t cer; /* 0x01 R Channel Error Register */
  6. uint8_t dcr; /* 0x04 R/W Device Control Register */
  7. uint8_t ocr; /* 0x05 R/W Operation control register */
  8. uint8_t scr; /* 0x06 R/W Sequence control register */
  9. uint8_t ccr; /* 0x07 R/W Channel control register */
  10. uint16_t mtc; /* 0x0a R/W Memory transfer counter */
  11. uint32_t mar; /* 0x0c R/W Memory address register */
  12. uint32_t dar; /* 0x14 R/W Device address register */
  13. uint16_t btc; /* 0x1a R/W Base transfer counter */
  14. uint32_t bar; /* 0x1c R/W Base address register */
  15. uint8_t niv; /* 0x25 R/W Normal interrupt vector */
  16. uint8_t eiv; /* 0x27 R/W Error interrupt vector */
  17. uint8_t mfc; /* 0x29 R/W Memory function code */
  18. uint8_t cpr; /* 0x2d R/W Channel priority register */
  19. uint8_t dfc; /* 0x31 R/W Device function code */
  20. uint8_t bfc; /* 0x39 R/W Base function code */
  21. uint8_t gcr; /* 0x3f R/W General control register */
  22. };
  23. struct dmac {
  24. struct dmac_channel channels[4];
  25. int halted[4];
  26. int16_t transfer_size[4];
  27. int drq_state[4];
  28. };
  29. void dmac_init(void);
  30. void dmac_write_16(uint32_t addr, uint16_t data, uint16_t mem_mask);
  31. uint16_t dmac_read_16(uint32_t addr, uint16_t mem_mask);
  32. void dmac_tick(int chan);