To get general-purpose memory, use buffer: or alloc-mem. Use free-mem to de-allocate memory obtained with alloc-mem.
To map in portions of your SBus device for ordinary access use " map-in" $call-parent as in:
---------------------------------------------------------------------
my-address offset my-space size " map-in" $call-parent ( virt ) ---------------------------------------------------------------------
To later map out those portions of your device, use " map-out" $call-parent as in:
-----------------------------------------
( virt ) size " map-out" $call-parent -----------------------------------------
To use a region of system memory for DMA (for example, for both direct CPU access and DMA access from a device), first define the following mapping and allocation routines, then follow the steps below to ensure data coherency.
-------------------------------------------------------------------------
: dma-alloc ( size -- virt ) " dma-alloc" $call-parent ; : dma-free ( virt size -- ) " dma-free" $call-parent ; : dma-map-in ( virt size cache? -- devaddr ) " dma-map-in" $call-parent ; : dma-map-out ( virt devaddr size -- ) " dma-map-out" $call-parent ; : dma-sync ( virt devaddr size -- ) \ Correct even if "dma-sync" missing " dma-sync" ['] $call-parent catch if 2drop 3drop then ; -------------------------------------------------------------------------