MusicKit
0.0.0
|
00001 #ifndef __MK__dsp_H___ 00002 #define __MK__dsp_H___ 00003 /* 00004 _dsp.h 00005 00006 Copyright 1988-1992, NeXT Inc. All rights reserved. 00007 00008 This file contains definitions, typedefs, and forward declarations 00009 used by libdsp functions. 00010 00011 Modification history 00012 07/01/88/jos - prepended '/' to all RELATIVE file names 00013 in case DSP environment variable has no trailing '/' 00014 10/07/88/jos - Changed default DSP directory and filenames for release. 00015 12/12/89/jos - Changed _DSP_MACH_SEND_TIMEOUT from 0 to 100 ms. 00016 01/13/90/jos - Introduced MAPPED_ONLY_POSSIBLE macro for ifdef's. 00017 01/13/90/jos - Introduced SIMULATOR_POSSIBLE macro for ifdef's. 00018 01/13/90/jos - Introduced TRACE_POSSIBLE macro for ifdef's. 00019 01/13/90/jos - Removed puzzling '#include "DSPMessage.h"' at EOF (!?) 00020 04/23/90/jos - Added private "aux dsp structures" from dsp_structs.h. 00021 08/27/92/daj - Changed definition of DSPRegs 00022 */ 00023 #ifndef _LIBDSP_ 00024 #define _LIBDSP_ 00025 00026 #ifdef GNUSTEP 00027 #define import include 00028 #endif 00029 00030 #define SIMULATOR_POSSIBLE 0 00031 #define TRACE_POSSIBLE 1 00032 00033 #define NO_VPRINTF 1 00034 00035 #define REMEMBER(x) /* x */ 00036 00037 /*** INCLUDE FILES ***/ 00038 00039 #ifdef WIN32 00040 #import <io.h> // LMS if we become more OpenStep-ish, this won't be necessary 00041 #else 00042 #import <sys/file.h> 00043 #import <sys/time.h> /* DSPAwaitData(), DSPMessageGet() */ 00044 /* DSPAwaitUnsignedReply() _DSPAwait*() */ 00045 #endif 00046 #import <stdlib.h> // for Windows prototypes, but it's general enough 00047 #import <string.h> 00048 00049 /* For access(2) which does not have definitions on Windows LMS */ 00050 #ifdef WIN32 00051 #define R_OK 4/* test for read permission */ 00052 #define W_OK 2/* test for write permission */ 00053 #define X_OK 1/* test for execute (search) permission */ 00054 #define F_OK 0/* test for presence of file */ 00055 #endif 00056 00057 /* 00058 *** NOTE *** math.h allocates 0.0 for use by the built-in 00059 functions such as log. This allocation screws up the making 00060 of the Global data section of a shared library. Thus, math.h 00061 cannot be included by DSPGlobals.c. 00062 */ 00063 00064 #import <math.h> 00065 #import <ctype.h> 00066 00067 extern int DSPDefaultTimeLimit; 00068 00069 /* DSP include files */ 00070 00071 #import "dsp.h" /* main DSP header file */ 00072 00073 #define _DSP_MAX_LINE 256 /* max chars per line on input (via fgets) */ 00074 #define _DSP_MAX_NAME 80 /* Allow for long paths (getfil.c, geti.c) */ 00075 #define _DSP_MAX_CMD 12 /* Max no. chars in a command (indexs.c) */ 00076 00077 #if 0 00078 #define _DSP_EXPANDSIZE 512 /* must be even (for l: data in _DSPLnkRead) */ 00079 #define _DSP_EXPANDSMALL 10 /* This one can be left small */ 00080 #else /*** FIXME: malloc bug work-around? ***/ 00081 #define _DSP_EXPANDSIZE 81920 /* must be even (for l: data in _DSPLnkRead) */ 00082 #define _DSP_EXPANDSMALL 81920 /* This one can be left small */ 00083 #endif 00084 00085 #define _DSP_NULLC 0 /* Null character */ 00086 #define _DSP_NOT_AN_INT (0x80000000) 00087 #define _DSP_PATH_DELIM '/' /* don't ask */ 00088 00089 #define _DSP_COUNT_STEP (10) /* how many DSPs to allocate for at a time */ 00090 00091 /* Host message type codes (OR'd with host message opcode) */ 00092 #define _DSP_HMTYPE_UNTIMED 0x880000 /* untimed host message (stack marker) */ 00093 #define _DSP_HMTYPE_TIMEDA 0x990000 /* absolutely timed host message */ 00094 #define _DSP_HMTYPE_TIMEDR 0xAA0000 /* relatively timed (delta) host message */ 00095 00096 /*** FIXME: Flush in 1.1 ***/ 00097 #define _DSP_UNTIMED NULL /* time-stamp NULL means "now" */ 00098 00099 /*** SYSTEM TYPE DECLARATIONS NEEDED BY MACROS HEREIN ***/ 00100 extern char *getenv(); 00101 00102 /*** PRIVATE GLOBAL VARIABLES ***/ /* defined in DSPGlobals.c */ 00103 extern int _DSPTrace; 00104 extern int _DSPVerbose; 00105 extern int DSPAPTimeLimit; 00106 extern int _DSPErrorBlock; 00107 extern int _DSPMessagesEnabled; 00108 extern int _DSPMKWriteDataIsRunning; 00109 extern double _DSPSamplingRate; 00110 extern DSPFix48 _DSPTimeStamp0; 00111 00112 #define DSP_MAYBE_RETURN(x) if (DSPIsSimulated()) ; else return(x) 00113 00114 #define DSP_QUESTION(q) /* q */ 00115 00116 /*************************** Trace bits ***************************/ 00117 00118 #define DSP_TRACE_DSPLOADSPECREAD 1 00119 #define DSP_TRACE_DSPLOADSPECWRITE 2 00120 #define DSP_TRACE_DSPLNKREAD 4 00121 #define DSP_TRACE_FIXUPS 8 00122 #define DSP_TRACE_NOOPTIMIZE 16 00123 #define DSP_TRACE__DSPMEMMAPREAD 32 00124 #define DSP_TRACE__DSPRELOCATE 64 00125 #define DSP_TRACE__DSPRELOCATEUSER 128 00126 #define DSP_TRACE_DSP 256 00127 #define DSP_TRACE_HOST_MESSAGES 256 /* Same as DSP_TRACE_DSP in DSPObject.c */ 00128 #define DSP_TRACE_SYMBOLS 512 /* Also def'd in dspmsg/_DSPMakeIncludeFiles.c */ 00129 #define DSP_TRACE_HOST_INTERFACE 1024 00130 #define DSP_TRACE_BOOT 2048 00131 #define DSP_TRACE_LOAD 4096 00132 #define DSP_TRACE_UTILITIES 8192 00133 #define DSP_TRACE_TEST 16384 00134 #define DSP_TRACE_DSPWRITEC 32768 00135 #define DSP_TRACE_TMQ 0x10000 00136 #define DSP_TRACE_NOSOUND 0x20000 00137 #define DSP_TRACE_SOUND_DATA 0x40000 00138 #define DSP_TRACE_MALLOC 0x80000 00139 #define DSP_TRACE_MEMDIAG 0x100000 /* DSPBoot.c */ 00140 #define DSP_TRACE_WRITE_DATA 0x200000 /* DSPObject.c */ 00141 00142 /*************************** Mach-related defines **************************/ 00143 /* Mach time-outs are in ms */ 00144 #define _DSP_MACH_RCV_TIMEOUT_SEGMENT 10 00145 #define _DSP_MACH_RCV_TIMEOUT 100 00146 #define _DSP_MACH_DEADLOCK_TIMEOUT 100 00147 #define _DSP_ERR_TIMEOUT 100 00148 #define _DSP_MACH_SEND_TIMEOUT 100 00149 #define _DSP_MACH_FOREVER 1000000000 00150 00151 /*** AUXILIARY DSP STRUCTURES ***/ 00152 00153 #if 0 /* DAJ */ 00154 /* DSP host-interface registers, as accessed in memory-mapped mode */ 00155 typedef volatile struct _DSPRegs { 00156 unsigned char icr; 00157 unsigned char cvr; 00158 unsigned char isr; 00159 unsigned char ivr; 00160 union { 00161 struct { 00162 unsigned char pad; 00163 unsigned char h; 00164 unsigned char m; 00165 unsigned char l; 00166 } rx; 00167 struct { 00168 unsigned char pad; 00169 unsigned char h; 00170 unsigned char m; 00171 unsigned char l; 00172 } tx; 00173 } data; 00174 } DSPRegs; 00175 00176 #else 00177 00178 /* DSP host-interface registers, as accessed in memory-mapped mode */ 00179 //for the QP board, dsp regs are in byte 3 of each word 00180 //NOTE: this struct can't be used with the NeXT's DSP! 00181 typedef volatile struct _DSPRegs { //byte offsets are in hex... 00182 unsigned char icr_pad[3]; //00,01,02 00183 unsigned char icr; //03 00184 unsigned char cvr_pad[3]; //04.05.06 00185 unsigned char cvr; //07 00186 unsigned char isr_pad[3]; //08.09,0a 00187 unsigned char isr; //0b 00188 unsigned char ivr_pad[3]; //0c,0d,0e 00189 unsigned char ivr; //0f 00190 union { 00191 unsigned int receive; 00192 struct { 00193 unsigned char pad; 00194 unsigned char h; 00195 unsigned char m; 00196 unsigned char l; 00197 } rx; 00198 unsigned int transmit; 00199 struct { 00200 unsigned char pad; 00201 unsigned char h; 00202 unsigned char m; 00203 unsigned char l; 00204 } tx; 00205 } data; 00206 } DSPRegs; 00207 00208 #endif 00209 00210 typedef struct __DSPMemMap { /* DSP memory map descriptor */ 00211 /* NeXT MK and AP software makes use of relocation only within the USER 00212 section at present. The GLOBAL and SYSTEM sections must be absolute. 00213 However, the struct can easily be extended to multiple relocatable 00214 sections: */ 00215 int defaultOffsets[DSP_LC_NUM];/* START directive in .mem file: NOT USED */ 00216 int userOffsets[DSP_LC_NUM]; /* SECTION USER in memory-map (.mem) file */ 00217 int nOtherOffsets[DSP_LC_NUM]; /* number of other relocatable sections */ 00218 int *otherOffsets[DSP_LC_NUM]; /* SECTION <whatever>: NOT USED */ 00219 /* _DSPMemMapRead() will complain if this 00220 is needed (and won't malloc it) */ 00221 } _DSPMemMap; 00222 00223 #define _DSPMK_WD_BUF_BYTES 8192 /* vm_page_size */ 00224 #define _DSPMK_RD_BUF_BYTES 8192 /* vm_page_size */ 00225 #define _DSPMK_LARGE_SO_BUF_BYTES 8192 00226 /* #define _DSPMK_SMALL_SO_BUF_BYTES DSPMK_NB_DMA_W */ 00227 #define _DSPMK_WD_TIMEOUT 60000 00228 00229 #import "_libdsp.h" 00230 #import "dsp_messages.h" 00231 #import "dsp_memory_map.h" 00232 00233 #endif _LIBDSP_ 00234 00235 #endif