MusicKit  0.0.0
_DSPMachAccessMacros.h
00001 /* 
00002  * This file contains macros intended to hide the differences between the
00003  * m68k and i386 Mach message structures 
00004  */
00005 
00006 /************************ 68k macros **********************/
00007 #if m68k
00008 
00009 /* snd_recorded_data_t */
00010 #define _DSP_DATA_MSG_DATA(_msg) \
00011   ((vm_address_t)((snd_recorded_data_t *)_msg)->recorded_data)
00012 
00013 #define _DSP_DATA_MSG_COUNT(_msg) \
00014   ((vm_size_t)((snd_recorded_data_t *)_msg)->dataType.msg_type_long_number)
00015 
00016 #define _DSP_DATA_MSG_DATA_SIZE(_msg) _DSP_DATA_MSG_COUNT(_msg)
00017 
00018 #define _DSP_DATA_MSG_SIZE MSG_SIZE_MAX
00019 
00020 #define _DSP_STREAM_MSG(_oldMsg,_port,_threadReply,_tag,_chan,_msgID) \
00021   _DSP_stream_msg(_oldMsg,_port,_threadReply,_tag)
00022 
00023 /* snd_dsp_msg_t */
00024 /* Errors */
00025 #define _DSP_ERROR_MSG_COUNT(_msg) \
00026   ((snd_dsp_msg_t *)_msg)->dataType.msg_type_long_number
00027 
00028 #define _DSP_ERROR_MSG(_msg,_index) \
00029   ((snd_dsp_msg_t *)_msg)->data[_index] 
00030 
00031 #define _DSP_ALLOC_ERROR_MSG(_cmd_port,_reply_port) \
00032   _DSP_dsprcv_msg(_cmd_port,_reply_port)
00033 
00034 #define _DSP_FREE_ERROR_MSG(_msg) _DSP_free_dspcmd_msg(_msg)
00035 
00036 /* DSP msgs */
00037 #define _DSP_DSPMSG_MSG_COUNT(_msg) \
00038   ((snd_dsp_msg_t *)_msg)->dataType.msg_type_long_number
00039 
00040 #define _DSP_DSPMSG_MSG(_msg,_index) \
00041   ((snd_dsp_msg_t *)_msg)->data[_index] 
00042 
00043 #define _DSP_ALLOC_DSPMSG_MSG(_cmd_port,_reply_port) \
00044   _DSP_dsprcv_msg(_cmd_port,_reply_port)
00045 
00046 #define _DSP_FREE_DSPMSG_MSG(_msg) _DSP_free_dspcmd_msg(_msg)
00047 
00048 #define _DSP_DSPRCV_MSG_RESET(_msg,_hmPort,_rcvPort) \
00049         _DSP_dsprcv_msg_reset(_msg,_hmPort,_rcvPort)
00050 
00051 #endif
00052 
00053 /************************ Intel macros **********************/
00054 #if !m68k && defined(NeXT)
00055 
00056 /* DSPDRIVERDataMessage */
00057 #define _DSP_DATA_MSG_DATA(_msg) \
00058   ((vm_address_t)((DSPDRIVERDataMessage *)_msg)->data)
00059 
00060 #define _DSP_DATA_MSG_COUNT(_msg) \
00061   ((vm_size_t)((DSPDRIVERDataMessage *)_msg)->nbytes)
00062 
00063 #define _DSP_DATA_MSG_DATA_SIZE(_msg) _DSP_DATA_MSG_COUNT(_msg)
00064 
00065 #define _DSP_DATA_MSG_SIZE sizeof(DSPDRIVERDataMessage)
00066 
00067 #define MSGSIZ sizeof(DSPDRIVERDataMessage) /* MSG_SIZE_MAX? */
00068 #define _DSP_STREAM_MSG(_oldMsg,_port,_threadReply,_tag,_chan,_msgID) \
00069    _DSP_data_request_msg(_oldMsg,_port,_threadReply,_tag,_chan,_msgID)
00070 
00071 /* DSPDRIVERSimpleMessage */
00072 /* Errors */
00073 #define _DSP_ERROR_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00074 
00075 #define _DSP_ERROR_MSG(_msg,_index) \
00076   ((DSPDRIVERSimpleMessage *)_msg)->regionTag 
00077 
00078 #define _DSP_ALLOC_ERROR_MSG(_cmd_port,_reply_port) \
00079   _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00080 
00081 #define _DSP_FREE_ERROR_MSG(_msg) _DSP_free_simple_request_msg(_msg)
00082 
00083 /* DSP Msgs */
00084 #define _DSP_DSPMSG_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00085 
00086 #define _DSP_DSPMSG_MSG(_msg,_index) \
00087   ((DSPDRIVERSimpleMessage *)_msg)->regionTag 
00088 
00089 #define _DSP_ALLOC_DSPMSG_MSG(_cmd_port,_reply_port) \
00090   _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00091 
00092 #define _DSP_FREE_DSPMSG_MSG(_msg) _DSP_free_simple_request_msg(_msg)
00093 
00094 #define _DSP_DSPRCV_MSG_RESET(_msg,_hmPort,_rcvPort) \
00095         _msg->msgh_size = sizeof(DSPDRIVERSimpleMessage); \
00096         _msg->msgh_local_port = _rcvPort
00097 
00098 #endif
00099 
00100 /* LMS - currently just a duplicate of intel with routines commented out*/
00101 /************************ PPC macros **********************/
00102 #if ppc
00103 
00104 /* DSPDRIVERDataMessage */
00105 #define _DSP_DATA_MSG_DATA(_msg) \
00106   ((vm_address_t)((DSPDRIVERDataMessage *)_msg)->data)
00107 
00108 #define _DSP_DATA_MSG_COUNT(_msg) \
00109   ((vm_size_t)((DSPDRIVERDataMessage *)_msg)->nbytes)
00110 
00111 #define _DSP_DATA_MSG_DATA_SIZE(_msg) _DSP_DATA_MSG_COUNT(_msg)
00112 
00113 #define _DSP_DATA_MSG_SIZE sizeof(DSPDRIVERDataMessage)
00114 
00115 #define MSGSIZ sizeof(DSPDRIVERDataMessage) /* MSG_SIZE_MAX? */
00116 #define _DSP_STREAM_MSG(_oldMsg,_port,_threadReply,_tag,_chan,_msgID) \
00117    _DSP_data_request_msg(_oldMsg,_port,_threadReply,_tag,_chan,_msgID)
00118 
00119 /* DSPDRIVERSimpleMessage */
00120 /* Errors */
00121 #define _DSP_ERROR_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00122 
00123 #define _DSP_ERROR_MSG(_msg,_index) \
00124   ((DSPDRIVERSimpleMessage *)_msg)->regionTag 
00125 
00126 #define _DSP_ALLOC_ERROR_MSG(_cmd_port,_reply_port) \
00127   _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00128 
00129 #define _DSP_FREE_ERROR_MSG(_msg)  _DSP_free_simple_request_msg(_msg)
00130 
00131 /* DSP Msgs */
00132 #define _DSP_DSPMSG_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00133 
00134 #define _DSP_DSPMSG_MSG(_msg,_index) \
00135   ((DSPDRIVERSimpleMessage *)_msg)->regionTag 
00136 
00137 #define _DSP_ALLOC_DSPMSG_MSG(_cmd_port,_reply_port) \
00138    _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00139 
00140 #define _DSP_FREE_DSPMSG_MSG(_msg) _DSP_free_simple_request_msg(_msg)
00141 
00142 #define _DSP_DSPRCV_MSG_RESET(_msg,_hmPort,_rcvPort) \
00143         _msg->msgh_size = sizeof(DSPDRIVERSimpleMessage); \
00144         _msg->msgh_local_port = _rcvPort
00145 
00146 #endif
00147 
00148 /* LMS - currently just a duplicate of intel with routines commented out*/
00149 /************************ WIN32 macros **********************/
00150 #if WIN32
00151 
00152 /* DSPDRIVERDataMessage */
00153 #define _DSP_DATA_MSG_DATA(_msg) \
00154   ((vm_address_t)((DSPDRIVERDataMessage *)_msg)->data)
00155 
00156 #define _DSP_DATA_MSG_COUNT(_msg) \
00157   ((vm_size_t)((DSPDRIVERDataMessage *)_msg)->nbytes)
00158 
00159 #define _DSP_DATA_MSG_DATA_SIZE(_msg) _DSP_DATA_MSG_COUNT(_msg)
00160 
00161 #define _DSP_DATA_MSG_SIZE sizeof(DSPDRIVERDataMessage)
00162 
00163 #define MSGSIZ sizeof(DSPDRIVERDataMessage) /* MSG_SIZE_MAX? */
00164 #define _DSP_STREAM_MSG(_oldMsg,_port,_threadReply,_tag,_chan,_msgID) \
00165    _DSP_data_request_msg(_oldMsg,_port,_threadReply,_tag,_chan,_msgID)
00166 
00167 /* DSPDRIVERSimpleMessage */
00168 /* Errors */
00169 #define _DSP_ERROR_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00170 
00171 #define _DSP_ERROR_MSG(_msg,_index) \
00172   ((DSPDRIVERSimpleMessage *)_msg)->regionTag
00173 
00174 #define _DSP_ALLOC_ERROR_MSG(_cmd_port,_reply_port) \
00175   _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00176 
00177 #define _DSP_FREE_ERROR_MSG(_msg)  _DSP_free_simple_request_msg(_msg)
00178 
00179 /* DSP Msgs */
00180 #define _DSP_DSPMSG_MSG_COUNT(_msg) 1 /* No count supported on Intel */
00181 
00182 #define _DSP_DSPMSG_MSG(_msg,_index) \
00183   ((DSPDRIVERSimpleMessage *)_msg)->regionTag
00184 
00185 #define _DSP_ALLOC_DSPMSG_MSG(_cmd_port,_reply_port) \
00186    _DSP_simple_request_msg(_cmd_port,_reply_port,DSPDRIVER_MSG_RET_DSP_ERR)
00187 
00188 #define _DSP_FREE_DSPMSG_MSG(_msg) _DSP_free_simple_request_msg(_msg)
00189 
00190 #define _DSP_DSPRCV_MSG_RESET(_msg,_hmPort,_rcvPort) \
00191         _msg->msgh_size = sizeof(DSPDRIVERSimpleMessage); \
00192         _msg->msgh_local_port = _rcvPort
00193 
00194 #endif