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