MusicKit  0.0.0
_DSPMach.h
00001 #ifndef __MK__DSPMach_H___
00002 #define __MK__DSPMach_H___
00003 /* $Id$
00004  * Mach interface
00005  * Copyright 1988-1992, NeXT Inc.  All rights reserved.
00006  */
00007 /*
00008  * HISTORY
00009  * 10-Dec-88  Gregg Kellogg (gk) at NeXT
00010  *      Created.
00011  * Modifications by Julius Smith (jos) at NeXT
00012  */ 
00013 
00014 #import <mach/mach.h>
00015 
00016 #if !m68k && (defined(NeXT) || (defined(__APPLE__) && defined(__MACH__)) || defined(WIN32))
00017 #import "dspdriverAccess.h"
00018 
00019 extern msg_header_t *_DSP_data_request_msg (
00020         msg_header_t *msg,              // message pointer to reuse or malloc
00021         mach_port_t     stream_port,            // valid stream port
00022         mach_port_t     reply_port,             // task port or other
00023         int     data_tag,               // tag associated with request
00024         int     chan,                   // dsp transfer channel
00025         int     msgID);                 // type of msg      
00026 
00027 extern msg_header_t *_DSP_simple_request_msg (
00028         mach_port_t     cmd_port,
00029         mach_port_t     reply_port,
00030         int messageType);                                      
00031 
00032 extern void _DSP_free_simple_request_msg(msg_header_t **msg);
00033 
00034 #endif
00035 
00036 #import "_DSPMachAccessMacros.h"
00037 
00038 /* FIXME: Eventually, 386 version should not include any of the below. */
00039 
00040 #import "_MachMessages.h"
00041 
00042 // #ifndef u_int
00043 // #define u_int unsigned int
00044 // #endif
00045 
00046 msg_header_t *_DSP_stream_msg (
00047         msg_header_t *msg,              // message pointer to reuse or malloc
00048         mach_port_t     stream_port,            // valid stream port
00049         mach_port_t     reply_port,             // task port or other
00050         int     data_tag);              // tag associated with request
00051 msg_header_t *_DSP_stream_play_data (
00052         msg_header_t    *msg,           // message frame to add request to
00053         pointer_t       data,           // data to play
00054         boolean_t       started_msg,    // want's a message when started
00055         boolean_t       completed_msg,  // want's a message when completed
00056         boolean_t       aborted_msg,    // want's a message when aborted
00057         boolean_t       paused_msg,     // want's a message when paused
00058         boolean_t       resumed_msg,    // want's a message when resumed
00059         boolean_t       underflow_msg,  // want's a message on underflow
00060         boolean_t       preempt,        // play preemptively
00061         boolean_t       deallocate,     // deallocate data when sent?
00062         mach_port_t             reg_port,       // port for region events
00063         int             nbytes);        // number of bytes of data to send
00064 msg_header_t *_DSP_stream_record_data (
00065         msg_header_t    *msg,           // message frame to add request to
00066         boolean_t       started_msg,    // want's a message when started
00067         boolean_t       completed_msg,  // want's a message when completed
00068         boolean_t       aborted_msg,    // want's a message when aborted
00069         boolean_t       paused_msg,     // want's a message when paused
00070         boolean_t       resumed_msg,    // want's a message when resumed
00071         boolean_t       overflow_msg,   // want's a message on overflow
00072         int             nbytes,         // number of bytes of data to record
00073         mach_port_t             reg_port,       // port for region events
00074         char            *filename);     // file for backing store (or null)
00075 msg_header_t *_DSP_stream_control (
00076         msg_header_t    *msg,           // message frame to add request to
00077         int             control);       // await/abort/pause/resume
00078 kern_return_t _DSP_stream_nsamples (
00079         mach_port_t             stream_port,    // valid stream port
00080         int             *nsamples);     // OUT number of samples played/rec'd
00081 kern_return_t _DSP_get_stream (
00082         mach_port_t             device_port,    // valid device port
00083         mach_port_t             owner_port,     // valid soundout/in/dsp owner port
00084         mach_port_t             *stream_port,   // returned stream_port
00085         u_int           stream);        // stream to/from what?
00086 kern_return_t _DSP_set_dsp_owner_port (
00087         mach_port_t             device_port,    // valid device port
00088         mach_port_t             owner_port,     // dsp owner port
00089         mach_port_t             *neg_port);     // dsp negotiation port
00090 kern_return_t _DSP_set_sndin_owner_port (
00091         mach_port_t             device_port,    // valid device port
00092         mach_port_t             owner_port,     // sound in owner port
00093         mach_port_t             *neg_port);     // sound in negotiation port
00094 kern_return_t _DSP_set_sndout_owner_port (
00095         mach_port_t             device_port,    // valid device port
00096         mach_port_t             owner_port,     // sound out owner port
00097         mach_port_t             *neg_port);     // sound out negotiation port
00098 kern_return_t _DSP_get_dsp_cmd_port (
00099         mach_port_t             device_port,    // valid device port
00100         mach_port_t             owner_port,     // valid dsp owner port
00101         mach_port_t             *cmd_port);     // returned cmd_port
00102 kern_return_t _DSP_dsp_proto (
00103         mach_port_t             device_port,    // valid device port
00104         mach_port_t             owner_port,     // valid dsp owner port
00105         int             proto);         // what protocol to use.        
00106 kern_return_t _DSP_dspcmd_event (
00107         mach_port_t             cmd_port,       // valid dsp command port
00108         u_int           mask,           // mask of flags to inspect
00109         u_int           flags,          // set of flags that must be on
00110         msg_header_t    *msg);          // message to send (simple only)
00111 kern_return_t _DSP_dspcmd_chandata (
00112         mach_port_t             cmd_port,       // valid dsp command port
00113         int             addr,           // .. of dsp buffer
00114         int             size,           // .. of dsp buffer
00115         int             skip,           // dma skip factor
00116         int             space,          // dsp space of buffer
00117         int             mode,           // mode of dma [1..5]
00118         int             chan);          // channel for dma
00119 kern_return_t _DSP_dspcmd_dmaout (
00120         mach_port_t             cmd_port,       // valid dsp command port
00121         int             addr,           // .. in dsp
00122         int             size,           // # dsp words to transfer
00123         int             skip,           // dma skip factor
00124         int             space,          // dsp space of buffer
00125         int             mode,           // mode of dma [1..5]
00126         pointer_t       data);          // data to output
00127 kern_return_t _DSP_dspcmd_dmain (
00128         mach_port_t             cmd_port,       // valid dsp command port
00129         int             addr,           // .. of dsp buffer
00130         int             size,           // .. of dsp buffer
00131         int             skip,           // dma skip factor
00132         int             space,          // dsp space of buffer
00133         int             mode,           // mode of dma [1..5]
00134         pointer_t       *data);         // where data is put
00135 kern_return_t _DSP_dspcmd_abortdma (
00136         mach_port_t             cmd_port,       // valid dsp command port
00137         int             *dma_state,     // returned dma state
00138         vm_address_t    *start,         // returned dma start address
00139         vm_address_t    *stop,          // returned dma stop address
00140         vm_address_t    *next);         // returned dma next address
00141 kern_return_t _DSP_dspcmd_req_msg (
00142         mach_port_t             cmd_port,       // valid dsp command port
00143         mach_port_t             reply_port);    // where to recieve messages
00144 kern_return_t _DSP_dspcmd_req_err (
00145         mach_port_t             cmd_port,       // valid dsp command port
00146         mach_port_t             reply_port);    // where to recieve messages
00147 void _DSP_dspcmd_msg_data (
00148         snd_dsp_msg_t   *msg,           // message containing returned data
00149         int             **buf_addr,     // INOUT address of returned data
00150         int             *buf_size);     // INOUT # ints returned
00151 
00152 msg_header_t *_DSP_dspcmd_msg (
00153         mach_port_t     cmd_port,               // valid dsp command port
00154         mach_port_t     reply_port,             // where to send reply message(s)
00155         int     priority,               // DSP_MSG_{LOW,MED,HIGH}
00156         int     atomic);                // message may not be preempted
00157 
00158 void _DSP_free_dspcmd_msg(msg_header_t **msg);
00159 
00160 msg_header_t *_DSP_dspcmd_msg_reset (
00161         msg_header_t *msg,              // Existing message header
00162         mach_port_t     cmd_port,               // valid dsp command port
00163         mach_port_t     reply_port,             // where to send reply message(s)
00164         int     priority,               // DSP_MSG_{LOW,MED,HIGH}
00165         int     atomic);                // message may not be preempted
00166 
00167 msg_header_t *_DSP_dsprcv_msg (
00168         mach_port_t     cmd_port,               // valid dsp command port
00169         mach_port_t     reply_port);            // where to send reply message(s)
00170 
00171 msg_header_t *_DSP_dsprcv_msg_reset (
00172         msg_header_t *msg,              // message frame to reset
00173         mach_port_t cmd_port,           // valid dsp command port
00174         mach_port_t reply_port);                // where to send reply message(s)
00175 
00176 msg_header_t *_DSP_dspreply_msg (
00177         mach_port_t     reply_port);            // where to send reply message
00178 
00179 msg_header_t *_DSP_dspreply_msg_reset (
00180         msg_header_t *msg,              // Existing message header
00181         mach_port_t     reply_port);            // where to send reply message
00182 
00183 msg_header_t *_DSP_dsp_condition (
00184         msg_header_t    *msg,           // message frame to add request to
00185         u_int           mask,           // mask of flags to inspect
00186         u_int           flags);         // set of flags that must be on
00187 msg_header_t *_DSP_dsp_data (
00188         msg_header_t    *msg,           // message frame to add request to
00189         pointer_t       data,           // data to play
00190         int             eltsize,        // 1, 2, or 4 byte data
00191         int             nelts);         // number of elements of data to send
00192 msg_header_t *_DSP_dsp_host_command (
00193         msg_header_t    *msg,           // message frame to add request to
00194         u_int           host_command);  // host command to execute
00195 msg_header_t *_DSP_dsp_host_flag (
00196         msg_header_t    *msg,           // message frame to add request to
00197         u_int           mask,           // mask of flags to inspect
00198         u_int           flags);         // set of flags that must be on
00199 msg_header_t *_DSP_dsp_ret_msg (
00200         msg_header_t    *msg,           // message frame to add request to
00201         msg_header_t    *ret_msg);      // message to sent to reply port
00202 msg_header_t *_DSP_dspreset (
00203         msg_header_t    *msg);          // message frame to add request to
00204 msg_header_t *_DSP_dspregs (
00205         msg_header_t    *msg);          // message frame to add request to
00206 msg_header_t *_DSP_stream_options (
00207         msg_header_t    *msg,           // message frame to add request to
00208         int             high_water,
00209         int             low_water,
00210         int             dma_size);
00211 msg_header_t *_DSP_dsp_protocol (
00212         msg_header_t    *msg,           // message frame to add request to
00213         mach_port_t             device_port,    // valid device port
00214         mach_port_t             owner_port,     // port registered as owner
00215         int             protocol);      // protocol bits
00216 msg_header_t *_DSP_dsp_read_data(
00217         msg_header_t *msg,              // message frame
00218         int eltsize,                    // 1, 2, 3, or 4 byte data
00219         int nelts);                     // number of data elements
00220 
00221 #endif