1
0

isa_dma.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * isa_dma.h
  3. *
  4. * Copyright (C) 2013 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <common.h>
  20. #define ISA_DMA_MEM_START 0x200000
  21. #define ISA_DMA_MEM_END 0x280000
  22. #define ISA_DMA_MEM_ALIGNMENT 0x10000
  23. #define ISA_DMA_MEM_BLOCKS ((ISA_DMA_MEM_END - ISA_DMA_MEM_START) / ISA_DMA_MEM_ALIGNMENT)
  24. #define ISA_DMA_MASK_ON (1 << 2)
  25. #define ISA_DMA_SAR(x) (((x) < 4) ? ((x) << 1) : (0xC0 + (((x) - 4) << 2)))
  26. #define ISA_DMA_CNT(x) (((x) < 4) ? (((x) << 1) + 1) : (0xC2 + (((x) - 4) << 2)))
  27. #define ISA_DMA_FIRST_PAR(x) (((x) == 0) ? 0x87 : (((x) == 1) ? 0x83 : (0x7F + (x))))
  28. #define ISA_DMA_PAR(x) (((x) < 4) ? ISA_DMA_FIRST_PAR(x) : (ISA_DMA_FIRST_PAR((x) - 4) | 0x08))
  29. #define ISA_DMA_STATUS_REG(x) (((x) < 4) ? 0x08 : 0xD0)
  30. #define ISA_DMA_COMMAND_REG(x) (((x) < 4) ? 0x08 : 0xD0)
  31. #define ISA_DMA_SINGLE_MASK_REG(x) (((x) < 4) ? 0x0A : 0xD4)
  32. #define ISA_DMA_MODE_REG(x) (((x) < 4) ? 0x0B : 0xD6)
  33. #define ISA_DMA_FF_RESET_REG(x) (((x) < 4) ? 0x0C : 0xD8)
  34. #define ISA_DMA_MASTER_RESET_REG(x) (((x) < 4) ? 0x0D : 0xDA)
  35. #define ISA_DMA_MASK_RESET_REG(x) (((x) < 4) ? 0x0E : 0xDC)
  36. #define ISA_DMA_MULTI_MASK_REG(x) (((x) < 4) ? 0x0F : 0xDE)
  37. void *isa_dma_alloc(void);
  38. void isa_dma_free(void *dma_buffer);
  39. void isa_dma_read(dword_t channel, void *buffer, word_t count);
  40. void isa_dma_write(dword_t channel, void *buffer, dword_t count);