home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / dma.inc < prev    next >
Text File  |  1994-08-06  |  5KB  |  154 lines

  1. ;*    DMA.INC
  2. ;*
  3. ;* DMA handling routines, v1.10
  4. ;*
  5. ;* Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6. ;*
  7. ;* This file is part of the MIDAS Sound System, and may only be
  8. ;* used, modified and distributed under the terms of the MIDAS
  9. ;* Sound System license, LICENSE.TXT. By continuing to use,
  10. ;* modify or distribute this file you indicate that you have
  11. ;* read the license and understand and accept it fully.
  12. ;*
  13.  
  14.  
  15.  
  16. ;/***************************************************************************\
  17. ;*       struct dmaBuffer
  18. ;*       ----------------
  19. ;* Description:  DMA playing buffer
  20. ;\***************************************************************************/
  21.  
  22. STRUC    dmaBuffer
  23.     bsegment    DW    ?    ; segment
  24.     address     DD    ?    ; physical start address
  25.     blength     DW    ?    ; buffer length
  26.     memBlk        DD    ?    ; internal, used for unallocating
  27.     channel     DW    ?    ; channel on which the buffer is
  28.                     ; being played or -1
  29. ENDS
  30.  
  31.  
  32.  
  33. ;/***************************************************************************\
  34. ;*      struct dmaChannel
  35. ;*      -----------------
  36. ;* Description: DMA channel data used by DMA functions.
  37. ;\***************************************************************************/
  38.  
  39. STRUC    dmaChannel
  40.     number        DB    ?    ; channel number
  41.     bit        DB    ?    ; channel bit
  42.     baseAddr    DW    ?    ; base address port
  43.     wordCount    DW    ?    ; word count port
  44.     request     DW    ?    ; request port
  45.     singleMask    DW    ?    ; mask port
  46.     mode        DW    ?    ; mode port
  47.     clearFF     DW    ?    ; clear flip-flop port
  48.     page        DW    ?    ; page port
  49. ENDS
  50.  
  51.  
  52.  
  53. ;/***************************************************************************\
  54. ;*
  55. ;* Function:     int dmaAllocBuffer(ushort size, dmaBuffer *buf);
  56. ;*
  57. ;* Description:  Allocates a DMA buffer (totally inside a 64K physical page)
  58. ;*
  59. ;* Input:        ushort size             size of buffer in bytes
  60. ;*               dmaBuffer *buf          ptr to buffer structure to be filled
  61. ;*
  62. ;* Returns:      MIDAS error code.
  63. ;*               DMA buffer data is strored in *buf.
  64. ;*
  65. ;\***************************************************************************/
  66.  
  67. GLOBAL  LANG dmaAllocBuffer : far
  68.  
  69.  
  70.  
  71. ;/***************************************************************************\
  72. ;*
  73. ;* Function:     int dmaFreeBuffer(dmaBuffer *buf);
  74. ;*
  75. ;* Description:  Deallocates an allocated DMA buffer
  76. ;*
  77. ;* Input:        dmaBuffer *buf          ptr to buffer to be deallocated
  78. ;*
  79. ;* Returns:      MIDAS error code
  80. ;*
  81. ;\***************************************************************************/
  82.  
  83. GLOBAL  LANG dmaFreeBuffer : far
  84.  
  85.  
  86.  
  87. ;/***************************************************************************\
  88. ;*
  89. ;* Function:     int dmaPlayBuffer(dmaBuffer *buf, ushort channel,
  90. ;*                                 ushort autoInit);
  91. ;*
  92. ;* Description:  Plays a DMA buffer
  93. ;*
  94. ;* Input:        dmaBuffer *buf          buffer to be player
  95. ;*               ushort channel          DMA channel number
  96. ;*               ushort autoInit         use autoinitialization?
  97. ;*
  98. ;* Returns:      MIDAS error code
  99. ;*
  100. ;\***************************************************************************/
  101.  
  102. GLOBAL  LANG dmaPlayBuffer : far
  103.  
  104.  
  105.  
  106.  
  107. ;/***************************************************************************\
  108. ;*
  109. ;* Function:     int dmaStop(ushort channel);
  110. ;*
  111. ;* Description:  Stops DMA playing
  112. ;*
  113. ;* Input:        ushort channel          DMA channel number
  114. ;*
  115. ;* Returns:      MIDAS error code
  116. ;*
  117. ;\***************************************************************************/
  118.  
  119. GLOBAL  LANG dmaStop : far
  120.  
  121.  
  122.  
  123. ;/***************************************************************************\
  124. ;*
  125. ;* Function:     int dmaGetPos(dmaBuffer *buf, ushort *pos);
  126. ;*
  127. ;* Description:  Gets the DMA playing position
  128. ;*
  129. ;* Input:        dmaBuffer *buf          buffer that is being played
  130. ;*               ushort *pos             pointer to return value
  131. ;*
  132. ;* Returns:      MIDAS error code.
  133. ;*               DMA playing position from the beginning of the buffer,
  134. ;*               in bytes, is stored in *pos.
  135. ;*
  136. ;\***************************************************************************/
  137.  
  138. GLOBAL  LANG dmaGetPos : far
  139.  
  140.  
  141.  
  142. ;/***************************************************************************\
  143. ;*       enum dmaFunctIDs
  144. ;*       ----------------
  145. ;* Description:  ID numbers for DMA handling functions
  146. ;\***************************************************************************/
  147.  
  148. enum    dmaFunctIDs \
  149.         ID_dmaAllocBuffer = ID_dma, \
  150.         ID_dmaFreeBuffer, \
  151.         ID_dmaPlayBuffer, \
  152.         ID_dmaStop, \
  153.         ID_dmaGetPos
  154.