FB_spm_dataexchange.h

Go to the documentation of this file.
00001 /* SRanger and Gxsm - Gnome X Scanning Microscopy Project
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  *
00005  * Important Notice:
00006  * ===================================================================
00007  * THIS FILES HAS TO BE IDENTICAL WITH THE CORESPONDING
00008  * SRANGER-DSP-SOFT SOURCE FILE (same name) AND/OR OTHER WAY ROUND!!
00009  * It's included in both, the SRanger and Gxsm-2.0 CVS tree for easier
00010  * independend package usage.
00011  * ===================================================================
00012  *
00013  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00014  *
00015  * Authors: Percy Zahl <zahl@users.sf.net>
00016  * WWW Home:
00017  * DSP part:  http://sranger.sf.net
00018  * Gxsm part: http://gxsm.sf.net
00019  *
00020  * This program is free software; you can redistribute it and/or modify
00021  * it under the terms of the GNU General Public License as published by
00022  * the Free Software Foundation; either version 2 of the License, or
00023  * (at your option) any later version.
00024  *
00025  * This program is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00028  * GNU General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU General Public License
00031  * along with this program; if not, write to the Free Software
00032  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00033  */
00034 
00035 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00036 
00037 #ifndef __FB_SPM_DATAEXCHANGE_H
00038 #define __FB_SPM_DATAEXCHANGE_H
00039 
00040 /* Special Features Config */
00041 
00042 /* define DSP_OFFSET_ADDING if the XY-Offset should be added to the XY-Scan-Position, 
00043  * no XY-Offset output if defined! 
00044  */
00045 #define DSP_OFFSET_ADDING
00046 
00047 /* define DSP_LIN_FUZZYMIX_OPTION if fuzzy mixing of Daemping and dFrq is desired 
00048  */
00049 #define DSP_LIN_DFM_FUZZYMIX_OPTION
00050 
00051 /* define DSP_PROBE_AIC_AVG if AIC_in_0..5 should be integrated and normalized while Vector probe (inbetween points)
00052  */
00053 #define DSP_PROBE_AIC_AVG
00054 
00055 /* define DSP_AS_AIC_AVG if AIC_in_0..5 & Zout should be integrated and normalized while area scan (inbetween points)
00056  */
00057 #define DSP_AS_AIC_AVG
00058 
00059 /* define DSP_PROBE_VECTOR_PROGRAM if the Vector table shall be programmable with loops, enable vector micro kernel
00060  */
00061 #define DSP_PROBE_VECTOR_PROGRAM
00062 
00063 /* DSP-Soft Identification */
00064 
00065 #define FB_SPM_MAGIC_ADR 0x4000 /* Magic struct is at this fixed addess in external SRAM */
00066 #define FB_SPM_MAGIC     0xEE01
00067 
00068 /* Features Description */
00069 
00070 #ifdef DSP_OFFSET_ADDING
00071 # define FB_SPM_FEATURES_OFFSET_ADDING "enabled"
00072 #else
00073 # define FB_SPM_FEATURES_OFFSET_ADDING "disabled"
00074 #endif
00075 
00076 #ifdef DSP_LIN_DFM_FUZZYMIX_OPTION
00077 # define FB_SPM_FEATURES_DFM_FUZZY "available"
00078 #else
00079 # define FB_SPM_FEATURES_DFM_FUZZY "not available"
00080 #endif
00081 
00082 #ifdef DSP_PROBE_AIC_AVG
00083 # define FB_SPM_FEATURES_AIC_INT "Yes"
00084 #else
00085 # define FB_SPM_FEATURES_AIC_INT "No"
00086 #endif
00087 
00088 #ifdef DSP_AS_AIC_AVG
00089 # define FB_SPM_FEATURES_AIC_AS_INT "Yes"
00090 #else
00091 # define FB_SPM_FEATURES_AIC_AS_INT "No"
00092 #endif
00093 
00094 #ifdef DSP_PROBE_VECTOR_PROGRAM
00095 # define FB_SPM_FEATURES_VECTOR_PRG "Yes"
00096 #else
00097 # define FB_SPM_FEATURES_VECTOR_PRG "No"
00098 #endif
00099 
00100 // these are checked/compared with the Gxsm-build and must match!
00101 // -- otherwise you exactly need to know/be sure what you are doing --
00102 // -- odd things like changed data structures, etc.., could break data transfer --
00103 #define FB_SPM_SOFT_ID   0x1001 /* FB_SPM sofware id */
00104 #define FB_SPM_VERSION   0x1049 /* FB_SPM main Version, BCD: 00.00 */
00105 #define FB_SPM_DATE_YEAR 0x2006 /* Date: Year, BCD */
00106 #define FB_SPM_DATE_MMDD 0x0313 /* Date: Month/Day, BCD */
00107 
00108 #define FB_SPM_FEATURES     \
00109         "Log/Lin. Feedback: Yes\nFB-EXT: Option\n"\
00110         "SCAN: Yes & 2nd-Zoff-scan Disabled! AIC_INT: " FB_SPM_FEATURES_AIC_AS_INT "\n" \
00111         "Scan and Offset: vector moves\n" \
00112         "MOVER,APP+ChanSelect: Yes\n"\
00113         "VPROBE: Yes\nVPROBE-AICdnxINT: " FB_SPM_FEATURES_AIC_INT "\nACPROBE: Yes\nACPROBE2ND: Yes\nACphiQ19\n"\
00114         "VPROBE-Program-Loops: " FB_SPM_FEATURES_VECTOR_PRG "\n"\
00115         "DSOSZI: Yes\n"\
00116         "DSP-level XY-Offset-Adding:" FB_SPM_FEATURES_OFFSET_ADDING "\n"\
00117         "DFM fuzzymix of Damping+dfrq:" FB_SPM_FEATURES_DFM_FUZZY "\n"\
00118         "CoolRunner Out Puls: Yes\n"
00119 
00120 
00121 typedef short DSP_INT;
00122 typedef unsigned short DSP_UINT;
00123 typedef long DSP_LONG;
00124 typedef unsigned long DSP_ULONG;
00125 
00126 
00127 // use DSP_CC for DSP CC, not if used for GXSM SRanger_HwI include file!
00128 
00129 // #define DSP_CC
00130 
00131 #ifdef DSP_CC
00132 # define PROBE_VECTOR_P  PROBE_VECTOR*  
00133 # define DSP_INT_P       DSP_INT*
00134 # define DSP_LONG_P      DSP_LONG*
00135 #else
00136 # define PROBE_VECTOR_P  DSP_UINT
00137 # define DSP_INT_P       DSP_UINT
00138 # define DSP_LONG_P      DSP_UINT
00139 #endif
00140 /*
00141  * only used for initialisation, no floats needed on DSP, 
00142  * only the cc should compute this! 
00143  */
00144 
00145 #define U_DA_MAX  2.06
00146 #define U_AD_MAX 10.0
00147 #define VOLT2DAC(U) (DSP_INT)((U)*32767./U_DA_MAX)
00148 #define DAC2VOLT(R) (DSP_INT)((R)*U_AD_MAX/32767.)
00149 
00150 /*
00151  * Here are all structs and constants needed for data exchange and
00152  * control from user frontend (Gxsm)
00153  * ===============================================================
00154  *
00155  * Read/Write permissions to be followed by Host are indicated by:
00156  * =RO -> Read Only
00157  * =WO -> Write Only (Read OK, but useless)
00158  * =RW -> Read and Write allowed
00159  *
00160  * The similar named macro "MAX_WRITE_structname" defines the max
00161  * allowed write length in DSP words. All host writeabe members are
00162  * located at the beginning of the struct.
00163  * 
00164  * Note:
00165  * DSP_(U)LONG type needs to be LONG-word aligned!!
00166  */
00167 
00168 /* 
00169  * definitions used for statemaschine controls 
00170  * ==================================================
00171  */
00172 
00173 #define MD_READY        0x0001  /* Ready, no idle task (scan,move,probe,approch,...) is running */
00174 #define MD_BUSY         0x8000  /* Ready, no idle task (scan,move,probe,approch,...) is running */
00175 #define MD_AIC_RECONFIG 0x4000  /* Request AIC Reconfig */
00176 #define MD_BLK          0x0002  /* Blinking indicator - DSPs heartbeat */
00177 #define MD_PID          0x0004  /* PID-Regler activ */
00178 #define MD_LOG          0x0008  /* Log enable flag */
00179 #define MD_OFFSETCOMP   0x0010  /* Offset Compensation on */
00180 #define MD_ZTRAN        0x0020  /* Transform Z(AIC[7]) * (-1) -> AIC[6] */
00181 #define MD_DFM_FUZZY    0x0040  /* DFM Fuzzymixmode: AIC[1] (Daemping) & AIC[6] (dF) are mixed */
00182 #define MD_OFFSETADDING 0x0080  /* DSP-level Offset Adding */
00183 #define MD_EXTFB        0x0100  /* Switching external feedback control ON/OFF */
00184 #define MD_AIC_SLOW     0x0200  /* Enable AIC averaging to get slow and smooth readings */
00185 #define MD_WATCH        0x0400  /* Watching variables on OUT7 */
00186 
00187 #define MAX_WRITE_SPM_MAGIC_DATA_LOCATIONS 0
00188 typedef struct {
00189         DSP_UINT magic;         /* 0: Magic Number to validate entry =RO */
00190         DSP_UINT version;       /* 1: SPM soft verion, BCD =RO */
00191         DSP_UINT year,mmdd;     /* 2: year, date, BCD =RO */
00192         DSP_UINT dsp_soft_id;   /* 4: Unique SRanger DSP software ID =RO */
00193         DSP_UINT statemachine;  /* 5: Address of statemachine struct =RO */
00194         DSP_UINT AIC_in;        /* 6: AIC in buffer =RO */
00195         DSP_UINT AIC_out;       /* 7: AIC out buffer =RO */
00196         DSP_UINT AIC_reg;       /* 8: AIC register (AIC control struct) =RO */
00197         /* -------------------- basic magic data set ends ----------------------- */
00198         DSP_UINT feedback;      /*  9: Address of feedback struct =RO */
00199         DSP_UINT analog;        /* 10: Address of analog struct =RO */
00200         DSP_UINT scan;          /* 11: Address of ascan struct =RO */
00201         DSP_UINT move;          /* 12: Address of move struct =RO */
00202         DSP_UINT probe;         /* 13: Address of probe struct =RO */
00203         DSP_UINT autoapproach;  /* 14: Address of autoapproch struct =RO */
00204         DSP_UINT datafifo;      /* 15: Address of datafifo struct =RO */
00205         DSP_UINT probedatafifo; /* 16: Address of probe datafifo struct =RO */
00206         DSP_UINT dsoszi;        /* 17: Address of Digital Oszilloscope control struct =RO */
00207         DSP_UINT dfm_fuzzymix;  /* 18: Address of DFM FUZZY mix control parameter struct =RO */
00208         DSP_UINT CR_out_puls;   /* 19: Address of CoolRunner IO Out Puls action struct =RO */
00209         DSP_UINT external;      /* 20: Address of external control struct =RO */
00210         DSP_UINT CR_generic_io; /* 21: Address of CR_generic_io struct =RO */
00211         DSP_UINT dummy;         /* --: Address of xxx struct =RO */
00212 } SPM_MAGIC_DATA_LOCATIONS;
00213 
00214 #define MAX_WRITE_SPM_STATEMACHINE 2
00215 typedef struct {
00216         DSP_UINT set_mode;      /* mode change request: set bits =WO */
00217         DSP_UINT clr_mode;      /* mode change request: clear bits =WO */
00218         DSP_UINT mode;          /* current state =RO */
00219         DSP_UINT last_mode;     /* last state =RO */
00220         DSP_ULONG BLK_count;    /* DSP counter, incremented in dataprocess =RO */
00221         DSP_ULONG BLK_Ncount;   /* divider to get 1/10 sec =RO */
00222         DSP_ULONG DSP_time;     /* DSP time in 1/10sec =RO */
00223         DSP_INT DSP_tens;       /* counter to derive 1Hz heart beat =RO */
00224         DSP_INT DataProcessTime;/* time spend in dataprocess -- performance indicator =RO */
00225         DSP_INT IdleTime;       /* time spend not in dataprocess -- performance indicator =RO */
00226         DSP_INT DataProcessTime_Peak; /* time spend in dataprocess, peak -- performance indicator =RO */
00227         DSP_INT IdleTime_Peak;        /* time spend not in dataprocess, peak -- performance indicator =RO */
00228         DSP_INT DataProcessMode;/* Mode of data processing =RO */
00229 } SPM_STATEMACHINE;
00230 
00231 /* 
00232  * definitions used for feedback control
00233  * ==================================================
00234  */
00235 
00236 /* Feedback System Data/Control Block */
00237 
00238 #define MAX_WRITE_SPM_PI_FEEDBACK 3
00239 typedef struct {
00240         DSP_INT cp;           /* Const Proportional in Q15 rep =RW */
00241         DSP_INT ci;           /* Const Integral in Q15 rep =RW */
00242         DSP_INT setpoint;     /* real world setpoint, if loaded gain, spm_logn will be calculated and "soll" is updated =WO */
00243         DSP_INT soll;         /* "Soll Wert" Set Point (behind log trafo) =RO */
00244         DSP_INT ist;          /* "Ist Wert" Real System Value (behind log trafo) =RO */
00245         DSP_INT delta;        /* "Regelabweichung" ist-soll =RO */
00246         DSP_LONG i_sum;       /* CI - summing, 32bits! =RO */
00247         DSP_INT z;            /* "Stellwert" Feedback Control Value "Z" =RO */
00248 } SPM_PI_FEEDBACK;
00249 
00250 /* 
00251  * definitions used for external control
00252  * ==================================================
00253  */
00254 
00255 #define MAX_WRITE_EXT_CONTROL 5
00256 typedef struct {
00257         DSP_INT FB_control_channel;  /* channel for external feedback control (-1 no ext FB control) =RW */
00258         DSP_INT FB_control_treshold; /* treshold for external FB control =RW */ 
00259         DSP_INT watch_value;         /* pass a variable out on channel 7 =RW */
00260         DSP_INT watch_min;           /* minimum output =RW */
00261         DSP_INT watch_max;           /* maximum output =RW */
00262 } EXT_CONTROL;
00263 
00264 
00265 /* 
00266  * definitions used for FUZZY DFM signal mixing
00267  * ==================================================
00268  */
00269 
00270 #define MAX_WRITE_DFM_FUZZYMIX 2
00271 typedef struct {
00272         DSP_INT level; /* Level for FUZZY interaction =RW */
00273         DSP_INT gain;  /* Gain for FUZZY signal in Q15 rep =RW */
00274 } DFM_FUZZYMIX;
00275 
00276 /* 
00277  * definitions used for Move Offset and Scan control
00278  * ==================================================
00279  */
00280 
00281 /* MoveTo X/Y: Offset Coordinates, Controls */
00282 
00283 #define MAX_WRITE_MOVE 12
00284 typedef struct{
00285         DSP_INT     start;           /* Initiate Offset Move =WO */
00286         DSP_INT     nRegel;          /* Anzahl Reglerdurchl�fe je Schritt =WR */
00287         DSP_INT     Xnew, Ynew;      /* new/final offset coordinates =WR */
00288         DSP_LONG    f_dx, f_dy, f_dz;/* dx, dy of line to move along  =WR */
00289         DSP_LONG    num_steps;       /* num steps needed to reach final point and counter =WR */
00290         DSP_LONG    XPos, YPos, ZPos;/* current offset coordinates =RO */
00291         DSP_INT     pflg;            /* process active flag =RO */
00292 } MOVE_OFFSET;
00293 
00294 #define MAX_WRITE_SCAN 34
00295 typedef struct{
00296         DSP_INT  start;             /* 0 Initiate Area Scan =WO */
00297         DSP_INT  stop;              /* 1 Cancel Area Scan =WO */
00298         DSP_INT  rotxx, rotxy, rotyx, rotyy; /* 2,3,4,5 scan rotation matrix, Q15 =WR */
00299         DSP_INT  nx_pre;            /* 6 number of pre-scan dummy points =WR */
00300         DSP_INT  dnx_probe;         /* 7 number of positions inbetween probe points, -1==noprobe =WR */
00301         DSP_INT  raster_a, raster_b;/* 8,9 alternate probe raster scheme -1==noprobe =WR */
00302         DSP_INT  srcs_xp, srcs_xm;  /* 10,11 source channel configuration =WR */
00303         DSP_INT  srcs_2nd_xp, srcs_2nd_xm;  /* 12,13    source channel configuration =WR */
00304         DSP_INT  nx, ny;            /* 14,15  number of points to scan in x =WR */
00305         DSP_LONG fs_dx, fs_dy;      /* 16,18  32bit stepsize "scan", High Word -> DAC, Low Word -> "decimals" */
00306         DSP_LONG num_steps_move_xy; /* 20     number of move steps for vector (fm_dx,fm_dy) xy move */
00307         DSP_LONG fm_dx, fm_dy;      /* 22,24  32bit stepsize "move", High Word -> DAC, Low Word -> "decimals" */
00308         DSP_INT  dnx, dny;          /* 26,27  delta "nx": number of "DAC positions" inbetween "data points" =WR */
00309         DSP_INT  Zoff_2nd_xp, Zoff_2nd_xm; /* 28,29 Zoffset for 2nd scan in EFM/MFM/... quasi const height mode */
00310         DSP_LONG fm_dzx, fm_dzy;    /* 30,32 Z-slope in X and y =WR */
00311         DSP_LONG Xpos, Ypos, Zpos;  /* 34,36  current X/Yposition, 32bit =RO */
00312         DSP_LONG cfs_dx, cfs_dy;    /* copy of 32bit stepsize "scan", High Word -> DAC, Low Word -> "decimals" */
00313         DSP_INT  iix, iiy, ix, iy;  /* current inter x/y, and x/y counters =RO */
00314         DSP_INT  sstate;            /* current scan state =RO */
00315         DSP_INT  pflg;              /* process active flag =RO */
00316 } AREA_SCAN;
00317 
00318 
00319 /* Vector Probe Control structure and Probe actions definition vector, one Element of a Vector Program:
00320  *
00321  * The vector list is a Vector Program (VP), i.e. we have a Vector Program Counter (VPC) to control flow.
00322  *
00323  * The PROBE structure two below holds the VPC (probe.vector), i.e. the current Vector.
00324  * Program Entry is probe.vector_head, i.e first Vector instruction at probe start.
00325  * Loop branches (ptr_next) are relative to VPC, i.e. ptr_next = -1 to repeat last Vector.
00326  * Normal vector program flow is linear, ++VPC, as long as ptr_final != 0, ptr_final should be 1 for normal proceeding.
00327  */
00328 
00329 /* VP option masks */
00330 #define VP_FEEDBACK_HOLD 1
00331 #define VP_AIC_INTEGRATE 2
00332 
00333 #define SIZE_OF_PROBE_VECTOR 28
00334 typedef struct{
00335         DSP_LONG    n;             /* 0: number of steps to do =WR */
00336         DSP_LONG    dnx;           /* 2: distance of samples in steps =WR */
00337         DSP_LONG    srcs;          /* 4: SRCS source channel coding =WR */
00338         DSP_LONG    options;       /* 6: Options, Dig IO, ... not yet all defined =WR */
00339         DSP_UINT    ptr_fb;        /* 8: optional pointer to new feedback data struct first 3 values of SPM_PI_FEEDBACK =WR */
00340         DSP_UINT    repetitions;   /* 9: numer of repetitions =WR */
00341         DSP_UINT    i,j;           /*10,11: loop counter(s) =RO/Zero */
00342         DSP_INT     ptr_next;      /*12: next vector (relative to VPC) until --rep_index > 0 and ptr_next != 0 =WR */
00343         DSP_INT     ptr_final;     /*13: next vector (relative to VPC), =1 for next Vector in VP, if 0, probe is done =WR */
00344         DSP_LONG    f_du;          /*14: U (bias) stepwidth (32bit) =WR */
00345         DSP_LONG    f_dx;          /*16: X stepwidth (32bit) =WR */
00346         DSP_LONG    f_dy;          /*18: Y stepwidth (32bit) =WR */
00347         DSP_LONG    f_dz;          /*20: Z stepwidth (32bit) =WR */
00348         DSP_LONG    f_dx0;         /*22: X0 (offset) stepwidth (32bit) =WR */
00349         DSP_LONG    f_dy0;         /*24: Y0 (offset) stepwidth (32bit) =WR */
00350         DSP_LONG    f_dphi;        /*26: Phase stepwidth (32bit) +/-15.16Degree =WR */
00351 } PROBE_VECTOR;
00352 
00353 
00354 #define MAX_WRITE_PROBE 14
00355 typedef struct{
00356         DSP_INT     start;           /*0: Initiate Probe =WO */
00357         DSP_INT     stop;            /*1: Cancel Probe =WO */
00358         DSP_INT     AC_amp;          /*2: digi LockIn: Amplitude -- digi LockIn used if amp>0 =WR */
00359         DSP_INT     AC_frq;          /*3: digi LockIn: Frq. =WR */
00360         DSP_INT     AC_phaseA;       /*4: digi LockIn: Phase A =WR */
00361         DSP_INT     AC_phaseB;       /*5: digi LockIn: Phase B =WR */
00362         DSP_INT     AC_nAve;         /*6: digi LockIn: #Averages =WR */
00363         DSP_INT     AC_ix;           /*7: digi LockIn: index =RO/Zero */
00364         DSP_LONG    time;            /*8: probe time in loops =RO */
00365         DSP_LONG    Upos;            /*10: current "X" (probe) value =RO */
00366         DSP_LONG    Zpos;            /*12: current "X" (probe) value =WR */
00367         DSP_LONG    LockIn_0;        /*14: last LockIn 0 order result (avg. src) =RO */
00368         DSP_LONG    LockIn_1stA;     /*16: last LockIn 1st order result =RO */
00369         DSP_LONG    LockIn_1stB;     /*18: last LockIn 1st order result =RO */
00370         DSP_LONG    LockIn_2ndA;     /*20: last LockIn 2nd order result =RO */
00371         DSP_LONG    LockIn_2ndB;     /*22: last LockIn 2nd order result =RO */
00372         DSP_UINT    LockInRefSinTabA; /* Address of phase shifted sin reference table =RW */
00373         DSP_INT     LockInRefSinLenA; /* Length of RefTab =RO */
00374         DSP_UINT    LockInRefSinTabB; /* Address of phase shifted sin reference table =RW */
00375         DSP_INT     LockInRefSinLenB; /* Length of RefTab =RO */
00376         PROBE_VECTOR_P vector_head;  /* pointer to head of list of probe vectors =RO/SET */
00377         PROBE_VECTOR_P vector;       /* pointer to head of list of probe vectors =RO/SET */
00378         DSP_INT     ix, iix;         /* counters =RO */
00379         DSP_INT     state;           /* current probe state =RO */
00380         DSP_INT     pflg;            /* process active flag =RO */
00381 } PROBE;
00382 
00383 
00384 /* Auto Approach and Slider/Mover Parameters */
00385 
00386 #define AAP_MOVER_OFF           0 // all off
00387 #define AAP_MOVER_XP_AUTO_APP   1 // run in auto approach, uses "XP" for approach or other dirs if set (set mask like AAP_MOVER_XP_AUTO_APP |  AAP_MOVER_[[XY][PM]|WAVE])
00388 #define AAP_MOVER_XP            2 // manuell XP (+, positive dir, ramp on X offset) steps
00389 #define AAP_MOVER_XM            4 // manuell XM (-, negative dir, ramp on X offset) steps
00390 #define AAP_MOVER_YP            6 // manuell YP (+, positive dir, ramp on Y offset) steps
00391 #define AAP_MOVER_YM            8 // manuell YM (-, negative dir, ramp on Y offset) steps
00392 #define AAP_MOVER_DIRMMSK  0x000e // mask for direction and wave mode
00393 #define AAP_MOVER_WAVE     0x0010 // run waveform in buffer @ 0x5000 (sharing EXTERN_DATA_FIFO_ADDRESS)
00394 #define AAP_MOVER_PULSE    0x0020 // run CR puls -- future mode, !!!not yet implemented!!!
00395 #define AAP_MOVER_XYOFFSET 0x1000 // set this bit if XY offset outputs to be used
00396 #define AAP_MOVER_XYSCAN   0x2000 // set this bit if XY scan outputs to be used
00397 #define AAP_MOVER_XYMOTOR  0x4000 // set this bit if Motor output (X only) is to be used
00398 
00399 
00400 #define MAX_WRITE_AUTOAPPROACH 8
00401 typedef struct{
00402         DSP_INT     start;           /* Initiate =WO */
00403         DSP_INT     stop;            /* Cancel   =WO */
00404         DSP_INT     mover_mode;      /* Mover mode, one off AAP_MOVER_..., see above */
00405         DSP_INT     piezo_steps;     /* max number of repetitions */
00406         DSP_INT     n_wait;          /* delay inbetween cycels */
00407         DSP_INT     u_piezo_max;     /* Amplitude, Peak or length of waveform table */
00408         DSP_INT     u_piezo_amp;     /* Amplitude, Peak2Peak */
00409         DSP_INT     piezo_speed;     /* Speed */
00410         DSP_INT     mv_count;        /* "time axis" */
00411         DSP_INT     mv_dir;          /* "time direction" */
00412         DSP_INT     mv_step_count;   /* step counter */
00413         DSP_INT     u_piezo;         /* Current Piezo Voltage */
00414         DSP_INT     step_next;       /* used for motor (optional) */
00415         DSP_INT     tip_mode;        /* Tip mode, used by auto approach */
00416         DSP_INT     delay_cnt;       /* Delay count */
00417         DSP_INT     ci_mult;         /* retract speedup factor */
00418         DSP_INT     cp, ci;          /* temporary used */
00419         DSP_INT     pflg;            /* process active flag =RO */
00420 } AUTOAPPROACH;
00421 
00422 /* Digital Sampling Oszilloscope Control (DSP/Oszi) -- Analog Dbg./Test/Adjust tool */
00423 #define DSOSZI_DEFAULT      0
00424 #define DSOSZI_RUN          1
00425 #define DSOSZI_ONESHOT      2
00426 #define DSOSZI_STOP         3
00427 #define DSOSZI_AIC_RECONFIG 10
00428 
00429 #define DSOSZI_TRG_OFF      0
00430 #define DSOSZI_TRG_AUTO_P   1
00431 #define DSOSZI_TRG_AUTO_M   2
00432 #define DSOSZI_TRG_NORMAL_P 3
00433 #define DSOSZI_TRG_NORMAL_M 4
00434 #define DSOSZI_TRG_SINGLE_P 5
00435 #define DSOSZI_TRG_SINGLE_M 6
00436 
00437 #define MAX_WRITE_DSOSZI 10
00438 typedef struct{
00439         DSP_INT     start;           /* Initiate =WO */
00440         DSP_INT     stop;            /* Cancel   =WO */
00441         DSP_INT     control;         /* Control  =WO */
00442         DSP_INT     srcs;            /* Sources Config =WR */
00443         DSP_INT     trg_src;         /* Trigger Source =WR */
00444         DSP_INT     trg_mode;        /* Trigger Mode =WR */
00445         DSP_INT     trg_level;       /* Trigger Level =WR */
00446         DSP_INT     trg_delay;       /* Trigger Delay [+/-samples] =WR */
00447         DSP_INT     sps;             /* Samples per Second =WR */
00448         DSP_INT     n_subsamples;    /* # subsamples =WR */
00449         DSP_INT     iss;             /* subsample counter =RO */
00450         DSP_INT     pflg;            /* process active flag =RO */
00451 } DSOSZI;
00452 
00453 /* CR_out_puls */
00454 #define MAX_WRITE_CR_OUT_PULS 8
00455 typedef struct{
00456         DSP_INT     start;           /* Initiate =WO */
00457         DSP_INT     stop;            /* Cancel   =WO */
00458         DSP_INT     duration;        /* Puls duration count =WR */
00459         DSP_INT     period;          /* Puls period count =WR */
00460         DSP_INT     number;          /* number of pulses =WR */
00461         DSP_INT     on_bcode;        /* IO value at "on", while "duration" =WR */
00462         DSP_INT     off_bcode;       /* IO value at "off", while remaining time of period =WR */
00463         DSP_INT     reset_bcode;     /* IO value at end/cancel =WR */
00464         DSP_INT     io_address;      /* IO address to use =WR */
00465         DSP_INT     i_per;           /* on counter =RO */
00466         DSP_INT     i_rep;           /* repeat counter =RO */
00467         DSP_INT     pflg;            /* process active flag =RO */
00468 } CR_OUT_PULSE;
00469 
00470 /* CR_generic_io */
00471 #define MAX_WRITE_CR_GENERIC_IO 8
00472 typedef struct{
00473         DSP_INT     start;           /* Initiate =WO */
00474         DSP_INT     stop;            /* Cancel   =WO */
00475         DSP_INT     port;            /* IO port address to use (0..15 single port action, >15 special actions) =WR */
00476         DSP_INT     rw;              /* Data direction: Bit0 ==> 0: Read, 1: Write, Bit1 ==> Int3En =WO */
00477         DSP_UINT    data_lo;         /* Data (16 bit) =RW */
00478         DSP_UINT    data_hi;         /* Data (upper 16 bit for special long reads) =RW */
00479         DSP_INT     pflg;            /* process active flag =RO */
00480 } CR_GENERIC_IO;
00481 
00482 
00483 #if 0
00484 /* DUMMY Control -- Template Only */
00485 #define MAX_WRITE_DUMMYCTRL 3
00486 typedef struct{
00487         DSP_INT     start;           /* Initiate =WO */
00488         DSP_INT     stop;            /* Cancel   =WO */
00489         DSP_INT     dummyparameter;  /* ... =WR */
00490         DSP_INT     pflg;            /* process active flag =RO */
00491 } DUMMYCTRL;
00492 #endif
00493 
00494 /* Named AIC buffer struct */
00495 
00496 /* Analog Output Configuration */
00497 #define START_WRITE_ANALOG 8
00498 #define MAX_WRITE_ANALOG 8
00499 typedef struct{
00500 /* <---------------------- In <---*/
00501         DSP_INT in0;       /* <- AIC0 [+0] */
00502         DSP_INT in1;       /* <- AIC1 [+1] */
00503         DSP_INT in2;       /* <- AIC2 [+2] */
00504         DSP_INT in3;       /* <- AIC3 [+3] */
00505         DSP_INT in4;       /* <- AIC4 [+4] */
00506         DSP_INT feedback;  /* <- AIC5 [+5] */
00507         DSP_INT in6;       /* <- AIC6 [+6] */
00508         DSP_INT in7;       /* <- AIC7 [+7] */
00509 /* -----------------------> Out ->*/
00510         DSP_INT x_offset;  /* -> AIC0 [+8]*/  
00511         DSP_INT y_offset;  /* -> AIC1 [+9] */  
00512         DSP_INT z_offset;  /* -> AIC2 [+10] */  
00513         DSP_INT x_scan;    /* -> AIC3 [+11] */  
00514         DSP_INT y_scan;    /* -> AIC4 [+12] */  
00515         DSP_INT z_scan;    /* -> AIC5 [+13] */
00516         DSP_INT bias;      /* -> AIC6 [+14] */
00517         DSP_INT aux7;      /* -> AIC7 [+15] */
00518 /* ----------------------- AIC 0..7 input Offsets */
00519         DSP_INT offset[8];
00520 /* ----------------------- N times (length) averaged AIC data */
00521         DSP_LONG aic_slow[8];
00522         DSP_LONG aic_avg[8];
00523         DSP_INT  length[8];
00524         DSP_INT  aic0_pipe[32];
00525         DSP_INT  aic1_pipe[32];
00526         DSP_INT  aic2_pipe[32];
00527         DSP_INT  aic3_pipe[32];
00528         DSP_INT  aic4_pipe[32];
00529         DSP_INT  aic5_pipe[32];
00530         DSP_INT  aic6_pipe[128];
00531         DSP_INT  aic7_pipe[128];
00532 /* ----------------------- AIC 0..7 output Offsets */
00533         DSP_INT out_offset[8];
00534 } ANALOG_VALUES;
00535 
00536 /* DataFifo: data streaming control and buffer */
00537 #define DATAFIFO_LENGTH (1<<12)
00538 #define DATAFIFO_MASK   ((DATAFIFO_LENGTH)-1)
00539 #define MAX_WRITE_DATA_FIFO 1
00540 typedef struct{
00541         DSP_INT     r_position;   /* read pos (Gxsm) (WO) by host =WO */
00542         DSP_INT     w_position;   /* write pos (DSP) (RO) by host =RO */
00543         DSP_INT     fill;             /* filled indicator = max num to read =RO */
00544         DSP_INT     stall;            /* number of fifo stalls =RO */
00545         DSP_INT     length;           /* constant, buffer size =RO */
00546         DSP_INT     mode;         /* data mode (short/long) =RO */
00547         union {
00548                 DSP_INT     w[DATAFIFO_LENGTH]; /* fifo buffer (RO) by host =RO */
00549                 DSP_LONG    l[DATAFIFO_LENGTH>>1]; /* fifo buffer (RO) by host =RO */
00550         } buffer;
00551 } DATA_FIFO;
00552 
00553 #define EXTERN_PROBE_VECTOR_HEAD_DEFAULT 0x4100
00554 #define EXTERN_PROBE_VECTOR_HEAD_DEFAULT_P ((PROBE_VECTOR*) EXTERN_PROBE_VECTOR_HEAD_DEFAULT)
00555 #define EXTERN_PROBEDATAFIFO_LENGTH 0xb000
00556 #define EXTERN_PROBEDATA_MAX_LEFT   0x0040
00557 #define EXTERN_DATA_FIFO_ADDRESS    0x5000
00558 #define EXTERN_DATA_FIFO_ADDRESS_P ((void*) EXTERN_DATA_FIFO_ADDRESS)
00559 #define EXTERN_DATA_FIFO_LIMIT (EXTERN_DATA_FIFO_ADDRESS+EXTERN_PROBEDATAFIFO_LENGTH-EXTERN_PROBEDATA_MAX_LEFT)
00560 
00561 #define MAX_WRITE_DATA_FIFO_EXTERN 1
00562 typedef struct{
00563         DSP_UINT    r_position;   /* read pos (Gxsm) (always in word size) (WO) by host =WO */
00564         DSP_UINT    w_position;   /* write pos (DSP) (always in word size) (RO) by host =RO */
00565         DSP_UINT    current_section_head_position; /* resync/verify and status info =RO */
00566         DSP_UINT    current_section_index; /* index of current section =RO */
00567         DSP_UINT    fill;             /* filled indicator = max num to read =RO */
00568         DSP_UINT    stall;            /* number of fifo stalls =RO */
00569         DSP_UINT    length;           /* constant, buffer size =RO */
00570         DSP_INT_P   buffer_base; /* pointer to external memory, buffer start =RO */
00571         DSP_INT_P   buffer_w;    /* pointer to external memory =RO */
00572         DSP_LONG_P  buffer_l;
00573 } DATA_FIFO_EXTERN;
00574 
00575 #endif

Generated on Sat Apr 1 09:04:15 2006 for GXSM by  doxygen 1.4.6