The DSS3 system is made up of several devices, two of which are DSP's, called PC32 and PC44. The functions in Dss3lib are associated with either the PC32 or PC44, depending on their use.
The PC32 controls the timers of the signal output, and it also takes care of Unit Event Timer data collection, and it provides external start signals for other devices such as the a/d converter and the rate generators. Also, the PC32 is connected to the rate generators, and we send information to the rate generators through the PC32.
The following functions use the PC32. Note that setup32() must be called before calling any others among them:
setup32()
reset32()
...
long setup44 ( )
This function creates a handle to the PC44 device, and boots the PC44 processor. It must be called once before any other calls to the PC44.
Return values:
| 1 | Normal return, no errors | |
| 501 | Failed to initialize, start PC44 device driver | |
| -8 | Failed to open PC44 Dualport RAM |
long startmode (long stimmode)
| long stimmode | integer code for the PC44 stimulus mode. 1 = GEWAB mode; 2 = FM sweep mode |
This function sets up the mode of the PC44, loads the appropriate stimulus generation program, and starts it up. The PC44 then waits for a set of stimulus parameters and commands that are used for stimulus generation. The following modes are available. Each of these modes has a file containing its stimulus generation program, which is loaded by startmode( ):
| Mode | Stimulus Generation Program | |
| 1 | C:\Audstuff\D\GEWABLOOP.OUT | |
| 2 | C:\Audstuff\D\MODULATOR.OUT |
Return values:
| 1 | Normal return, no errors | |
| other | Error loading and/or running stimulus generation code. |
long restartmode ( )
This function stops the stimulus generation code, (stopping the DAC's), but keeps the current stimulus mode. (See startmode( ).) It restarts the code associated with the the current stimulus mode, and the PC44 then waits for commands that will load new stimulus parameters and start a new stimulus. It effectively leaves the PC44 in the same state that startmode( ) does. To change modes, use reset44( ) followed by startmode( ), not restartmode( ).
Return values:
| 1 | Normal return, no errors | |
| other | Error restarting stimulus generation code. |
long reset44 ( )
This function stops the stimulus generation code, (stopping DAC output). It resets the PC44, clears out any previous mode that was specified with startmode( ).
Return values:
| 1 | Normal return, no errors | |
| other | Error stopping stimulus generation. |
long initgwparams ( )
This routine initializes the gewab parameter buffer. This must be done before calling setgwparams( ) for either or both DAC channels.
Return values:
| 1 | Normal return, no errors | |
| 501 | Failed to initialize, start PC44 device driver | |
| -8 | Failed to open PC44 Dualport RAM |
long setgwparams (long dssnum, unsigned long gewabnpts, double dur, long envcode, double rtime, double ftime, double rate)
| long dssnum | integer code for DAC channel to be set up. So far, 1 is the 25 bit dac, 2 is the 16 bit dac. | |
| unsigned long gewabnpts | number of points in waveform | |
| double dur | duration time, in seconds (can be greater than or less than gewabnpts*rate); the waveform in wavebuf will be repeated if necessary; dur does NOT include the rise or fall time | |
| long envcode | integer code for rise/fall envelope; 1=linear, 2=cosine, 3=gausssian | |
| double rtime | rise time, in seconds | |
| double ftime | fall time, in seconds | |
| double rate | sample rate of DAC output (see rgrate( ) for setting this rate in rate generator, separately) |
This function is used to specify the gewab parameters for one of the DAC channels. To set up multiple channels, it must be called more than once. Before calling it, the function initgwparams( ) must be called.
Return values:
| 1 | Normal return, no errors | |
| other | Error setting gewab paramters. |
long loadgwinfo( )
This function is used to transfer all of the gewab parameters that have previously been specified (with setgwparams( ) ) to the PC44. Before calling it, the following routines must be called:
Return values:
| 1 | Normal return, no errors | |
| other | Error loading gewab parameters. |
long loadgwwave(long dssnum, long *wavebuf1, unsigned long gewabnpts1, long *wavebuf2, unsigned long gewabnpts2)
| long dssnum | integer code for DAC channel for which waveform is to be loaded. This can be 1, 2, or 3, where 1=DAC 1, 2=DAC 2, and 3=both DACs | |
| long *wavebuf1 | array containing waveform for DAC 1 | |
| unsigned long gewabnpts1 | number of points in wavebuf1 | |
| long *wavebuf2 | array containing waveform for DAC 2 | |
| unsigned long gewabnpts2 | number of points in wavebuf2 |
This function transfers gewab waveforms to both DACs. (The PC44 requires that both arrays be sent at once.) If only one DAC is to be used, then the parameter dssnum is 1 or 2, in which case the routine transfers a dummy array to the not-used DAC. If dssnum is 3, then it transfers the waveforms that are specified for the 2 different DACs. The waveform arrays are long (32-bit) integers. This function should not be called more than once. If this is done, then the last call to it will over- ride the previous calls.
Return values:
| 1 | Normal return, no errors | |
| other | Error loading gewab waveforms. |
long setattn(unsigned long channumb, unsigned long attenval)
| unsigned long channumb | The channel number of the DAC whose attenuation is to be set. Possible values are: 1 -- DAC1 2 -- DAC2 | |
| unsigned long attenval | The attenuation value (0 dB to 127 dB) |
This function sets the attenuation for one of the PC44 DAC outputs. Attenuation values are in dB and can range from 0 to 127. Before calling setattn(), the following routines must be called:
Return values:
| 1 | Normal return, no errors | |
| other | Error setting attenuator. |
long setup32 ( )
This function creates a handle to the PC32 device, and boots the pc32 processor. It must be called once before any other calls to the PC32.
Return values:
| 1 | Normal return, no errors | |
| 401 | Failed to initialize, start PC32 device driver | |
| 402 | Can't find PC32 boot file C:\Audstuff\D\Core.out | |
| 0 | Error loading C:\Audstuff\D\SEQUENCE8.OUT (sequencer code) into PC32 | |
| -1 | The file C:\Audstuff\D\SEQUENCE8.OUT is empty | |
| 10 | The file C:\Audstuff\D\SEQUENCE8.OUT is not DSP code | |
| 11 | The file C:\Audstuff\D\SEQUENCE8.OUT is not executable | |
| 12 | The file C:\Audstuff\D\SEQUENCE8.OUT is not PC32 compatible | |
| 13 | The file C:\Audstuff\D\SEQUENCE8.OUT does not have correct structure | |
| 14 | The file C:\Audstuff\D\SEQUENCE8.OUT has bad header | |
| 15 | The file C:\Audstuff\D\SEQUENCE8.OUT is too big for PC32 ram |
long reset32 ()
Restart the PC32 processor. It will stop the timer sequence and UET input, and clear the input buffer.
Return values:
| 1 | Normal return, no errors | |
| 0 | Error resetting PC32 |
long startseq ()
Start the timer sequence of the PC32. It also starts UET input.
Return values:
| 1 | Normal return, no errors | |
| 0 | Error starting PC32 sequencer and uet data collection |
long seqclrchan()
This function clears out the timer sequence, which is an array of times and channel information used by the PC32 sequencer. This sequence controls the signals which go from the PC32 to the PC44. These signals determine the stimulus repetition, channel delays, channel durations, and repetition count. Note that seqclrchan() must be called before any of the other sequence functions are called.
long setseqprms(long seqchannel, double rint, double dur, double del, double mdel, long nreps)
| long seqchannel | the number of the channel that these parameters are for (1=DAC1, 2=DAC2, 3=A/D converter) | |
| double rint | the repetition time (seconds) for this channel | |
| double dur | duration time (seconds) for this channel | |
| double del | delay (seconds) of duration (within the repetition) of this channel | |
| double mdel | delay of entire time period of this channel with respect to the start of the sequencer (t = 0) | |
| long nreps | number of repetitions of this channel |
This function sets the time parameters for one of the channels controlled by the PC32 sequencer. The current channels being used are: 1 - DAC1 timer gates, 2 - DAC2 timer gates, and 3 - the A/D timer gates. If more than one channel is to be used, then setseqprms() should be called once for each of them. The function seqclrchan() must be called first. Return values:
| 1 | Normal return, no errors | |
| other | Error setting time parameters for a sequence channel. |
long clrrgext()
The function clrrgext() clears the external start and stop controls for all rate generator channels. It must be called before calling setrgext() and also before calling createseq(). Return values:
| 1 | Normal return, no errors | |
| other | Error clearing external start/stop controls for the rate generators. |
long setrgext(long rgchan)
| long rgchan | rate generator channel to be set up for external start/stop |
The function setrgext() sets up the external start and stop control of one of the rate generator channels. for external start and stop, by the PC32 sequencer. It must be called before the function createseq(). Return values:
| 1 | Normal return, no errors | |
| other | Error setting up the external start and stop controls for a rate generator. |
long createseq(unsigned long *ptseqend)
| unsigned long *ptseqend | pointer to the "end sequence" address of the current timer sequence; the value of this argument is specified by creatseq(), not the calling program; this value is later used by the functions getseqstat() and uetini() |
This function creates the timer sequence that is processed by the PC32 sequencer. This timer sequence controls the time characteristics of the DAC1 and DAC2 outputs, and the A/D on/off gate. (Except for the rise/fall envelopes of the stimuli, which are generated in the PC44.) It sets the value of the argument ptseqend to the "end sequence" address of the current timer sequence. The UET functions (uetini, uetrd, etc.) use this "end sequence" address to determine if the timer sequence is still in progress. See uetini(). The PC32 timer sequence is started with the startseq() function (which starts the PC32 sequencer microcode). The PC32 sequencer processes the timer sequence and it also processes the UET input data. So, the timing of UET data and also the timer sequence have the same clock (with a fixed, 1 usec time base). When the PC32 sequencer is started, this clock is set to 0. When the timer sequence is complete, no more UET input will be collected. Before calling createseq(), the following routines must be called:
| 1 | Normal return, no errors | |
| other | Error creating the timer sequence. |
long getseqstat(unsigned long seqend)
| unsigned long seqend | value of the "end sequence" address of the current timer sequence; the value of this argument is specified by the function creatseq() |
This function determines whether a timing sequence which has been created by the function createseq() is still running or has finished.
Return values:
| 0 | Sequence is over with. | |
| 1 | Sequence is still running. | |
| 3 | Error reading sequence counter from PC32 Dual Port RAM | |
| 4 | Error reading sequence pointer from PC32 Dual Port RAM |
long rgstopall()
This function is used to stop all rate generators. It is generally called before setting up a timing sequence. Return values:
| 1 | Normal return, no errors | |
| other | Error stopping rate generators. |
long rgrate(unsigned long rgnumb, double ratecur, double phasecur, long strtmode)
| unsigned long rgnumb | number of the rate generator to be set up (1-8) | |
| double ratecur | rate (Hz) | |
| double phasecur | phase (0.0 to 1.0) | |
| long strtmode | start mode (0=program strt, 1=ext. strt) |
This function sets up the rate and starting phase of one of the 8 possible rate generators. These rate generators (1 through 8) have outputs on the front panel, and should be connected with the devices for which they provide the rate, which include DAC 1, DAC 2, and A/D. If strtmode is set to 0, then the rate generator in question will be set up and started right away. If set to 1, then the rate generator will be set up and wait for external signal. Return values:
| 1 | Normal return, no errors | |
| other | Error setting up rate and phase for rate generator. |
..........
long functionname(long longarg)
| long argname | description | |
| long argname | description | |
| long argname | description |
Com Program Documentation -- General
jane@physiology.wisc.edu