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