|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: * Copyright (c) 1992 NeXT Computer, Inc. ! 27: * ! 28: * dma_exported.h -- DMA external interface. ! 29: * ! 30: * HISTORY ! 31: * ! 32: * 08 Jan 1993 David Somayajulu at NeXT ! 33: * added functions is_dma_done, get_dma_addr, get_dma_count ! 34: * ! 35: * 14 July 1992 ? at NeXT ! 36: * Created. ! 37: */ ! 38: ! 39: #import <mach/mach_types.h> ! 40: ! 41: #define DMA_BUF_SM_LEN PAGE_SIZE ! 42: #define DMA_BUF_LG_LEN (64*1024) ! 43: ! 44: typedef struct dma_buf { ! 45: void *_ptr; /* opaque region ptr */ ! 46: void *_type; /* opaque buffer type */ ! 47: } dma_buf_t; ! 48: ! 49: typedef struct dma_xfer { ! 50: vm_offset_t phys; /* phys address of data to transfer */ ! 51: vm_size_t len; /* length of transfer */ ! 52: int chan; /* core dma channel number */ ! 53: dma_buf_t buf; /* optional dma buffer */ ! 54: unsigned int active :1, /* xfer is in progress */ ! 55: buffered:1, /* xfer is using dma buffer */ ! 56: use_chan:1, /* xfer uses core dma channel */ ! 57: read :1, /* read or write xfer */ ! 58: lower16 :1, /* dma restricted to lower 16 meg */ ! 59: bound64 :1, /* dma cannot cross 64 k boundary */ ! 60: :0; ! 61: } dma_xfer_t; ! 62: ! 63: // Core initialization ! 64: void dma_initialize( ! 65: void); ! 66: ! 67: // Channel manipulation ! 68: boolean_t dma_assign_chan( ! 69: int chan); ! 70: void dma_deassign_chan( ! 71: int chan); ! 72: void dma_mask_chan( ! 73: int chan); ! 74: void dma_unmask_chan( ! 75: int chan); ! 76: void dma_chan_xfer_mode( ! 77: int chan, ! 78: int xfer_mode); ! 79: void dma_chan_autoinit( ! 80: int chan, ! 81: boolean_t autoinit); ! 82: void dma_chan_adrs_dir( ! 83: int chan, ! 84: boolean_t adrs_dir); ! 85: ! 86: // Transfer operations ! 87: boolean_t dma_xfer_chan( ! 88: int chan, ! 89: dma_xfer_t *xfer); ! 90: boolean_t dma_xfer( ! 91: dma_xfer_t *xfer, ! 92: vm_offset_t *rphys); ! 93: void dma_xfer_done( ! 94: dma_xfer_t *xfer); ! 95: void dma_xfer_abort( ! 96: dma_xfer_t *xfer); ! 97: ! 98: // Extended Mode register manipulation ! 99: void dma_xfer_width( ! 100: int chan, ! 101: int xfer_width); ! 102: void dma_timing( ! 103: int chan, ! 104: int dma_timing); ! 105: void dma_eop_in( ! 106: int chan, ! 107: int eop_io); ! 108: void dma_stop_enable( ! 109: int chan, ! 110: int stop_enable); ! 111: ! 112: // Buffer operations ! 113: boolean_t dma_buf_alloc( ! 114: dma_buf_t *buf, ! 115: vm_size_t len); ! 116: void dma_buf_free( ! 117: dma_buf_t *buf); ! 118: ! 119: // Status checks ! 120: ! 121: boolean_t is_dma_done(int chan ); ! 122: ! 123: vm_offset_t get_dma_addr( int chan); ! 124: vm_size_t get_dma_count(int chan); ! 125:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.