home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / config / m68k-native / cachepredma.s < prev    next >
Encoding:
Text File  |  1997-01-22  |  2.3 KB  |  89 lines

  1. /*
  2.      (C) 1995-96 AROS - The Amiga Replacement OS
  3.      $Id: cachepredma.s,v 1.6 1997/01/22 02:43:11 ldp Exp $
  4.  
  5.      Desc:
  6.      Lang:
  7. */
  8.  
  9. /*****************************************************************************
  10.  
  11.     NAME
  12.  
  13.      AROS_LH3(APTR, CachePreDMA,
  14.  
  15.     SYNOPSIS
  16.      AROS_LHA(APTR,    address, A0),
  17.      AROS_LHA(ULONG *, length,  A1),
  18.      AROS_LHA(ULONG,   flags,  D0),
  19.  
  20.     LOCATION
  21.      struct ExecBase *, SysBase, 127, Exec)
  22.  
  23.     FUNCTION
  24.      Do everything necessary to make CPU caches aware that a DMA will happen.
  25.      Virtual memory systems will make it possible that your memory is not at
  26.      one block and not at the address you thought. This function gives you
  27.      all the information you need to split the DMA request up and to convert
  28.      virtual to physical addresses.
  29.  
  30.     INPUTS
  31.      address - Virtual address of memory affected by the DMA
  32.      *length - Number of bytes affected
  33.      flags    - DMA_Continue      - This is a call to continue a request that
  34.                      was broken up.
  35.            DMA_ReadFromRAM - Indicate that the DMA goes from RAM
  36.                      to the device. Set this bit in bot calls.
  37.  
  38.     RESULT
  39.      The physical address in memory.
  40.      *length contains the number of contiguous bytes in physical memory.
  41.  
  42.     NOTES
  43.      DMA must follow a call to CachePreDMA() and must be followed
  44.      by a call to CachePostDMA().
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.      CachePostDMA()
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.  
  57. ******************************************************************************/
  58.  
  59. /*
  60.    XDEF AROS_SLIB_ENTRY(CachePreDMA,Exec)       ; for 68000/10/20/30
  61.    XDEF AROS_SLIB_ENTRY(CachePreDMA_40,Exec)    ; for 68040+
  62. */
  63.  
  64.     #include "machine.i"
  65.  
  66.     .text
  67.     .balign 16
  68.     .globl    AROS_SLIB_ENTRY(CachePreDMA,Exec)
  69.     .type    AROS_SLIB_ENTRY(CachePreDMA,Exec),@function
  70. AROS_SLIB_ENTRY(CachePreDMA,Exec):
  71.     move.l    a0,d0    /* return input address */
  72.     rts
  73.  
  74.     .text
  75.     .balign 16
  76.     .globl    AROS_SLIB_ENTRY(CachePreDMA_40,Exec)
  77.     .type    AROS_SLIB_ENTRY(CachePreDMA_40,Exec),@function
  78. AROS_SLIB_ENTRY(CachePreDMA_40,Exec):
  79.     move.l    a5,a1        /* save a5 */
  80.     lea.l    cachepredmasup_40(pc),a5
  81.     jmp    Supervisor(a6)
  82.  
  83. cachepredmasup_40:
  84.     cpusha    dc    /* Push dirty data cache lines to memory and invalidate cache */
  85.     cinva    dc    /* 68060 invalidates depending on DPI (Disable CPUSH invalidation)
  86.                bit of CACR. Force an invalidation with CINV. */
  87.     move.l    a0,d0    /* return input address */
  88.     rte
  89.