libedt.h

Go to the documentation of this file.
00001 /* #pragma ident "@(#)libedt.h 1.302 04/03/08 EDT" */
00002 
00003 /* Copyright (c) 1995 by Engineering Design Team, Inc. */
00004 /* Copyright (c) 2011 by Engineering Design Team, Inc. */
00005 
00006 #ifndef INCLUDE_edtlib_h
00007 #define INCLUDE_edtlib_h
00008 
00261 #ifdef DOXYGEN_SHOW_UNDOC
00262 
00300 #endif
00301 
00302 
00303 #ifdef DOXYGEN_SHOW_UNDOC
00304 
00308 #endif
00309 #ifdef DOXYGEN_SHOW_UNDOC
00310  /* end dma_updown_internal group */
00311 #endif
00312 
00313 
00314 
00315 #ifdef DOXYGEN_SHOW_UNDOC
00316 
00320 #endif
00321 #ifdef DOXYGEN_SHOW_UNDOC
00322  /* end dma_fifo_internal group */
00323 #endif
00324 
00325 
00326 
00327 #ifdef DOXYGEN_SHOW_UNDOC
00328 
00332 #endif
00333 #ifdef DOXYGEN_SHOW_UNDOC
00334  /* end dma_inout_internal group */
00335 #endif
00336 
00337 
00338 
00339 #ifdef DOXYGEN_SHOW_UNDOC
00340 
00344 #endif
00345 #ifdef DOXYGEN_SHOW_UNDOC
00346  /* end dma_registers_internal group */
00347 #endif
00348 
00349 
00350 #ifdef DOXYGEN_SHOW_UNDOC
00351 
00355 #endif
00356 #ifdef DOXYGEN_SHOW_UNDOC
00357  /* end dma_utility_internal group */
00358 #endif
00359 
00360 
00361 
00362 #ifdef DOXYGEN_SHOW_UNDOC
00363 
00367 #endif
00368 #ifdef DOXYGEN_SHOW_UNDOC
00369  /* end dma_internal */
00370 #endif
00371 
00372 #define EDTAPI_VERSION EDTVERSION_HEX
00373 
00374 #define EDT_NORMAL_DMA 0
00375 #define EDT_DIRECT_DMA 1
00376 
00377 #define event_t HANDLE
00378 /*****************************************************
00379  * Kernel events                                     *
00380  *****************************************************/
00381 
00382 typedef char edt_version_string[128];
00383 
00384 /* undefined this to turn off event handling  */
00385 
00386 #define USE_EVENT_HANDLERS
00387 
00388 
00389 /* Event flags */
00390 /* These act as flag bits indicating our interest in these events */
00391 
00392 #define EDT_MAX_KERNEL_EVENTS        20
00393 #define EDT_BASE_EVENTS              1
00394 
00395 #define EDT_EODMA_EVENT              (EDT_BASE_EVENTS + 0)
00396 #define EDT_EODMA_EVENT_NAME         "edt_eodma"
00397 #define EV_EODMA                     EDT_EODMA_EVENT /* compat */
00398 
00399 #define EDT_EVENT_BUF                (EDT_BASE_EVENTS + 1)
00400 #define EDT_BUF_EVENT_NAME           "edt_buf"
00401 
00402 #define EDT_EVENT_STAT               (EDT_BASE_EVENTS + 2)
00403 #define EDT_STAT_EVENT_NAME          "edt_stat"
00404 
00405 #define EDT_EVENT_P16D_DINT          (EDT_BASE_EVENTS + 3)
00406 #define EDT_P16D_DINT_EVENT_NAME     "edt_p16dint"
00407 
00408 #define EDT_EVENT_P11W_ATTN          (EDT_BASE_EVENTS + 4)
00409 #define EDT_P11W_ATTN_EVENT_NAME     "edt_p11wattn"
00410 
00411 #define EDT_EVENT_P11W_CNT           (EDT_BASE_EVENTS + 5)
00412 #define EDT_P11W_CNT_EVENT_NAME      "edt_cnt"
00413 
00414 #define EDT_PDV_EVENT_ACQUIRE        (EDT_BASE_EVENTS + 6)
00415 #define EDT_EVENT_ACQUIRE            EDT_PDV_EVENT_ACQUIRE /* compat */
00416 #define EDT_PDV_ACQUIRE_EVENT_NAME   "edt_acquire"
00417 
00418 #define EDT_EVENT_PCD_STAT1          (EDT_BASE_EVENTS + 7)
00419 #define EDT_EVENT_PCD_STAT1_NAME     "edt_pcd_stat1"
00420 
00421 #define EDT_EVENT_PCD_STAT2          (EDT_BASE_EVENTS + 8)
00422 #define EDT_EVENT_PCD_STAT2_NAME     "edt_pcd_stat2"
00423 
00424 #define EDT_EVENT_PCD_STAT3          (EDT_BASE_EVENTS + 9)
00425 #define EDT_EVENT_PCD_STAT3_NAME     "edt_pcd_stat3"
00426 
00427 #define EDT_EVENT_PCD_STAT4          (EDT_BASE_EVENTS + 10)
00428 #define EDT_EVENT_PCD_STAT4_NAME     "edt_pcd_stat4"
00429 
00430 #define EDT_PDV_STROBE_EVENT         (EDT_BASE_EVENTS + 11)
00431 #define EDT_PDV_STROBE_EVENT_NAME    "edt_pdv_strobe"
00432  
00433 #define EDT_EVENT_P53B_SRQ           (EDT_BASE_EVENTS + 12)
00434 #define EDT_EVENT_P53B_SRQ_NAME      "edt_p53b_srq"
00435 
00436 #define EDT_EVENT_P53B_INTERVAL      (EDT_BASE_EVENTS + 13)
00437 #define EDT_EVENT_P53B_INTERVAL_NAME "edt_p53b_interval"
00438 
00439 #define EDT_EVENT_P53B_MODECODE      (EDT_BASE_EVENTS + 14)
00440 #define EDT_EVENT_P53B_MODECODE_NAME "edt_p53b_modecode"
00441 
00442 #define EDT_EVENT_P53B_DONE          (EDT_BASE_EVENTS + 15)
00443 #define EDT_EVENT_P53B_DONE_NAME     "edt_p53b_done"
00444 
00445 #define EDT_PDV_EVENT_FVAL           (EDT_BASE_EVENTS + 16)
00446 #define EDT_PDV_EVENT_FVAL_NAME      "edt_pdv_fval"
00447 
00448 #define EDT_PDV_EVENT_TRIGINT        (EDT_BASE_EVENTS + 17)
00449 #define EDT_PDV_EVENT_TRIGINT_NAME   "edt_pdv_trigint"
00450 
00451 #define EDT_EVENT_TEMP               (EDT_BASE_EVENTS + 18)
00452 #define EDT_EVENT_TEMP_NAME          "edt_temp_intr"
00453 
00454 #define EDT_MAX_EVENT_TYPES          (EDT_EVENT_TEMP + 1)
00455 
00456 /*
00457  * The EVENT_MODE controls the way the driver responds to events.
00458  * Mode 0 is similar to ACT_ONCE; mode 1 is similar to ACT_ALWAYS,
00459  * and mode 2 is similar to ACT_ALWAYS but disables the event
00460  * while user code is processing it to prevent OS lockups.
00461  */
00462 #define EDT_EVENT_MODE_MASK     0xFF000000
00463 #define EDT_EVENT_MODE_SHFT     24
00464 #define EDT_EVENT_MODE_ONCE     0
00465 #define EDT_EVENT_MODE_CONTINUOUS   1
00466 #define EDT_EVENT_MODE_SERIALIZE    2
00467 
00468 #if defined(WIN32) || defined(_NT_DRIVER_)
00469                 typedef unsigned __int64 uint64_t ;
00470                 typedef __int64 int64_t ;
00471                 typedef unsigned int  uint32_t ;
00472                 typedef int int32_t ;
00473 #endif
00474 
00475 /*
00476  * prom stuff, mostly for pciload
00477  */
00478 #define PCI_ID_SIZE      128
00479 #define OSN_SIZE         32
00480 #define ESN_SIZE         64
00481 #define PCIE_INFO_SIZE   1024
00482 #define PCIE_PID_SIZE    128
00483 #define MACADDR_SIZE     12
00484 #define MAX_MACADDRS     16
00485 #define MACLIST_SIZE     216 /* should be ((MACADDR_SIZE+1) * MAX_MACADDRS) + 4 for tag + 4 for the count + comma, even number */
00486 #define EXTRAADDR_SIZE   4
00487 #define EXTRATAG_SIZE   4
00488 #define OPTSN_SIZE       32
00489 #define PROM_EXTRA_SIZE  512
00490 #define E_SECTOR_SIZE    0x04000
00491 #define AMD_SECTOR_SIZE  0x10000
00492 #define AMD_SECTOR_SIZE2 0x20000
00493 #define SPI_SECTOR_SIZE  0x100000
00494 #define XLA_SECTOR_SIZE  AMD_SECTOR_SIZE   /* changed the name, backwards compat */
00495 #define MICRON_PROMINFO_ADDR 0x7f0000 
00496 #define EDTMACOUI        0x00251C
00497 
00498 /*
00499  * try to standardize on size of various strings
00500  */
00501 #define EDT_STRBUF_SIZE  128
00502 #define EDT_PATHBUF_SIZE  256
00503 #define EDT_BIGBUF_SIZE  512
00504 
00505 
00506 /*
00507  * legal device proms for pciload and other prom detect code
00508  */
00509 #define PROM_UNKN             0
00510 #define AMD_4013E             1
00511 #define AMD_4013XLA           2
00512 #define AMD_4028XLA           3
00513 #define AMD_XC2S150           4
00514 #define AMD_XC2S200_4M        5
00515 #define AMD_XC2S200_8M        6
00516 #define AMD_XC2S100_8M        7
00517 #define AMD_XC2S300E          8
00518 #define SPI_XC3S1200E         9
00519 #define AMD_XC5VLX30T        10 /* WAS SPI_XC5VLX30T */
00520 #define AMD_XC5VLX50T        11 /* WAS SPI_XC5VLX50T */
00521 #define AMD_EP2SGX30D        12
00522 #define AMD_XC5VLX70T        13
00523 #define AMD_XC5VLX30T_A      14
00524 #define AMD_XC6SLX45         15
00525 #define AMD_EP2SGX30D_A      16
00526 #define AMD_EP2AGX45D        17
00527 #if 0 /* beyond the above we don't need #defines, just the table entry in edt_flash.c */
00528 #define AMD_5SGXMA3K2F40C3   18
00529 #define AMD_5SGXMA5K2F40C3   19
00530 #define AMD_5SGXMA7K2F40C3   20
00531 #define AMD_5SGXMA8K2H40C3N  21
00532 #define AMD_5SGXMA7K1F40C2   22
00533 #define AMD_5SGXEA2K1F40C2ES 23
00534 #define AMD_5SGXMA9K2H40C2   24
00535 #endif
00536 #define MIC_N25Q064A13ESE40G 25
00537 /*
00538  * structure to set up phase locked loop parameters.
00539  * some of these values go into the AV9110-02 PLL chip
00540  * and others set up prescalars in the xilinx.
00541  */
00542 #ifdef USE_LONG_BUFCNT
00543 #if defined(_NT_) || defined(_NT_DRIVER_)
00544                 typedef unsigned long long bufcnt_t ;
00545 #else
00546                 typedef uint64_t bufcnt_t ;
00547 #endif
00548 #else
00549                 typedef u_int bufcnt_t ;
00550 #endif
00551 
00552                 typedef struct
00553 {
00554     int m; /* AV9110 refernce frequency divide range 3-127 */
00555     int n; /* AV9110 VCO feedback frequency divide range 3-127 */
00556     int v; /* AV9110 VCO feedback frequency prescalar range 1 or 8 */
00557     int r; /* AV9110 VCO output divider 1, 2, 4, 8 */
00558     int h; /* xilinx high speed divider (vco output) 1,3,5,7 */
00559     int l; /* xilinx divide by n 1-64 */
00560     int x; /* xilinx AV9110 prescale of 30MHz oscillator 1-256 */
00561 } edt_pll ;
00562 
00563 /* hard-coded database filenames for pciload and other load/id related files */
00564 #define EDTMACS_FNAME "edtmactable.txt"
00565 #define EDTPARTSFNAME "edt_parts.xpn"
00566 
00567 /*
00568  * Typedef for edt_bitpath to send and retrieve bitfile pathnames
00569  * from the driver.
00570  */
00571 typedef char edt_bitpath[128] ;
00572 
00573 /*
00574  * SBus Device struct
00575  */
00576 #define EDT_READ 0
00577 #define EDT_WRITE 1
00578 
00579 #ifndef TRUE
00580 
00581 #define TRUE 1
00582 #define FALSE 0
00583 
00584 #endif
00585 
00586 #define MAX_LOCK_SRC    60
00587 
00588 /* for edt_get_dma_info */
00589 typedef struct
00590 {
00591     uint_t  used_dma ;  /* dma started within current open/close */
00592     uint_t  alloc_dma ; /* has allocated > 1 ring buffer */
00593     uint_t  active_dma ;    /* dma is currently active */
00594     uint_t  interrupts;
00595     uint_t  locks;
00596     uint64_t  wait_time;
00597     uint64_t  lock_time;
00598     uint_t  lock_array[MAX_LOCK_SRC + 1];
00599     uint_t direct_reads[256];
00600     uint_t direct_writes[256];
00601     uint_t indirect_reads[256];
00602     uint_t indirect_writes[256];
00603     uint_t dma_reads[8];
00604     uint_t dma_writes[8];
00605     uint_t active_list_size;
00606     uint_t free_list_size;
00607 } edt_dma_info ;
00608 
00609 /* defines for edt_set_kernel_buffers */
00610 #define EDT_USER_BUFS 0
00611 #define EDT_COPY_KBUFS 1
00612 #define EDT_MMAP_KBUFS  2
00613 #define EDT_PERSISTENT_KBUFS  4
00614 
00615 #define MAX_EXTENDED_WORDS 32
00616 typedef struct _EdtMezzDescriptor {
00617     int  id;
00618     int  n_extended_words;
00619     int  extended_rev;
00620     uint_t extended_data[MAX_EXTENDED_WORDS];
00621 } EdtMezzDescriptor;
00622 
00623 /*
00624  * embedded info
00625  */
00626 typedef struct {
00627     int clock; /* 4 */
00628     char sn[11];
00629     char pn[11];
00630     char opt[15];
00631     int  rev; /* 4 */
00632     char ifx[11];
00633     char optsn[11];
00634     char maclist[MACLIST_SIZE];
00635 } Edt_embinfo;
00636 
00637 typedef struct {
00638     char  fpga[32];                 /* MUST match a pkg directory name */
00639     char  promdesc[32];             /* description may include size */
00640     u_short stat;                   /* status bits after shift */
00641     u_short statx;                  /* extended status bits for 16-bit devices */
00642     char  busdesc[8];               /* PCI, PCIe, ... */
00643     int   ftype;                    /* FTYPE_X, FTYPE_BT, FTYPE_LTX, FTYPE_SPI */
00644     int   magic;                    /* magic code (not the magic # itself but a code */
00645     u_int sectorsize;               /* sector size in bytes */
00646     u_int sectsperseg;              /* sectors per segment */
00647     u_int nsegments;                /* number of segments (banks) */
00648     int   defaultseg;               /* default unprotected segment */
00649     u_int (*id_addr)(void *, int);          /* id address function pointer */
00650     int   load_seg0;                /* 2d default unprotected segment (3v) */
00651     int   load_seg1;                /* 2d default unprotected segment (5v) */
00652 #if 0 /* cool idea -- lets try to get this done, but filling in all the fields */
00653     /* will take some time and need lots of care, so commented out for now */
00654     struct sector_struct sector[16];        /* all sectors */
00655 #endif
00656 } Edt_prominfo ;
00657 
00658 typedef struct {
00659     char type[4];
00660     u_int size;
00661 } EdtPromParmBlock;
00662 
00663 #define EdtPromParmData(p) \
00664     ((u_char *) p + sizeof(EdtPromParmBlock))
00665 
00666 typedef struct {
00667     char id[PCI_ID_SIZE];
00668     char esn[ESN_SIZE];
00669     char osn[OSN_SIZE];
00670 
00671     /* EXTRA area is variable size up to PROM_EXTRA_SIZE */
00672     /* size is int at beginning (top or bottom) of extra area */
00673     /* preceded by 4 char key "XTR:" */
00674 
00675     int  extra_size; /* total size of parm blocks */
00676     int  nblocks;    /* how many blocks */
00677 
00678     u_char extra_buf[PROM_EXTRA_SIZE];
00679 
00680     Edt_embinfo ei;
00681     char optsn[ESN_SIZE];
00682     char maclist[MACLIST_SIZE];
00683 } EdtPromData;
00684 
00685 typedef struct _prom_addr {
00686     u_int id_addr;
00687     u_int esn_addr;
00688     u_int osn_addr;
00689     u_int extra_data_addr;
00690     u_int extra_tag_addr;
00691     u_int extra_size_addr;
00692     u_int extra_size;
00693     u_int optsn_addr;
00694     u_int maclist_addr;
00695 } EdtPromIdAddresses;
00696 
00697 #ifndef _KERNEL
00698 /* Event callback stuff */
00699 
00700 
00701 typedef void (*EdtEventFunc)(void *);
00702 
00703 typedef struct edt_event_handler {
00704     struct edt_event_handler *next; /* in case we want linked lists */
00705     EdtEventFunc    callback;       /* function to call when event occurs */
00706     struct edt_device *owner;       /* reflexive pointer */
00707     uint_t          event_type;
00708     void *          data;           /* closure pointer for callback */
00709     u_char          active;         /* flag for a graceful death */
00710     u_char          continuous;     /* flag for continuing events */
00711 #ifdef _NT_
00712     thread_t        wait_thread;    /* thread handle */
00713     event_t         wait_event;     /* kernel event handle */
00714     event_t         closing_event;  /* abort event handle */
00715     uint_t          thrdid;         /* thread id # */
00716 #elif defined(__sun)
00717     thread_t        thrdid ;        /* thread handle and ID in Solaris */
00718     sema_t          sema_thread ;   /* thread sync semaphore */
00719 #elif defined(__linux__)
00720 
00721 
00722     thread_t thrdid;
00723 #elif defined(__APPLE__)
00724     pthread_t thrdid ;
00725 
00726 #endif /* _NT_ */
00727 
00728 } EdtEventHandler;
00729 
00730 
00731 /* An EdtBdFilterFunction ("Bd" = Board) function is used by
00732  * edt_detect_boards_filter() to determine if a board with the given
00733  * dev (e.g. "pcd"), unit number, and bd_id (eg.. PCD_ID) should be
00734  * included with the results of the board detection function.
00735  * This is used, for example, by hubload.c to do a detect of only "ltx"
00736  * boards which are those matching a small number of bd_ids.
00737  * The data parameter is passed to edt_detect_boards_filter, and
00738  * subsequently passed on to the filter function; it can be either NULL
00739  * or any data which the filter function wants to help it do its job.
00740  * Returns true for matches, false otherwise. */
00741 
00742 typedef int (*EdtBdFilterFunction) (char *dev, int unit, int bd_id, void *data);
00743 
00744 typedef struct {
00745     char type[8]; /* board family e.g., "pcd" */
00746     int id; /* board unit number */
00747     int bd_id; /* board id, e.g. PCD_ID */
00748     int promcode; /* e.g. AMD_XC5VLX30T */
00749 } Edt_bdinfo ;
00750 
00751 
00752 #define MAX_DMA_BUFFERS 2048
00753 
00754 typedef struct {
00755 
00756     int size;
00757 
00758     int allocated_size;
00759 
00760 
00761 #if defined(__sun)
00762 
00763     thread_t ring_tid;
00764 
00765 #endif
00766 
00767     char write_flag;
00768 
00769 
00770     char owned;
00771 
00772 } EdtRingBuffer;
00773 
00774 typedef struct _dma_data_block {
00775     u_int buffernum;
00776     u_char *pointer;
00777     u_int  offset;
00778     u_int  length;
00779 } EdtDMADataBlock;
00780 
00781 #define EDT_SS_TYPE 1
00782 #define EDT_GS_TYPE 2
00783 #define EDT_CD_TYPE 3
00784 #define EDT_LX_TYPE 4
00785 
00786 
00787 #define DDMA_FIFOSIZE 2048
00788 #define DDMA_BUFSIZE  4096
00789 
00790 #define edt_swab32(x) \
00791     (\
00792      ((u_int)( \
00793          (((u_int)(x) & (u_int)0x000000ffUL) << 24) | \
00794          (((u_int)(x) & (u_int)0x0000ff00UL) <<  8) | \
00795          (((u_int)(x) & (u_int)0x00ff0000UL) >>  8) | \
00796          (((u_int)(x) & (u_int)0xff000000UL) >> 24) )) \
00797     )
00798 
00799 
00800 typedef struct {
00801     int numbufs;
00802     int bufsize;
00803     int next_ringbuf;
00804     int initialized;
00805     uint64_t done_count;
00806     u_char **bufs;
00807     u_int *regmap;
00808     u_int sg_list[DDMA_FIFOSIZE*2];
00809 } edt_directDMA_t;
00810 
00811 
00812 
00813 typedef struct _optionstr_fields {
00814     int  board_type;
00815     int  DMA_channels;
00816     char mezzanine_type[68];
00817     char filename[68];
00818     int  version_number;
00819     int  rev_number;
00820     char date[12];
00821     int  custom_DMA_channels;
00822     int  available_DMA_channels;
00823 } EdtOptionStringFields;
00824 
00825 typedef struct _EdtBitfileDescriptor {
00826     edt_bitpath bitfile_name;
00827     edt_bitpath mezz_name0;
00828     edt_bitpath mezz_name1;
00829     char optionstr[68];
00830     char mezz_optionstr0[32];
00831     char mezz_optionstr1[32];
00832 
00833     EdtOptionStringFields ostr;
00834 
00835     int  revision_register;
00836     int  string_type;
00837 
00838 } EdtBitfileDescriptor;
00839 
00840 typedef struct edt_device {
00841 #ifdef __APPLE__
00842     u_int       fd;
00843 #else
00844     HANDLE      fd ;           /* file descriptor of opened device     */
00845 #endif
00846     u_int       unit_no ;
00847     u_int       spi_reg_base ; /* Base address for SPI_ access registers (0 specifies default of 0x60) */
00848     uint_t      devid ;
00849     uint_t      devtype ;      /* 0 == PCI; 1 == USB; ... */
00850     uint_t      todo;          /* n buffers started            */
00851     uint_t      b_count;       /* per open byte counter for edt_read/write */
00852 
00853     /* flags for each ring buffer */
00854     EdtRingBuffer   rb_control[MAX_DMA_BUFFERS];
00855 
00856     /* addresses kept in own array for backward compatibility */
00857 
00858     unsigned char * ring_buffers[MAX_DMA_BUFFERS];
00859 
00860     unsigned char * tmpbuf;          /* for interlace merging, etc. */
00861 
00862     uint_t      tmpbufsize;
00863 
00864     char        edt_devname[64] ;
00865     uint_t      cursample ;
00866     uint_t      minchunk ;
00867     bufcnt_t        donecount ;
00868     uint_t      nextwbuf ;     /* for edt_next_writebuf      */
00869 
00870     uint_t      ring_buffer_numbufs ;
00871     uint_t      ring_buffer_bufsize ;
00872     uint_t      ring_buffers_allocated ;
00873     uint_t      ring_buffers_configured ;
00874     uint_t      loops ;
00875     uint_t      ring_buffer_allocated_size ; /* if rounded up to page boundaries */
00876 
00877     uint_t      write_flag ;
00878 
00879     uint_t      port_no;
00880 
00881     uint_t      debug_level ;
00882     Dependent   *dd_p ;   /* device dependent struct        */
00883     void        *Pdma_p;  /* Pdma struct when Pdma used     */
00884 
00885     u_char *        data_end; /* end of base_buffer + 1 */
00886 
00887     /* For callback rountines */
00888 
00889     EdtEventHandler event_funcs[EDT_MAX_KERNEL_EVENTS];
00890     u_int       use_RT_for_event_func ;
00891 
00892 
00893     u_int channel_no;
00894 
00895     /* Use this for allocating all ring-buffers in a single chunk (w/possible headers before or
00896        after the ring-buffers). This is useful when trying to DMA into multiple ring-buffers which
00897        can be written/read as a block to a file*/
00898 
00899     unsigned char * base_buffer;
00900 
00901     u_int       header_size;
00902     int         header_offset;
00903 
00904     u_int       pending_samples; /* dma samples */
00905 
00906     int         hubidx;
00907     volatile caddr_t    mapaddr;
00908 
00909     void *      pInterleaver; /* for post-processing data, such as deinterleaving image */
00910 
00911     unsigned char *output_base;
00912     unsigned char **output_buffers; /* for results from post-processing */
00913 
00914     u_int is_serial_enabled;
00915 
00916     u_int buffer_granularity;
00917     u_int mmap_buffers;
00918     u_int totalsize;
00919     u_int       fullbufsize;
00920 
00921     /* low-latency dma routine fields
00922      * If we didn't need compatibility this could be a lot cleaner
00923      */
00924 
00925     EdtDMADataBlock *blocks;
00926 
00927     double      last_buffer_time;
00928     double      next_sample;
00929     u_int       period;
00930 
00931     u_char *    last_sample_end;
00932 
00933     u_char      wait_mode;
00934     u_char      freerun;
00935 
00936     u_char      DMA_channels;
00937 
00938     EdtBitfileDescriptor bfd;
00939     EdtMezzDescriptor mezz;
00940 
00941     char                last_direction;
00942     u_char      last_wait_ret;
00943     u_int               promcode;
00944 
00945     volatile u_int  *reg_fifo_io;
00946     volatile u_char *reg_fifo_cnt;
00947     volatile u_char *reg_fifo_ctl;
00948     volatile u_char *reg_intfc_off ;        /* mmap to intfc regs      */
00949     volatile u_char *reg_intfc_dat ;        /* mmap to intfc regs      */
00950 
00951     edt_directDMA_t *directDMA_p;         /* Direct DMA management   */
00952 
00953     u_int       adt7461_reg ; /* register definition */
00954 
00955 
00956 } EdtDev;
00957 
00958 
00959 
00960 /* Function declarations for EdtDev */
00961 
00962 
00963 /* Header file for functions exported by libedt */
00964 EDTAPI int initpcd_str(char *cfg_str, int unit, int verbose) ;
00965 EDTAPI u_int edt_mzdemod_read(EdtDev * edt_p, u_int block, u_int offset);
00966 EDTAPI void edt_mzdemod_write(EdtDev * edt_p, u_int block, u_int offset, u_int data);
00967 
00968 #define LCR_DDC_REG_SPACE (0x08 << 19)
00969 
00970 EDTAPI u_int edt_lcr_read(EdtDev *edt_p, unsigned int regBlock, unsigned int regOffset);
00971 EDTAPI void edt_lcr_write(EdtDev *edt_p, unsigned int regBlock, unsigned int regOffset, unsigned int regVal);
00972 
00973 EDTAPI int edt_init_direct_dma(EdtDev *edt_p);
00974 EDTAPI int edt_direct_read (EdtDev *edt_p, u_char *buf, int bytes);
00975 EDTAPI int edt_direct_write(EdtDev *edt_p, u_char *buf, int bytes);
00976 
00980 EDTAPI int     edt_flash_is_protected(EdtDev *edt_p);
00981 EDTAPI void    edt_get_sns(EdtDev *edt_p, char *esn, char *osn);
00982 EDTAPI void    edt_get_osn(EdtDev *edt_p, char *osn);
00983 EDTAPI void    edt_get_esn(EdtDev *edt_p, char *esn);
00984 EDTAPI void    edt_print_dev_flashstatus(EdtDev *edt_p, u_short stat, int sector);
00985 EDTAPI void    edt_print_flashstatus(u_short stat, int sector, int frdata);
00986 EDTAPI void    edt_init_promdata(EdtPromData *pdata);
00987 EDTAPI void    edt_init_parmblock(EdtPromParmBlock *block, char *type, int datasize);
00988 EDTAPI EdtPromParmBlock *edt_add_parmblock(EdtPromData *pdata, char *type, int datasize);
00989 EDTAPI EdtPromParmBlock *edt_get_parms_block(EdtPromData *pdata, char *id);
00990 
00991 EDTAPI u_int   edt_flash_get_promaddrs(EdtDev *edt_p, int promcode, int segment, EdtPromIdAddresses *paddr);
00992 EDTAPI int     edt_flash_get_fname(EdtDev *edt_p, char *name);
00993 EDTAPI int     edt_flash_get_fname_auto(EdtDev *edt_p, char *name);
00994 EDTAPI void    edt_flash_program_prominfo(EdtDev *edt_p, int promcode, int sector, EdtPromData *pdata);
00995 EDTAPI void    edt_flash_byte_program(EdtDev *edt_p, u_int addr, u_char data, int isbt);
00996 EDTAPI void    edt_flash_verify(EdtDev *edt_p, u_int addr, u_char *data, int nbytes, int ftype);
00997 EDTAPI void    edt_flash_reset(EdtDev * edt_p, int isbt);
00998 EDTAPI void    edt_flash_print16(EdtDev * edt_p, u_int addr, int ftype);
00999 EDTAPI int     edt_flash_prom_detect(EdtDev *edt_p, u_short *stat);
01000 EDTAPI int     edt_flash_prom_detect(EdtDev *edt_p, u_short *stat);
01001 
01002 EDTAPI Edt_prominfo *edt_get_prominfo(int promcode);
01003 EDTAPI const char *edt_get_fpga_mfg(EdtDev * edt_p);
01004 EDTAPI u_char  edt_flash_read8(EdtDev * edt_p, u_int addr, int ftype);
01005 EDTAPI u_short edt_flash_read16(EdtDev * edt_p, u_int addr, int ftype);
01006 EDTAPI char   *edt_flash_type_string(int ftype);
01007 
01008 EDTAPI void    edt_read_prom_data(EdtDev *edt_p, int promcode, int segment, EdtPromData *pdata);
01009 EDTAPI u_int   edt_get_id_addr(int promcode, int segment);
01010 EDTAPI u_int   edt_get_id_addrs(EdtDev *edt_p, int promcode, int segment, u_int *osn_addr, u_int *esn_addr);
01011 EDTAPI int     edt_program_flash(EdtDev *edt_p, const u_char *buf, int size, int do_sleep);
01012 
01013 EDTAPI int     edt_program_flash_start(EdtDev *edt_p);
01014 EDTAPI void    edt_program_flash_chunk(EdtDev *edt_p, const u_char *buf, int xfer, int do_sleep);
01015 EDTAPI int     edt_program_flash_end(EdtDev *edt_p);
01016 EDTAPI int     edt_get_flash_file_header(const char *fname, char *header, int *size);
01017 EDTAPI char   *edt_get_flash_prom_header(EdtDev *edt_p, char *name);
01018  /* end prominfo group */
01020 
01025 EDTAPI EdtDev *edt_open(const char *device_name, int unit) ;
01026 EDTAPI EdtDev *edt_open_quiet(const char *device_name, int unit) ;
01027 EDTAPI EdtDev *edt_open_channel(const char *device_name, int unit, int channel) ;
01028 EDTAPI EdtDev *edt_open_device(const char *device_name, int unit, int channel, int verbose) ;
01029 EDTAPI int     edt_close(EdtDev *edt_p) ;
01030 
01031 EDTAPI void    edt_set_port(EdtDev *edt_p, int port);
01032 EDTAPI int     edt_get_port(EdtDev *edt_p);
01033  /* end updown group */
01035 
01039 EDTAPI int     edt_read(EdtDev *edt_p, void *buf, uint_t size) ;
01040 EDTAPI int     edt_write(EdtDev *edt_p, void *buf, uint_t size) ;
01041 
01042 EDTAPI int     edt_configure_ring_buffers(EdtDev *edt_p, int bufsize,
01043                                             int numbufs, int write_flag,
01044                                             unsigned char **bufarray) ;
01045 
01046 EDTAPI int     edt_configure_block_buffers_mem(EdtDev *edt_p, int bufsize,
01047                                                 int numbufs, int write_flag,
01048                                                 int header_size, int header_before,
01049                                                 u_char *user_mem);
01050 EDTAPI int     edt_configure_block_buffers(EdtDev *edt_p, int bufsize,
01051                                         int numbufs, int write_flag,
01052                                         int header_size, int header_before);
01053 
01054 EDTAPI caddr_t edt_map_dmamem(EdtDev *edt_p);
01055 EDTAPI int     edt_disable_ring_buffers(EdtDev *edt_p) ;
01056 
01057 EDTAPI int     edt_disable_ring_buffers(EdtDev *edt_p) ;
01058  
01059 EDTAPI int     edt_get_numbufs(EdtDev *edt_p);
01060 
01061 EDTAPI int     edt_reset_ring_buffers(EdtDev *edt_p, uint_t bufnum);
01062 EDTAPI int     edt_abort_dma(EdtDev *edt_p);
01063 EDTAPI int     edt_abort_current_dma(EdtDev *edt_p);
01064 EDTAPI int     edt_stop_buffers(EdtDev *edt_p);
01065 EDTAPI int     edt_start_buffers(EdtDev *edt_p, uint_t count);
01066 
01067 // Internal EDT lab use only - set all ring buffer SgList entries to specified 32-bit physaddr
01068 EDTAPI int     edt_set_buffer_physaddr(EdtDev * edt_p, uint_t index, uint64_t physaddr);
01069 
01070 EDTAPI int     edt_set_buffer_size(EdtDev *edt_p,
01071                                 uint_t which_buf,
01072                                 uint_t size,
01073                                 uint_t write_flag);
01074 
01075 EDTAPI unsigned int  edt_allocated_size(EdtDev *edt_p, int bufnum);
01076 EDTAPI int           edt_get_total_bufsize(EdtDev *edt_p,
01077                                             int bufsize,
01078                                             int header_size);
01079 
01080 EDTAPI unsigned char *edt_wait_for_buffers(EdtDev *edt_p, int count) ;
01081 
01082 
01083 EDTAPI int             edt_ref_tmstamp(EdtDev *edt_p, u_int val) ;
01084 EDTAPI int             edt_get_timestamp(EdtDev *edt_p, u_int *timep, u_int bufnum) ;
01085 EDTAPI int             edt_get_reftime(EdtDev *edt_p, u_int *timep) ;
01086 EDTAPI unsigned char  *edt_wait_for_next_buffer(EdtDev *edt_p);
01087 EDTAPI unsigned char  *edt_last_buffer_timed(EdtDev *edt_p, u_int *timep) ;
01088 EDTAPI unsigned char  *edt_last_buffer(EdtDev *edt_p) ;
01089 EDTAPI unsigned char  *edt_wait_buffers_timed(EdtDev *edt_p, int count, u_int *timep);
01090 EDTAPI int             edt_set_buffer(EdtDev *edt_p, uint_t bufnum) ;
01091 EDTAPI unsigned char*  edt_next_writebuf(EdtDev    *edt_p) ;
01092 EDTAPI uint_t          edt_next_writebuf_index(EdtDev *edt_p);
01093 EDTAPI unsigned char** edt_buffer_addresses(EdtDev *edt_p) ;
01094 EDTAPI unsigned char  *edt_get_current_dma_buf(EdtDev * edt_p);
01095 
01096 EDTAPI bufcnt_t        edt_done_count(EdtDev   *edt_p) ;
01097 EDTAPI unsigned char  *edt_check_for_buffers(EdtDev *edt_p, uint_t count);
01098 
01099 EDTAPI uint_t          edt_get_bytecount(EdtDev *edt_p) ;
01100 EDTAPI uint_t          edt_get_timecount(EdtDev *edt_p) ;
01101 EDTAPI void            edt_set_direction(EdtDev *edt_p, int direction) ;
01102 EDTAPI uint_t edt_get_timeout_count(EdtDev *edt_p);
01103 EDTAPI unsigned short  edt_get_direction(EdtDev *edt_p) ;
01104 
01105 EDTAPI void            edt_startdma_reg(EdtDev *edt_p, uint_t  desc, uint_t val) ;
01106 EDTAPI void            edt_enddma_reg(EdtDev *edt_p, uint_t    desc, uint_t val) ;
01107 EDTAPI void            edt_startdma_action(EdtDev *edt_p, uint_t   val) ;
01108 EDTAPI void            edt_enddma_action(EdtDev *edt_p, uint_t val) ;
01109 
01110 EDTAPI void edt_read_start_action(EdtDev * edt_p, u_int enable, u_int reg_desc,
01111                                     u_char set, u_char clear, u_char setclear,
01112                                     u_char clearset, int delay1, int delay2);
01113 EDTAPI void edt_read_end_action(EdtDev * edt_p, u_int enable, u_int reg_desc,
01114                                     u_char set, u_char clear, u_char setclear,
01115                                     u_char clearset, int delay1, int delay2);
01116 EDTAPI void edt_write_start_action(EdtDev * edt_p, u_int enable, u_int reg_desc,
01117                                     u_char set, u_char clear, u_char setclear,
01118                                     u_char clearset, int delay1, int delay2);
01119 EDTAPI void edt_write_end_action(EdtDev * edt_p, u_int enable, u_int reg_desc,
01120                                     u_char set, u_char clear, u_char setclear,
01121                                     u_char clearset, int delay1, int delay2);
01122 
01123 EDTAPI int             edt_set_timeout_action(EdtDev *edt_p, u_int action);
01124 EDTAPI int             edt_get_timeout_goodbits(EdtDev *edt_p);
01125 EDTAPI int             edt_get_goodbits(EdtDev *edt_p);
01126 
01127 EDTAPI int             edt_set_event_func(EdtDev *edt_p, int event_type, EdtEventFunc f, void *data, int continuous) ;
01128 EDTAPI int             edt_remove_event_func(EdtDev *edt_p, int event_type) ;
01129 
01130 EDTAPI uint_t          edt_get_todo(EdtDev *edt_p) ;
01131 EDTAPI int             edt_ring_buffer_overrun(EdtDev *edt_p) ;
01132 
01133  /* end dma_inout */
01135 
01136 /* Internal or obsolete, etc. - we don't want to document these. */
01137 EDTAPI int             edt_configure_channel_ring_buffers(EdtDev *edt_p,
01138         int bufsize, int numbufs, int write_flag,
01139         unsigned char **bufarray) ;
01140 EDTAPI int             edt_disable_ring_buffer(EdtDev *edt_p,
01141         int nIndex);
01142 EDTAPI int             edt_cancel_current_dma(EdtDev *edt_p) ;
01143 EDTAPI int             edt_user_dma_wakeup(EdtDev *edt_p);
01144 EDTAPI int             edt_had_user_dma_wakeup(EdtDev *edt_p);
01145 
01149 EDTAPI uint_t        edt_reg_read(EdtDev *edt_p, uint_t desc) ;
01150 EDTAPI void          edt_reg_write(EdtDev *edt_p, uint_t desc, uint_t val) ;
01151 EDTAPI uint_t        edt_reg_or(EdtDev *edt_p, uint_t desc, uint_t val) ;
01152 EDTAPI uint_t        edt_reg_and(EdtDev *edt_p, uint_t desc, uint_t val) ;
01153 EDTAPI void          edt_reg_clearset(EdtDev *edt_p, uint_t desc, uint_t val) ;
01154 EDTAPI void          edt_reg_setclear(EdtDev *edt_p, uint_t desc, uint_t val) ;
01155 EDTAPI void          edt_intfc_write(EdtDev *edt_p, uint_t offset, uchar_t val) ;
01156 EDTAPI uchar_t       edt_intfc_read(EdtDev *edt_p, uint_t    offset) ;
01157 EDTAPI void          edt_intfc_write_short(EdtDev *edt_p, uint_t offset, u_short val) ;
01158 EDTAPI u_short       edt_intfc_read_short(EdtDev *edt_p, uint_t offset) ;
01159 EDTAPI void          edt_intfc_write_32(EdtDev   *edt_p, uint_t offset,  uint_t val) ;
01160 EDTAPI uint_t        edt_intfc_read_32(EdtDev *edt_p, uint_t offset) ;
01161 EDTAPI void          edt_bar1_write(EdtDev *edt_p, u_int offset, u_int val) ;
01162 EDTAPI u_int         edt_bar1_read(EdtDev  *edt_p, u_int offset) ;
01163 
01164 EDTAPI u_int         edt_ind_2_read(EdtDev  *edt_p, u_int offset, u_int *width) ;
01165 EDTAPI u_int         edt_ind_2_write(EdtDev  *edt_p, u_int offset, u_int value, u_int *width) ;
01166 
01167  /* end dma_control */
01172 EDTAPI void         edt_flush_fifo(EdtDev *edt_p) ;
01173 EDTAPI int          edt_set_firstflush(EdtDev *edt_p, int val)  ;
01174 EDTAPI int          edt_get_firstflush(EdtDev *edt_p) ;
01175 EDTAPI void         edt_flush_channel(EdtDev * edt_p, int channel) ;
01176 EDTAPI int          edt_enable_channels(EdtDev * edt_p, u_int mask) ;
01177 EDTAPI int          edt_enable_channel(EdtDev * edt_p, u_int channel) ;
01178 EDTAPI int          edt_disable_channels(EdtDev * edt_p, u_int mask) ;
01179 EDTAPI int          edt_disable_channel(EdtDev * edt_p, u_int channel) ;
01180  /* end dma_fifo */
01182 
01183 
01184 EDTAPI int          edt_get_wait_status(EdtDev *edt_p);
01185 EDTAPI int          edt_set_timeout_ok(EdtDev *edt_p, int val);
01186 EDTAPI int          edt_get_timeout_ok(EdtDev *edt_p);
01187 
01188 
01189 /* for a while it was called "eodma_sig" */
01190 EDTAPI void         pcd_set_funct(EdtDev *edt_p, uchar_t val)   ;
01191 EDTAPI int          edt_set_eodma_int(EdtDev *edt_p, int sig) ;
01192 EDTAPI int          edt_set_autodir(EdtDev  *edt_p, int val) ;
01193 
01194 
01195 EDTAPI int         edt_send_msg(EdtDev *edt_p, int unit, const char *msg, int size) ;
01196 EDTAPI int         edt_get_msg(EdtDev *edt_p, char *msgbuf, int maxsize) ;
01197 EDTAPI int         edt_get_msg_unit(EdtDev *edt_p, char *msgbuf, int maxsize, int unit) ;
01198 EDTAPI int         edt_serial_wait(EdtDev *edt_p, int size, int timeout) ;
01199 
01200 EDTAPI void        edt_send_dma(EdtDev *edt_p, int unit, uint_t    start_val) ;
01201 EDTAPI int         edt_wait_avail(EdtDev *edt_p) ;
01202 EDTAPI void        edt_init_mac8100(EdtDev *edt_p) ;
01203 EDTAPI u_short     edt_read_mac8100(EdtDev *edt_p, uint_t add) ;
01204 EDTAPI void        edt_write_mac8100(EdtDev *edt_p, uint_t add, u_short data) ;
01205 
01206 EDTAPI int         edt_get_dependent(EdtDev *edt_p, void *addr) ;
01207 EDTAPI int         edt_set_dependent(EdtDev *edt_p, void *addr) ;
01208 
01209 EDTAPI int         edt_flush_resp(EdtDev *edt_p) ;
01210 EDTAPI int         edt_get_tracebuf(EdtDev *edt_p, uint_t *addr)   ;
01211 EDTAPI int         edt_set_flush(EdtDev *edt_p, int val) ;
01215 EDTAPI int         edt_timeouts(EdtDev *edt_p) ; /* end dma_inout */
01217 
01218 
01219 EDTAPI void        edt_flush_mode(EdtDev *edt_p, uint_t    val) ;
01220 
01221 EDTAPI int         edt_set_rci_dma(EdtDev *edt_p, int unit, int channel) ;
01222 EDTAPI int         edt_get_rci_dma(EdtDev *edt_p, int unit) ;
01223 EDTAPI int         edt_set_rci_chan(EdtDev *edt_p, int unit, int channel) ;
01224 EDTAPI int         edt_get_rci_chan(EdtDev *edt_p, int unit) ;
01225 
01226 
01227 EDTAPI void        edt_reset_counts(EdtDev *edt_p) ;
01228 EDTAPI void        edt_reset_serial(EdtDev *edt_p) ;
01229 
01230 
01231 EDTAPI int         edt_set_debug(EdtDev *edt_p, int count) ;
01232 EDTAPI int         edt_get_debug(EdtDev *edt_p) ;
01233 
01234 
01239 EDTAPI int         edt_set_burst_enable(EdtDev *edt_p, int on) ;
01240 EDTAPI int         edt_get_burst_enable(EdtDev *edt_p) ;
01241 
01242 EDTAPI int         edt_set_rtimeout(EdtDev *edt_p, int value) ;
01243 EDTAPI int         edt_set_wtimeout(EdtDev *edt_p, int value) ;
01244 
01245 EDTAPI int         edt_get_rtimeout(EdtDev *edt_p) ;
01246 EDTAPI int         edt_get_wtimeout(EdtDev *edt_p) ;
01247  /* end dma_inout */
01249 
01250 EDTAPI void        edt_set_out_clk(EdtDev *edt_p, edt_pll *clk_data) ;
01251 EDTAPI u_char      edt_set_funct_bit(EdtDev    *edt_p, u_char mask) ;
01252 EDTAPI u_char      edt_clr_funct_bit(EdtDev    *edt_p, u_char mask) ;
01253 EDTAPI u_char      edt_set_pllct_bit(EdtDev * edt_p, u_char mask);
01254 EDTAPI u_char      edt_clr_pllct_bit(EdtDev * edt_p, u_char mask);
01255 EDTAPI int         edt_set_ignore_signals(EdtDev *edt_p, int ignore);
01256 
01260 EDTAPI int         edt_device_id(EdtDev *edt_p);
01261 EDTAPI char *      edt_idstr(int id) ;
01262 EDTAPI u_char      edt_flipbits(u_char val);
01263 EDTAPI char *      edt_idstring(int id, int promcode) ;
01264 EDTAPI int         edt_access(char *fname, int perm) ;
01265 EDTAPI int         edt_parse_unit(const char *str, char *dev, const char *default_dev) ;
01266 EDTAPI int         edt_parse_unit_channel(const char *str, char *dev,
01267                                             const char *default_dev,
01268                                             int *channel) ;
01269 EDTAPI int         edt_find_xpn(char *part_number, char *fpga);
01270 EDTAPI int         edt_get_xref_info(const char *path, const char *pn, char *fpga, char *sn, char *mtype, char *moffs, char *mcount, char *desc, char *rsvd1, char *rsvd2);
01271 EDTAPI uint_t      edt_overflow(EdtDev *edt_p) ;
01272 EDTAPI void        edt_perror(char *str) ;
01273 EDTAPI u_int       edt_errno(void) ;
01274 EDTAPI const char *edt_home_dir(EdtDev *edt_p) ;
01275 EDTAPI const char *edt_envvar_from_devtype(const int devtype) ;
01276 EDTAPI const char *edt_envvar_from_devstr(const char *devstr) ;
01277 
01278 EDTAPI char *      edt_timestring(u_int *timep) ;
01279 EDTAPI int         edt_system(const char *cmdstr) ;
01280 EDTAPI int         edt_fix_millennium(char *str, int rollover);
01281 
01282 #if 1
01283 EDTAPI char        *edt_fmt_pn(char *pn, char *pn_str);
01284 EDTAPI int         edt_parse_esn(char *str, Edt_embinfo *ei);
01285 EDTAPI int         edt_parse_devinfo(char *str, Edt_embinfo *ei);
01286 EDTAPI void        edt_get_sns_sector(EdtDev *edt_p, char *esn, char *osn, int sector);
01287 EDTAPI void        edt_get_osn(EdtDev *edt_p, char *osn);
01288 EDTAPI void        edt_get_esn(EdtDev *edt_p, char *esn);
01289 #endif
01290 
01291 
01292 
01293 /* Subroutines to set driver last bitfile loaded; used in bitload */
01294 EDTAPI int         edt_set_bitpath(EdtDev *edt_p, const char *bitpath) ;
01295 EDTAPI int         edt_get_bitpath(EdtDev *edt_p, char *bitpath, int size) ;
01296 EDTAPI int         edt_get_bitname(EdtDev *edt_p, char *bitpath, int size) ;
01297 EDTAPI int         edt_set_mezz_chan_bitpath(EdtDev *edt_p, const char *bitpath, int channel) ;
01298 EDTAPI int         edt_get_mezz_chan_bitpath(EdtDev *edt_p, char *bitpath, int size, int channel) ;
01299 EDTAPI int         edt_set_mezz_bitpath(EdtDev *edt_p, const char *bitpath) ;
01300 EDTAPI int         edt_get_mezz_bitpath(EdtDev *edt_p, char *bitpath, int size) ;
01301 
01302 EDTAPI char *      edt_get_last_bitpath(EdtDev *edt_p);
01303 
01304 EDTAPI u_int       edt_get_full_board_id(EdtDev *edt_p,
01305                                         int *extended_n,
01306                                         int *rev_id,
01307                                         u_int *extended_data);
01308 
01309 EDTAPI u_int       edt_get_board_id(EdtDev *edt_p);
01310 
01311 /* These two functions set/get mezz id info from driver, not board */
01312 
01313 EDTAPI u_int       edt_set_mezz_id(EdtDev *edt_p);
01314 EDTAPI u_int       edt_get_mezz_id(EdtDev *edt_p);
01315 
01316 
01317 EDTAPI int         edt_get_driver_version(EdtDev *edt_p,
01318         char *versionstr,
01319         int size);
01320 
01321 EDTAPI int         edt_get_driver_buildid(EdtDev *edt_p,
01322         char *build,
01323         int size);
01324 
01325 EDTAPI int         edt_get_library_version(EdtDev *edt_p,
01326         char *versionstr,
01327         int size);
01328 
01329 EDTAPI int         edt_get_library_buildid(EdtDev *edt_p,
01330         char *build,
01331         int size);
01332 
01333 EDTAPI u_int       edt_get_version_number();
01334 
01335 EDTAPI int         edt_check_version(EdtDev *edt_p);
01336 EDTAPI int         edt_get_kernel_event(EdtDev *edt_p, int event_num);
01337 EDTAPI u_int       edt_get_dma_info(EdtDev * edt_p, edt_dma_info *dmainfo);
01338  /* end dma_utility */
01340 
01341 EDTAPI int         edt_pci_reboot(EdtDev *edt_p);
01342 EDTAPI int         edt_set_merge(EdtDev * edt_p, u_int size, int span, u_int offset, u_int count) ;
01343 
01344 EDTAPI int         edt_set_sync_interval(EdtDev *edt_p, u_int interval);
01345 
01346 EDTAPI void        edt_set_buffer_granularity(EdtDev *edt_p,
01347                                               u_int granularity);
01348 
01349 EDTAPI void        edt_reset_fifo(EdtDev *) ;
01350 
01351 EDTAPI u_int       edt_set_sgbuf(EdtDev *edt_p, u_int sgbuf, u_int bufsize,
01352                                  u_int bufdir, u_int verbose) ;
01353 EDTAPI u_int       edt_set_sglist(EdtDev *edt_p, u_int bufnum,
01354                                    u_int *log_list, u_int log_entrys) ;
01355 
01356 EDTAPI int         edt_lockoff(EdtDev *edt_p) ;
01357 
01358 EDTAPI int         edt_enable_event(EdtDev *edt_p, int event_type) ;
01359 EDTAPI int         edt_reset_event_counter(EdtDev * edt_p, int event_type) ;
01360 EDTAPI int         edt_wait_event(EdtDev *edt_p, int event_type,
01361         int timeoutval) ;
01362 EDTAPI void        edt_dmasync_fordev(EdtDev *edt, int bufnum, int offset,
01363                                         int bytecount) ;
01364 EDTAPI void        edt_dmasync_forcpu(EdtDev *edt, int bufnum, int offset,
01365                                       int bytecount) ;
01366 EDTAPI u_int       edt_get_bufbytecount(EdtDev * edt_p, u_int *cur_buffer) ;
01367 EDTAPI int         edt_little_endian(void) ;
01368 /* deal with a hardware timeout */
01373 EDTAPI int         edt_do_timeout(EdtDev *edt_p); /* end dma_inout */
01375 EDTAPI int         edt_set_continuous(EdtDev *edt_p, int on) ;
01376 EDTAPI void        edt_resume(EdtDev *edt_p) ;
01377 EDTAPI void        edt_set_timetype(EdtDev *edt_p, u_int type) ;
01378 EDTAPI caddr_t     edt_mapmem(EdtDev *edt_p, u_int addr, int size) ;
01379 EDTAPI u_int       edt_get_mappable_size(EdtDev *edt_p, int bar); /* get the size of the base address range */
01380 EDTAPI u_int       edt_get_drivertype(EdtDev *edt_p) ;
01381 EDTAPI int         edt_set_drivertype(EdtDev *edt_p, u_int type) ;
01382 EDTAPI void        edt_set_abortintr(EdtDev *edt_p, u_int val) ;
01383 
01384 EDTAPI int         edt_write_pio(EdtDev *edt_p, u_char *buf, int size);
01385 
01386 EDTAPI int         edt_set_max_buffers(EdtDev *edt_p, int newmax);
01387 EDTAPI int         edt_get_max_buffers(EdtDev *edt_p);
01388 
01389 EDTAPI int         edt_set_kernel_buffers(EdtDev *edt_p, int onoff);
01390 EDTAPI int         edt_get_kernel_buffers(EdtDev *edt_p);
01391 EDTAPI int         edt_set_persistent_buffers(EdtDev *edt_p, int onoff);
01392 EDTAPI int         edt_get_persistent_buffers(EdtDev *edt_p);
01393 EDTAPI int         edt_set_mmap_buffers(EdtDev *edt_p, int onoff);
01394 EDTAPI int         edt_get_mmap_buffers(EdtDev *edt_p);
01395 
01396 EDTAPI int         edt_get_kernel_alloc(EdtDev *edt_p, int pool);
01397 
01398 EDTAPI void        edt_set_dump_reg_access(int on);
01399 EDTAPI int         edt_get_dump_reg_access();
01400 EDTAPI void        edt_set_dump_reg_address(u_int reglow, u_int n, u_int on);
01401 EDTAPI void        edt_set_dump_ir_access(u_int on);
01402 
01403 #ifdef __sun
01404 EDTAPI void        edt_set_RT(u_int pri) ;
01405 EDTAPI int         edt_use_umem_lock(EdtDev *edt_p, u_int use_lock) ;
01406 EDTAPI int         edt_get_umem_lock(EdtDev *edt_p) ;
01407 #endif
01408 
01409 
01410 #if 0
01411 EDTAPI int edt_get_x_file_header_magic(char *fname, char *header, int *size, int *magic);
01412 EDTAPI int edt_get_x_array_header_rstat(u_char *ba, char *header, int *size);
01413 EDTAPI u_char *edt_get_x_array_header(u_char *ba, char *header, int *size);
01414 EDTAPI u_char *edt_get_x_array_header_magic(u_char *ba, char *header, int *size, int *magic);
01415 EDTAPI int edt_get_x_header_magic(FILE *fp, char *header, int *size, int *magic);
01416 #endif
01417 
01418 EDTAPI void edt_readinfo(EdtDev *edt_p, int promcode, int sect, char *idstr, char *devinfo, char *oemsn);
01419 
01420 EDTAPI Edt_bdinfo *edt_detect_boards(char *dev, int unit, int *nunits, int verbose);
01421 EDTAPI Edt_bdinfo *edt_detect_boards_id(char *dev, int unit, u_int id, int *nunits, int verbose);
01422 EDTAPI Edt_bdinfo *edt_detect_boards_ids(char *dev, int unit, u_int *ids, int *nunits, int verbose);
01423 EDTAPI Edt_bdinfo *edt_detect_boards_filter(EdtBdFilterFunction filter, void *data, int *nunits, int verbose);
01424 
01425 EDTAPI int edt_sector_erase(EdtDev *edt_p, u_int sector, u_int sec_size, int type);
01426 
01427 /* routines to enable/disable register accesses tracing in the driver */
01428 
01429 EDTAPI void edt_set_trace_regs(EdtDev *edt_p, u_int reg_def, u_int state);
01430 
01431 EDTAPI void edt_trace_regs_enable(EdtDev *edt_p, u_int state);
01432 
01433 EDTAPI int edtdev_channels_from_type(EdtDev *edt_p);
01434 EDTAPI int edt_devtype_from_id(int id);
01435 EDTAPI int edt_check_1_vs_4(EdtDev *edt_p);
01436 
01437 EDTAPI void edt_set_intr_mask(EdtDev *edt_p, u_int state);
01438 EDTAPI u_int edt_get_intr_mask(EdtDev *edt_p);
01439 EDTAPI void edt_set_remote_intr(EdtDev *edt_p, u_int onoff);
01440 EDTAPI u_int edt_get_remote_intr(EdtDev *edt_p);
01441 
01442 EDTAPI int edt_mic_set_protected(EdtDev *edt_p);
01443 EDTAPI int edt_mic_unset_protected(EdtDev *edt_p);
01444 EDTAPI int edt_mic_is_protected(EdtDev *edt_p);
01445 
01446 /*
01447  * routines for pciload instead of globals
01448  */
01449 EDTAPI void            edt_flash_set_do_fast(int val) ;
01450 EDTAPI void            edt_flash_set_force_slow(int val) ;
01451 EDTAPI int             edt_flash_get_do_fast(void) ;
01452 EDTAPI int             edt_flash_get_force_slow(void) ;
01453 EDTAPI int             edt_flash_get_force(void) ;
01454 EDTAPI int             edt_flash_get_debug_fast(void);
01455 EDTAPI int             edt_flash_set_debug_fast(int val);
01456 
01457 /* EDT_IOCTL definitions */
01458 EDTAPI int             edt_ioctl(EdtDev *, int code,   void *arg);
01459 EDTAPI int             edt_ioctl_nt(EdtDev *edt_p, int controlCode,
01460                                     void *inBuffer, int inSize, void *outBuffer,
01461                                     int outSize, int *bytesReturned) ;
01462 
01463 EDTAPI uchar_t         pcd_get_funct(EdtDev *edt_p) ;
01464 EDTAPI void            pcd_set_byteswap(EdtDev *edt_p, int val) ;
01465 EDTAPI int             pcd_set_statsig(EdtDev  *edt_p, int sig) ;
01466 EDTAPI uchar_t         pcd_get_stat(EdtDev *edt_p) ;
01467 EDTAPI uchar_t         pcd_get_stat_polarity(EdtDev *edt_p) ;
01468 EDTAPI void            pcd_set_stat_polarity(EdtDev *edt_p, uchar_t val)   ;
01469 EDTAPI unsigned char   pcd_get_cmd(EdtDev *edt_p) ;
01470 EDTAPI void            pcd_set_cmd(EdtDev *edt_p, uchar_t val) ;
01471 EDTAPI void            pcd_flush_channel(EdtDev * edt_p, int channel) ;
01472 
01473 #ifdef PCD
01474 EDTAPI u_char          pcd_get_option(EdtDev *edt_p) ;
01475 EDTAPI void            sse_shift(EdtDev *edt_p, int shift) ;
01476 EDTAPI double          sse_set_out_clk(EdtDev * edt_p, double fmhz) ;
01477 EDTAPI void            pcd_pio_init(EdtDev *edt_p) ;
01478 EDTAPI void            pcd_pio_flush_fifo(EdtDev * edt_p) ;
01479 EDTAPI int             pcd_pio_read(EdtDev *edt_p, u_char *buf, int size) ;
01480 EDTAPI int             pcd_pio_write(EdtDev *edt_p, u_char *buf, int size) ;
01481 EDTAPI void            pcd_pio_set_direction(EdtDev *edt_p, int direction) ;
01482 EDTAPI void            pcd_pio_intfc_write(EdtDev *, u_int, u_char)  ;
01483 EDTAPI u_char          pcd_pio_intfc_read(EdtDev *, u_int) ;
01484 EDTAPI void            pcd_set_abortdma_onintr(EdtDev *edt_p, int flag) ;
01485 
01486 #endif /* PCD */
01487 
01488 #ifdef P16D
01489 EDTAPI void            p16d_set_command(EdtDev *edt_p, u_short val) ;
01490 EDTAPI void            p16d_set_config(EdtDev *edt_p, u_short val) ;
01491 EDTAPI u_short         p16d_get_stat(EdtDev *edt_p) ;
01492 EDTAPI u_short         p16d_get_command(EdtDev *edt_p) ;
01493 EDTAPI u_short         p16d_get_config(EdtDev *edt_p) ;
01494 #endif /* P16D */
01495 
01496 #ifdef P11W
01497 EDTAPI void            p11w_set_command(EdtDev *edt_p, u_short val) ;
01498 EDTAPI void            p11w_set_config(EdtDev *edt_p, u_short val) ;
01499 EDTAPI void            p11w_set_data(EdtDev *edt_p, u_short val) ;
01500 EDTAPI u_short         p11w_get_command(EdtDev *edt_p) ;
01501 EDTAPI u_short         p11w_get_config(EdtDev *edt_p) ;
01502 EDTAPI u_short         p11w_get_stat(EdtDev *edt_p) ;
01503 EDTAPI u_short         p11w_get_data(EdtDev *edt_p) ;
01504 EDTAPI u_int           p11w_get_count(EdtDev *edt_p) ;
01505 EDTAPI void            p11w_abortdma_onattn(EdtDev *edt_p, int flag) ;
01506 EDTAPI void            p11w_set_abortdma_onintr(EdtDev *edt_p, int flag) ;
01507 
01508 #endif /* P11W */
01509 
01510 #ifdef P53B
01511 EDTAPI EdtDev         *p53b_open(int unit, int bus_element_descriptor) ;
01512 EDTAPI EdtDev         *p53b_open_generic(int unit) ;
01513 EDTAPI EdtDev         *p53b_rtopen_notactive(int unit, int bus_element_descriptor) ;
01514 EDTAPI int             p53b_rtactive(EdtDev *p53b_p, int active) ;
01515 EDTAPI int             p53b_ioctl(EdtDev *p53b_p, int action, void *arg) ;
01516 EDTAPI int             p53b_write(EdtDev *p53b_p, void *buf, int size) ;
01517 EDTAPI int             p53b_read(EdtDev *p53b_p, void *buf, int size) ;
01518 EDTAPI int             p53b_bm_read(EdtDev *p53b_p, void *buf, int size) ;
01519 EDTAPI int             p53b_load(EdtDev *p53b_p, void *addr, int size, int offset) ;
01520 EDTAPI int             p53b_close(EdtDev *p53b_p) ;
01521 EDTAPI void            p53b_perror(char *str) ;
01522 EDTAPI void            p53b_msleep(int msecs) ;
01523 EDTAPI int             p53b_rt_blockwrite(EdtDev *p53b_p, int sa, int count, u_short *buf);
01524 EDTAPI int             p53b_rt_blockread(EdtDev *p53b_p, int sa, int count, u_short *buf);
01525 EDTAPI int             p53b_rt_prep_blockwrite(EdtDev *p53b_p, int sa) ;
01526 EDTAPI int             p53b_rt_prep_blockread(EdtDev *p53b_p, int sa) ;
01527 EDTAPI int             p53b_rt_flush_block_sa(EdtDev *p53b_p, u_int sa);
01528 EDTAPI int             p53b_rt_flush_block_rcv(EdtDev *p53b_p);
01529 
01530 EDTAPI int edt_get_type_from_id(int id);
01531 
01532 #endif /* P53B */
01533 
01534 #if defined(VXWORKS) || defined(TEST_VXWORKS)
01535 EDTAPI int         edt_vx_system_register_func(const char *funcstr, int (funcptr)(char *));
01536 #endif
01537 
01538 
01539 #endif  /* ndef _KERNEL */
01540 
01541 #define edt_set_eodma_sig(p, s) edt_set_eodma_int(p, s)
01542 
01543 #define EDTIO_V0 0
01544 #define EIO_ACTION_MASK 0x000003ff      /* action is low 10 bits */
01545 #define EIO_SIZE_MASK   0x00fffc00      /* mask off bits 10-23 */
01546 #define EIO_SET         0x02000000  /* set is bit 25 */
01547 #define EIO_GET     0x01000000  /* get is bit 24 */
01548 #define EIO_SET_MASK    EIO_SET     /* set mask is same as set */
01549 #define EIO_GET_MASK    EIO_GET     /* get mask is same as get */
01550 #define EIO_SIZE_SHIFT  10      /* size -- shift down 10 bits */
01551 #define EIO_TYPE_SHIFT  24      /* to get type, shift down 22 bits */
01552 #define EIO_DECODE_ACTION(code) (code & EIO_ACTION_MASK)
01553 #define EIODA(code) EIO_DECODE_ACTION(code) /* shorthand, looks better in case stmts */
01554 #define EIO_DECODE_SIZE(code)   ((code & EIO_SIZE_MASK) >> EIO_SIZE_SHIFT)
01555 #define EIO_DECODE_SET(code)    ((code & EIO_SET_MASK) != 0)
01556 #define EIO_DECODE_GET(code)    ((code & EIO_GET_MASK) != 0)
01557 
01558 
01559 #if defined(__sun) || defined (_NT_) || defined(VXWORKS) || defined(__APPLE__)
01560 
01561 #define EDT_NT_IOCTL        0xf000f000
01562 
01563 #endif
01564 
01565 #ifdef __linux__
01566 
01567 #define EDT_IOC_MAGIC  'k'
01568 
01569 #define EDT_NT_IOCTL    _IOWR(EDT_IOC_MAGIC, 1, edt_ioctl_struct)
01570 #define EDT_NT_IOCTL32  _IOWR(EDT_IOC_MAGIC, 1, edt_ioctl_struct32)
01571 
01572 #define EDT_IOC_MAXNR   2
01573 
01574 #endif /* __linux__ */
01575 
01576 /*
01577  * This structure must correspond to the next edt_ioctl_struct
01578  * in order for 32-bit programs to run under 64-bit Linux.
01579  * This workaround was done for ioctl backwards compatibility purposes.
01580  * Mark Mason - Aug 2007
01581  */
01582 
01583 typedef struct {
01584 #ifdef __APPLE__
01585     uint_t device ;
01586 #else
01587     HANDLE device ;
01588 #endif
01589     uint_t controlCode  ;
01590     uint_t inSize   ;
01591     uint_t outSize ;
01592     uint_t bytesReturned ;
01593     uint32_t inBuffer ;      /* userspace address */
01594     uint32_t outBuffer ;     /* userspace address */
01595 #if defined(__APPLE__)
01596     u_short unit ;
01597     u_short channel ;
01598 #endif
01599 } edt_ioctl_struct32 ;
01600 
01601 /*
01602  * This structure must correspond to the above edt_ioctl_struct32
01603  * in order for 32-bit programs to run under 64-bit Linux.
01604  * Mark Mason - Aug 2007
01605  */
01606 typedef struct {
01607 #ifdef __APPLE__
01608     uint32_t device ;
01609 #else
01610     HANDLE device ;
01611 #endif
01612     uint32_t controlCode  ;
01613     uint32_t inSize   ;
01614     uint32_t outSize ;
01615     uint32_t bytesReturned ;
01616 #if defined(__APPLE__)
01617     uint16_t unit ;
01618     uint16_t channel ;
01619 #endif
01620     void *inBuffer ;
01621     void *outBuffer ;
01622 } edt_ioctl_struct ;
01623 
01624 
01625 /* for passing 2 args */
01626 /* moved to long for 64-bit */
01627 typedef struct
01628 {
01629     /* must be multiple of 64 bits for amd64 */
01630     uint64_t    value;
01631     uint_t      desc;
01632     uint_t  flags ;
01633 } edt_buf;
01634 
01635 
01636 /* for serial read and write */
01637 #define EDT_SERBUF_SIZE 2048
01638 #define EDT_SERBUF_OVRHD 16  /* size of all but buf */
01639 /* flags for serial */
01640 #define EDT_SERIAL_WAITRESP 1
01641 #define EDT_SERIAL_SAVERESP 2
01642 typedef struct
01643 {
01644     uint_t      unit;
01645     uint_t      size;
01646     uint_t      misc;
01647     uint_t      flags;
01648     char        buf[EDT_SERBUF_SIZE];
01649 } ser_buf;
01650 
01651 /* for describing ring buffer */
01652 typedef struct
01653 {
01654     uint64_t    addr ;
01655     uint_t      index ;
01656     uint_t         size ;
01657     uint_t         writeflag ;
01658 } buf_args;
01659 
01660 /* for specifying merging data between multiple boards or channels */
01661 /* or for flipping or interleaving image */
01662 typedef struct
01663 {
01664     uint_t      line_size ;
01665     int         line_span ; /* can be negative */
01666     uint_t      line_offset ;
01667     uint_t      line_count ;
01668 } edt_merge_args;
01669 
01670 
01671 
01672 typedef struct {
01673     u_int addr ;
01674     u_int size ;
01675     u_int inc  ;
01676     u_int cnt  ;
01677     u_int mask ;
01678 } p53b_test ;
01679 
01680 #define SIZED_DATASIZE (EDT_DEPSIZE - sizeof(u_int))
01681 
01682 typedef struct {
01683     u_int size;
01684     u_int data[SIZED_DATASIZE/4];
01685 } edt_sized_buffer;
01686 
01687 #define EDT_DEVICE_TYPE     0x8000
01688 #ifdef METHOD_BUFFERED
01689 #define EDT_MAKE_IOCTL(t,c)\
01690     (uint_t)CTL_CODE((t),   0x800+(c),  METHOD_BUFFERED, FILE_ANY_ACCESS)
01691 #else
01692 #define EDT_MAKE_IOCTL(t,c)\
01693     (uint_t)(c)
01694 #endif
01695 
01696 #define EIOC(action, type, size) (((uint_t)type)    \
01697         | (((uint_t)size) << EIO_SIZE_SHIFT) \
01698         | ((uint_t)action))
01699 
01700 #define EDTS_DEBUG              EIOC(10, EIO_SET, sizeof(uint_t))
01701 #define EDTG_DEBUG              EIOC(11, EIO_GET, sizeof(uint_t))
01702 #define EDTS_INTFC              EIOC(12, EIO_SET, sizeof(edt_buf))
01703 #define EDTG_INTFC              EIOC(13, EIO_GET|EIO_SET, sizeof(edt_buf))
01704 #define EDTS_REG                EIOC(14, EIO_SET, sizeof(edt_buf))
01705 #define EDTG_REG                EIOC(15, EIO_GET|EIO_SET, sizeof(edt_buf))
01706 #define EDTS_FLASH              EIOC(16, EIO_SET, sizeof(edt_buf))
01707 #define EDTG_FLASH              EIOC(17, EIO_GET|EIO_SET, sizeof(edt_buf))
01708 #define EDTG_CHECKBF            EIOC(18, EIO_GET|EIO_SET, sizeof(buf_args))
01709 #define EDTS_PROG               EIOC(19, EIO_SET, sizeof(uint_t))
01710 #define EDTG_PROG               EIOC(20, EIO_GET, sizeof(uint_t))
01711 #define EDTS_PROG_READBACK      EIOC(21, EIO_SET, sizeof(uint_t))
01712 #define EDTG_PROG_READBACK      EIOC(22, EIO_GET, sizeof(uint_t))
01713 #define EDTS_MERGE_SG           EIOC(23, EIO_SET, sizeof(uint_t))
01714 #define EDTG_MERGE_SG           EIOC(24, EIO_GET, sizeof(uint_t))
01715 
01716 #define EDTS_DEBUG_MASK         EIOC(25, EIO_SET, sizeof(u_int))
01717 #define EDTG_DEBUG_MASK         EIOC(26, EIO_GET|EIO_SET, sizeof(u_int))
01718 #define EDTS_ALLOC_KBUFFER      EIOC(27, EIO_GET|EIO_SET, sizeof(buf_args))
01719 
01720 #define EDTS_SERIAL             EIOC(29, EIO_SET, sizeof(uint_t))
01721 #define EDTG_SERIAL             EIOC(30, EIO_GET, sizeof(uint_t))
01722 #define EDTS_DEPENDENT          EIOC(31, EIO_SET, EDT_DEPSIZE)
01723 #define EDTG_DEPENDENT          EIOC(32, EIO_GET, EDT_DEPSIZE)
01724 #define EDTG_DEVID              EIOC(33, EIO_GET, sizeof(uint_t))
01725 #define EDTS_RTIMEOUT           EIOC(34, EIO_SET, sizeof(uint_t))
01726 #define EDTS_WTIMEOUT           EIOC(35, EIO_SET, sizeof(uint_t))
01727 #define EDTG_BUFDONE            EIOC(36, EIO_GET, sizeof(bufcnt_t))
01728 #define EDTS_NUMBUFS            EIOC(37, EIO_SET, sizeof(int))
01729 #define EDTS_BUF                EIOC(38, EIO_SET, sizeof(buf_args))
01730 #define EDTS_STARTBUF           EIOC(39, EIO_SET, sizeof(uint_t))
01731 #define EDTS_WAITBUF            EIOC(40, EIO_SET|EIO_GET, sizeof(uint_t))
01732 #define EDTS_FREEBUF            EIOC(41, EIO_SET, sizeof(uint_t))
01733 #define EDTS_STOPBUF            EIOC(42, EIO_SET, sizeof(uint_t))
01734 #define EDTG_BYTECOUNT          EIOC(44, EIO_GET, sizeof(uint_t))
01735 #define EDTS_SETBUF             EIOC(45, EIO_SET, sizeof(int))
01736 #define EDTS_ABORT_DELAY        EIOC(46, EIO_SET, sizeof(int))
01737 #define EDTG_TIMEOUTS           EIOC(47, EIO_GET, sizeof(int))
01738 #define EDTG_TRACEBUF           EIOC(48, EIO_GET, (EDT_TRACESIZE  * sizeof(int)))
01739 #define EDTS_STARTDMA           EIOC(49, EIO_SET, sizeof(edt_buf))
01740 #define EDTS_ENDDMA             EIOC(50, EIO_SET, sizeof(edt_buf))
01741 #define EDTS_SERIAL_FIFO        EIOC(51, EIO_SET, sizeof(int))
01742 #define EDTG_SERIAL_FIFO        EIOC(52, EIO_GET, sizeof(int))
01743 #define EDTS_UNUSED0            EIOC(53, EIO_SET, sizeof(int))
01744 #define EDTG_UNUSED1            EIOC(54, EIO_GET, sizeof(int))
01745 #define EDTG_RTIMEOUT           EIOC(55, EIO_GET, sizeof(uint_t))
01746 #define EDTG_WTIMEOUT           EIOC(56, EIO_GET, sizeof(uint_t))
01747 #define EDTS_EODMA_SIG          EIOC(57, EIO_SET, sizeof(uint_t))
01748 #define EDTS_SERIALWAIT         EIOC(58, EIO_SET|EIO_GET, sizeof(edt_buf))
01749 #define EDTS_EVENT_SIG          EIOC(59, EIO_SET, sizeof(edt_buf))
01750 #define EDTG_OVERFLOW           EIOC(60, EIO_GET, sizeof(u_int))
01751 #define EDTS_AUTODIR            EIOC(61, EIO_SET, sizeof(u_int))
01752 #define EDTS_FIRSTFLUSH         EIOC(62, EIO_SET, sizeof(u_int))
01753 #define EDTG_CONFIG_COPY        EIOC(63, EIO_GET|EIO_SET, sizeof(edt_buf))
01754 #define EDTG_CONFIG             EIOC(64, EIO_GET|EIO_SET, sizeof(edt_buf))
01755 #define EDTS_CONFIG             EIOC(65, EIO_SET, sizeof(edt_buf))
01756 #define P53B_REGTEST            EIOC(66, EIO_SET, sizeof(p53b_test))
01757 #define EDTG_LONG               EIOC(67, EIO_GET|EIO_SET, sizeof(edt_buf))
01758 #define EDTS_LONG               EIOC(68, EIO_SET, sizeof(edt_buf))
01759 #define EDTG_SGTODO             EIOC(69, EIO_GET, (EDT_TRACESIZE *  4))
01760 #define EDTG_SGLIST             EIOC(70, EIO_SET|EIO_GET, sizeof(buf_args))
01761 #define EDTS_SGLIST             EIOC(71, EIO_SET, sizeof(buf_args))
01762 #define EDTG_SGINFO             EIOC(72, EIO_SET|EIO_GET, sizeof(edt_buf))
01763 #define EDTG_TIMECOUNT          EIOC(73, EIO_GET, sizeof(uint_t))
01764 #define EDTG_PADDR              EIOC(74, EIO_GET, sizeof(uint_t))
01765 #define EDTS_SYNC               EIOC(75, EIO_SET, sizeof(uint_t))
01766 #define EDTS_WAITN              EIOC(76, EIO_SET, sizeof(uint_t))
01767 #define EDTS_STARTACT           EIOC(77, EIO_SET, sizeof(uint_t))
01768 #define EDTS_ENDACT             EIOC(78, EIO_SET, sizeof(uint_t))
01769 #define EDTS_RESETCOUNT         EIOC(79, EIO_SET, sizeof(uint_t))
01770 #define EDTS_RESETSERIAL        EIOC(80, EIO_SET, sizeof(uint_t))
01771 #define EDTS_CLR_EVENT          EIOC(81, EIO_SET, sizeof(uint_t))
01772 #define EDTS_ADD_EVENT_FUNC     EIOC(82, EIO_SET, sizeof(uint_t))
01773 #define EDTS_DEL_EVENT_FUNC     EIOC(83, EIO_SET, sizeof(uint_t))
01774 #define EDTS_WAIT_EVENT_ONCE    EIOC(84, EIO_SET, sizeof(uint_t))
01775 #define EDTS_WAIT_EVENT         EIOC(85, EIO_SET, sizeof(uint_t))
01776 #define EDTS_CLEAR_WAIT_EVENT   EIOC(86, EIO_SET, sizeof(uint_t))
01777 #define EDTG_TMSTAMP            EIOC(87, EIO_SET|EIO_GET, sizeof(uint_t) * 3)
01778 #define EDTS_TIMEOUT_ACTION     EIOC(88, EIO_SET, sizeof(uint_t))
01779 #define EDTG_TIMEOUT_GOODBITS   EIOC(89, EIO_GET, sizeof(uint_t))
01780 #define EDTS_BAUDBITS           EIOC(90, EIO_SET, sizeof(uint_t))
01781 #define EDTG_REFTIME            EIOC(91, EIO_GET, sizeof(uint_t) * 2)
01782 #define EDTS_REFTIME            EIOC(92, EIO_SET, sizeof(uint_t) * 2)
01783 #define EDTS_REG_OR             EIOC(93, EIO_SET|EIO_GET, sizeof(edt_buf))
01784 #define EDTS_REG_AND            EIOC(94, EIO_SET|EIO_GET, sizeof(edt_buf))
01785 #define EDTG_GOODBITS           EIOC(95, EIO_GET, sizeof(uint_t))
01786 #define EDTS_BURST_EN           EIOC(96, EIO_SET, sizeof(uint_t))
01787 #define EDTG_BURST_EN           EIOC(97, EIO_GET, sizeof(uint_t))
01788 #define EDTG_FIRSTFLUSH         EIOC(98, EIO_GET, sizeof(u_int))
01789 #define EDTS_ABORT_BP           EIOC(99, EIO_SET, sizeof(uint_t))
01790 #define EDTS_DMASYNC_FORDEV     EIOC(100, EIO_SET, sizeof(uint_t) * 3)
01791 #define EDTS_DMASYNC_FORCPU     EIOC(101, EIO_SET, sizeof(uint_t) * 3)
01792 #define EDTG_BUFBYTECOUNT       EIOC(102, EIO_GET, sizeof(uint_t) * 2)
01793 #define EDTS_DOTIMEOUT          EIOC(103, EIO_SET, sizeof(uint_t))
01794 #define EDTS_REFTMSTAMP         EIOC(104, EIO_SET, sizeof(uint_t))
01795 #define EDTS_PDVCONT            EIOC(105, EIO_SET, sizeof(uint_t))
01796 #define EDTS_PDVDPATH           EIOC(106, EIO_SET, sizeof(uint_t))
01797 #define EDTS_RESET_EVENT_COUNTER EIOC(107, EIO_SET, sizeof(uint_t))
01798 #define EDTS_DUMP_SGLIST        EIOC(108, EIO_SET, sizeof(uint_t))
01799 #define EDTG_TODO               EIOC(109, EIO_GET, sizeof(u_int))
01800 #define EDTS_RESUME             EIOC(110, EIO_SET, sizeof(u_int))
01801 #define EDTS_TIMETYPE           EIOC(111, EIO_SET, sizeof(u_int))
01802 #define EDTS_EVENT_HNDL         EIOC(112, EIO_SET, sizeof(edt_buf))
01803 #define EDTS_MAX_BUFFERS        EIOC(113, EIO_SET, sizeof(u_int))
01804 #define EDTG_MAX_BUFFERS        EIOC(114, EIO_GET, sizeof(u_int))
01805 #define EDTS_WRITE_PIO          EIOC(115, EIO_SET, sizeof(edt_sized_buffer))
01806 #define EDTS_PROG_XILINX        EIOC(116, EIO_SET, sizeof(edt_sized_buffer))
01807 #define EDTS_MAPMEM             EIOC(117, EIO_GET | EIO_SET, sizeof(edt_buf))
01808 #define EDTS_ETEC_ERASEBUF_INIT EIOC(118, EIO_SET, sizeof(uint_t) * 2)
01809 #define EDTS_ETEC_ERASEBUF      EIOC(119, EIO_SET, sizeof(u_int))
01810 #define EDTG_DRIVER_TYPE        EIOC(120, EIO_GET, sizeof(u_int))
01811 #define EDTS_DRIVER_TYPE        EIOC(121, EIO_SET, sizeof(u_int))
01812 #define EDTS_DRV_BUFFER         EIOC(122, EIO_SET | EIO_GET, sizeof(u_int))
01813 #define EDTS_ABORTINTR          EIOC(123, EIO_SET, sizeof(u_int))
01814 #define EDTS_CUSTOMER           EIOC(124, EIO_SET, sizeof(u_int))
01815 #define EDTS_ETEC_SET_IDLE      EIOC(125, EIO_SET, sizeof(u_int) * 3)
01816 #define EDTS_SOLARIS_DMA_MODE   EIOC(126, EIO_SET, sizeof(u_int))
01817 #define EDTS_UMEM_LOCK          EIOC(127, EIO_SET, sizeof(u_int))
01818 #define EDTG_UMEM_LOCK          EIOC(128, EIO_GET, sizeof(u_int))
01819 #define EDTS_RCI_CHAN           EIOC(129, EIO_SET, sizeof(edt_buf))
01820 #define EDTG_RCI_CHAN           EIOC(130, EIO_SET|EIO_GET, sizeof(edt_buf))
01821 #define EDTS_BITPATH            EIOC(140, EIO_SET, sizeof(edt_bitpath))
01822 #define EDTG_BITPATH            EIOC(141, EIO_GET, sizeof(edt_bitpath))
01823 #define EDTG_VERSION            EIOC(142, EIO_GET, sizeof(edt_version_string))
01824 #define EDTG_BUILDID            EIOC(143, EIO_GET, sizeof(edt_version_string))
01825 #define EDTS_WAITCHAR           EIOC(144, EIO_SET, sizeof(edt_buf))
01826 #define EDTS_PDMA_MODE          EIOC(145, EIO_SET, sizeof(u_int))
01827 #define EDTG_MEMSIZE            EIOC(146, EIO_GET, sizeof(u_int))
01828 #define EDTS_DIRECTION          EIOC(147, EIO_SET, sizeof(u_int))
01829 #define EDTG_CLRCIFLAGS         EIOC(148, EIO_GET, sizeof(u_int))
01830 #define EDTS_CLRCIFLAGS         EIOC(149, EIO_SET, sizeof(u_int))
01831 #define EDTS_MERGEPARMS         EIOC(150, EIO_SET, sizeof(edt_merge_args))
01832 #define EDTS_ABORTDMA_ONINTR    EIOC(151, EIO_SET, sizeof(u_int))
01833 #define EDTS_FVAL_DONE          EIOC(152, EIO_SET, sizeof(u_char))
01834 #define EDTG_FVAL_DONE          EIOC(153, EIO_GET, sizeof(u_char))
01835 #define EDTG_LINES_XFERRED      EIOC(154, EIO_SET|EIO_GET, sizeof(u_int))
01836 #define EDTS_PROCESS_ISR        EIOC(155, EIO_SET|EIO_GET, sizeof(u_int))
01837 #define EDTS_CLEAR_DMAID        EIOC(156, EIO_SET, sizeof(u_int))
01838 #define EDTS_DRV_BUFFER_LEAD    EIOC(157, EIO_SET | EIO_GET, sizeof(u_int))
01839 #define EDTG_SERIAL_WRITE_AVAIL EIOC(158, EIO_GET, sizeof(u_int))
01840 #define EDTS_USER_DMA_WAKEUP    EIOC(159, EIO_SET, sizeof(u_int))
01841 #define EDTG_USER_DMA_WAKEUP    EIOC(160, EIO_GET, sizeof(u_int))
01842 #define EDTG_WAIT_STATUS        EIOC(161, EIO_GET, sizeof(u_int))
01843 #define EDTS_WAIT_STATUS        EIOC(162, EIO_GET, sizeof(u_int))
01844 #define EDTS_TIMEOUT_OK         EIOC(163, EIO_SET, sizeof(u_int))
01845 #define EDTG_TIMEOUT_OK         EIOC(164, EIO_GET, sizeof(u_int))
01846 #define EDTS_MULTI_DONE         EIOC(165, EIO_GET, sizeof(u_int))
01847 #define EDTG_MULTI_DONE         EIOC(166, EIO_GET, sizeof(u_int))
01848 #define EDTS_TEST_LOCK_ON       EIOC(167, EIO_SET, sizeof(u_int))
01849 #define EDTG_FVAL_LOW           EIOC(168, EIO_SET|EIO_GET, sizeof(u_int))
01850 #define EDTS_BUF_MMAP           EIOC(169, EIO_SET|EIO_GET, sizeof(buf_args))
01851 #define EDTS_MEZZ_BITPATH       EIOC(170, EIO_SET, sizeof(edt_bitpath))
01852 #define EDTG_MEZZ_BITPATH       EIOC(171, EIO_GET, sizeof(edt_bitpath))
01853 #define EDTG_DMA_INFO           EIOC(172, EIO_GET, sizeof(edt_dma_info))
01854 #define EDTS_USER_FUNC          EIOC(173, EIO_SET | EIO_GET, sizeof(edt_sized_buffer))
01855 #define EDTS_TEST_STATUS        EIOC(174, EIO_SET | EIO_GET, sizeof(u_int))
01856 #define EDTS_KERNEL_ALLOC       EIOC(175, EIO_SET | EIO_GET, sizeof(u_int))
01857 #define EDTG_RESERVED_PAGES     EIOC(176, EIO_GET, sizeof(u_int))
01858 #define EDTS_RAW_SGLIST         EIOC(177, EIO_SET, sizeof(buf_args))
01859 #define EDTS_IGNORE_SIGNALS     EIOC(178, EIO_SET, sizeof(u_int))
01860 #define EDTS_TRACE_REG          EIOC(179, EIO_SET, sizeof(u_int))
01861 #define EDTS_TIMESTAMP_LEVEL    EIOC(180, EIO_SET, sizeof(u_int))
01862 #define EDTS_REG_BIT_CLEARSET   EIOC(181, EIO_SET, sizeof(edt_buf))
01863 #define EDTS_REG_BIT_SETCLEAR   EIOC(182, EIO_SET, sizeof(edt_buf))
01864 #define EDTS_REG_READBACK       EIOC(183, EIO_SET, sizeof(u_int))
01865 #define EDTS_MEZZ_ID            EIOC(184, EIO_SET, sizeof(edt_buf))
01866 #define EDTG_MEZZ_ID            EIOC(185, EIO_SET|EIO_GET, sizeof(edt_buf))
01867 #define EDTG_NUMBUFS            EIOC(186, EIO_GET, sizeof(int))
01868 #define EDTS_READ_STARTACT      EIOC(187, EIO_SET, sizeof(edt_buf))
01869 #define EDTS_READ_ENDACT        EIOC(188, EIO_SET, sizeof(edt_buf))
01870 #define EDTS_WRITE_STARTACT     EIOC(189, EIO_SET, sizeof(edt_buf))
01871 #define EDTS_WRITE_ENDACT       EIOC(190, EIO_SET, sizeof(edt_buf))
01872 #define EDTS_READ_START_DELAYS  EIOC(191, EIO_SET, sizeof(u_int))
01873 #define EDTS_READ_END_DELAYS    EIOC(192, EIO_SET, sizeof(u_int))
01874 #define EDTS_WRITE_START_DELAYS EIOC(193, EIO_SET, sizeof(u_int))
01875 #define EDTS_WRITE_END_DELAYS   EIOC(194, EIO_SET, sizeof(u_int))
01876 #define EDTS_INDIRECT_REG_BASE  EIOC(195, EIO_SET, sizeof(u_int))
01877 #define EDTG_INDIRECT_REG_BASE  EIOC(196, EIO_GET, sizeof(u_int))
01878 #define EDTS_BITLOAD            EIOC(197, EIO_SET|EIO_GET, sizeof(buf_args))
01879 #define EDTS_MEZZLOAD           EIOC(198, EIO_SET|EIO_GET, sizeof(buf_args))
01880 #define EDTS_PCILOAD            EIOC(199, EIO_SET, sizeof(buf_args))
01881 #define EDTS_SYNC_INTERVAL      EIOC(200, EIO_SET, sizeof(u_int))
01882 #define EDTG_SYNC_INTERVAL      EIOC(201, EIO_GET, sizeof(u_int))
01883 
01884 #define EDTG_TRACE_SIZE         EIOC(202, EIO_GET, sizeof(u_int))
01885 #define EDTS_TRACE_SIZE         EIOC(203, EIO_SET, sizeof(u_int))
01886 #define EDTG_TRACE_ENTRIES      EIOC(204, EIO_GET, sizeof(u_int))
01887 #define EDTG_TRACEBUF2          EIOC(205, EIO_GET, sizeof(buf_args))
01888 #define EDTS_TRACE_CLEAR        EIOC(206, EIO_SET, sizeof(u_int))
01889 #define EDTG_DEBUG_INFO         EIOC(207, EIO_SET|EIO_GET, sizeof(buf_args))
01890 #define EDTG_MEM2SIZE           EIOC(208, EIO_GET, sizeof(u_int))
01891 #define EDTS_INTR_MASK          EIOC(210, EIO_SET, sizeof(u_int))
01892 #define EDTG_INTR_MASK          EIOC(211, EIO_GET, sizeof(u_int))
01893 #define EDTS_IND_2_REG          EIOC(212, EIO_SET | EIO_GET, sizeof(edt_buf))
01894 #define EDTG_IND_2_REG          EIOC(213, EIO_GET|EIO_SET, sizeof(edt_buf))
01895 #define EDTS_DMA_MODE           EIOC(214, EIO_SET, sizeof(u_int))
01896 #define EDTG_DMA_MODE           EIOC(215, EIO_GET, sizeof(u_int))
01897 #define EDTG_BUFSIZE            EIOC(216, EIO_GET|EIO_SET, sizeof(u_int))
01898 #define EDTS_DIRECT_DMA_DONE    EIOC(217, EIO_SET, sizeof(uint64_t))
01899 #define EDTG_DIRECT_DMA_DONE    EIOC(218, EIO_GET, sizeof(uint64_t))
01900 #define EDTS_WAIT_DIRECT_DMA_DONE EIOC(219, EIO_SET, sizeof(uint64_t))
01901 #define EDTS_INCTIMEOUT         EIOC(220, EIO_SET, sizeof(uint_t))
01902 #define EDTG_MAXCHAN            EIOC(221, EIO_GET, sizeof(int))
01903 
01904 /* using unused codes */
01905 
01906 /* defines for return from wait */
01907 #define EDT_WAIT_OK 0
01908 #define EDT_WAIT_TIMEOUT 1
01909 #define EDT_WAIT_OK_TIMEOUT 2
01910 #define EDT_WAIT_USER_WAKEUP 3
01911 
01912 /* defines for driver type */
01913 #define EDT_UNIX_DRIVER 0
01914 #define EDT_NT_DRIVER   1
01915 #define EDT_2K_DRIVER   2
01916 #define EDT_WDM_DRIVER  3
01917 
01918 /* defines for time type */
01919 #define EDT_TM_SEC_NSEC  0
01920 #define EDT_TM_CLICKS    1
01921 #define EDT_TM_COUNTER   2
01922 #define EDT_TM_FREQ  3
01923 #define EDT_TM_INTR  4
01924 
01925 
01926 /* defines for get DMA status */
01927 #define EDT_DMA_IDLE 0
01928 #define EDT_DMA_ACTIVE 1
01929 #define EDT_DMA_TIMEOUT 2
01930 #define EDT_DMA_ABORTED 3
01931 
01932 /* defines for SG ioctls */
01933 #define EDT_SGLIST_SIZE     1
01934 #define EDT_SGLIST_VIRTUAL  2
01935 #define EDT_SGLIST_PHYSICAL 3
01936 #define EDT_SGTODO_SIZE     4
01937 #define EDT_SGTODO_VIRTUAL  5
01938 #define EDT_SGTODO_FIRST_SG 6
01939 #define EDT_SG_LOADSIZE     7
01940 #define EDT_SG_ALLOCSIZE    8
01941 #define EDT_SG_TOTALUSED    9
01942 
01943 /* defines for flush, start, end dma action */
01944 #define EDT_ACT_NEVER       0
01945 #define EDT_ACT_ONCE        1
01946 #define EDT_ACT_ALWAYS      2
01947 #define EDT_ACT_ONELEFT     3
01948 #define EDT_ACT_CYCLE       4
01949 #define EDT_ACT_KBS     5
01950 #define EDT_ACT_ALWAYS_WRITEONLY        6
01951 
01952 /* ddefines for timeout action */
01953 #define EDT_TIMEOUT_NULL        0
01954 #define EDT_TIMEOUT_BIT_STROBE  0x1
01955 
01956 
01957 /* for kernel defines, use this shorthand */
01958 #define EMAPI(x) EDT_MAKE_IOCTL(EDT_DEVICE_TYPE,EIODA(x))
01959 
01960 #define ES_DEBUG             EMAPI(EDTS_DEBUG)
01961 #define EG_DEBUG             EMAPI(EDTG_DEBUG)
01962 #define ES_INTFC             EMAPI(EDTS_INTFC)
01963 #define EG_INTFC             EMAPI(EDTG_INTFC)
01964 #define ES_REG               EMAPI(EDTS_REG)
01965 #define EG_REG               EMAPI(EDTG_REG)
01966 #define ES_FLASH             EMAPI(EDTS_FLASH)
01967 #define EG_FLASH             EMAPI(EDTG_FLASH)
01968 #define EG_CHECKBF           EMAPI(EDTG_CHECKBF)
01969 #define ES_PROG              EMAPI(EDTS_PROG)
01970 #define EG_PROG              EMAPI(EDTG_PROG)
01971 #define ES_PROG_READBACK     EMAPI(EDTS_PROG_READBACK)
01972 #define EG_PROG_READBACK     EMAPI(EDTG_PROG_READBACK)
01973 #define ES_MERGE_SG          EMAPI(EDTS_MERGE_SG)
01974 #define EG_MERGE_SG            EMAPI(EDTG_MERGE_SG)
01975 #define EG_DEBUG_SIZE            EMAPI(EDTG_DEBUG_SIZE)
01976 #define EG_DEBUG_INFO             EMAPI(EG_DEBUG_INFO)
01977 #define ES_TYPE              EMAPI(EDTS_TYPE)
01978 #define EG_TYPE              EMAPI(EDTG_TYPE)
01979 #define ES_SERIAL            EMAPI(EDTS_SERIAL)
01980 #define EG_SERIAL            EMAPI(EDTG_SERIAL)
01981 #define ES_DEPENDENT         EMAPI(EDTS_DEPENDENT)
01982 #define EG_DEPENDENT         EMAPI(EDTG_DEPENDENT)
01983 #define EG_DEVID             EMAPI(EDTG_DEVID)
01984 #define ES_RTIMEOUT          EMAPI(EDTS_RTIMEOUT)
01985 #define ES_WTIMEOUT          EMAPI(EDTS_WTIMEOUT)
01986 #define EG_BUFDONE           EMAPI(EDTG_BUFDONE)
01987 #define ES_NUMBUFS           EMAPI(EDTS_NUMBUFS)
01988 #define ES_BUF               EMAPI(EDTS_BUF)
01989 #define ES_BUF_MMAP               EMAPI(EDTS_BUF_MMAP)
01990 #define ES_STARTBUF          EMAPI(EDTS_STARTBUF)
01991 #define ES_WAITBUF           EMAPI(EDTS_WAITBUF)
01992 #define ES_FREEBUF           EMAPI(EDTS_FREEBUF)
01993 #define ES_STOPBUF           EMAPI(EDTS_STOPBUF)
01994 #define EG_BYTECOUNT         EMAPI(EDTG_BYTECOUNT)
01995 #define ES_SETBUF            EMAPI(EDTS_SETBUF)
01996 #define ES_ABORT_DELAY          EMAPI(EDTS_ABORT_DELAY)
01997 #define EG_TIMEOUTS          EMAPI(EDTG_TIMEOUTS)
01998 #define EG_TRACEBUF          EMAPI(EDTG_TRACEBUF)
01999 #define ES_STARTDMA          EMAPI(EDTS_STARTDMA)
02000 #define ES_ENDDMA            EMAPI(EDTS_ENDDMA)
02001 #define ES_SERIAL_FIFO           EMAPI(EDTS_SERIAL_FIFO)
02002 #define EG_SERIAL_FIFO           EMAPI(EDTG_SERIAL_FIFO)
02003 #define ES_UNUSED0          EMAPI(EDTS_UNUSED0)
02004 #define EG_UNUSED1          EMAPI(EDTG_UNUSED1)
02005 #define EG_RTIMEOUT          EMAPI(EDTG_RTIMEOUT)
02006 #define EG_WTIMEOUT          EMAPI(EDTG_WTIMEOUT)
02007 #define ES_EODMA_SIG         EMAPI(EDTS_EODMA_SIG)
02008 #define ES_SERIALWAIT        EMAPI(EDTS_SERIALWAIT)
02009 #define ES_EVENT_SIG         EMAPI(EDTS_EVENT_SIG)
02010 #define EG_OVERFLOW          EMAPI(EDTG_OVERFLOW)
02011 #define ES_AUTODIR           EMAPI(EDTS_AUTODIR)
02012 #define ES_FIRSTFLUSH        EMAPI(EDTS_FIRSTFLUSH)
02013 #define EG_FIRSTFLUSH        EMAPI(EDTG_FIRSTFLUSH)
02014 #define EG_CONFIG_COPY       EMAPI(EDTG_CONFIG_COPY)
02015 #define ES_CONFIG            EMAPI(EDTS_CONFIG)
02016 #define EG_CONFIG            EMAPI(EDTG_CONFIG)
02017 #define P_REGTEST            EMAPI(P53B_REGTEST)
02018 #define ES_LONG              EMAPI(EDTS_LONG)
02019 #define EG_LONG              EMAPI(EDTG_LONG)
02020 #define EG_SGTODO            EMAPI(EDTG_SGTODO)
02021 #define EG_SGLIST            EMAPI(EDTG_SGLIST)
02022 #define ES_SGLIST            EMAPI(EDTS_SGLIST)
02023 #define EG_SGINFO            EMAPI(EDTG_SGINFO)
02024 #define EG_TIMECOUNT         EMAPI(EDTG_TIMECOUNT)
02025 #define EG_PADDR             EMAPI(EDTG_PADDR)
02026 #define ES_SYNC              EMAPI(EDTS_SYNC)
02027 #define ES_WAITN             EMAPI(EDTS_WAITN)
02028 #define ES_STARTACT          EMAPI(EDTS_STARTACT)
02029 #define ES_ENDACT            EMAPI(EDTS_ENDACT)
02030 #define ES_RESETCOUNT        EMAPI(EDTS_RESETCOUNT)
02031 #define ES_RESETSERIAL       EMAPI(EDTS_RESETSERIAL)
02032 #define ES_BAUDBITS          EMAPI(EDTS_BAUDBITS)
02033 #define ES_CLR_EVENT         EMAPI(EDTS_CLR_EVENT)
02034 #define ES_ADD_EVENT_FUNC    EMAPI(EDTS_ADD_EVENT_FUNC)
02035 #define ES_DEL_EVENT_FUNC    EMAPI(EDTS_DEL_EVENT_FUNC)
02036 #define ES_WAIT_EVENT_ONCE   EMAPI(EDTS_WAIT_EVENT_ONCE)
02037 #define ES_WAIT_EVENT        EMAPI(EDTS_WAIT_EVENT)
02038 #define EG_TMSTAMP           EMAPI(EDTG_TMSTAMP)
02039 #define ES_CLEAR_WAIT_EVENT  EMAPI(EDTS_CLEAR_WAIT_EVENT)
02040 #define ES_TIMEOUT_ACTION    EMAPI(EDTS_TIMEOUT_ACTION)
02041 #define EG_TIMEOUT_GOODBITS  EMAPI(EDTG_TIMEOUT_GOODBITS)
02042 #define EG_REFTIME           EMAPI(EDTG_REFTIME)
02043 #define ES_REFTIME           EMAPI(EDTS_REFTIME)
02044 #define ES_REG_OR            EMAPI(EDTS_REG_OR)
02045 #define ES_REG_AND           EMAPI(EDTS_REG_AND)
02046 #define EG_GOODBITS          EMAPI(EDTG_GOODBITS)
02047 #define ES_BURST_EN          EMAPI(EDTS_BURST_EN)
02048 #define EG_BURST_EN          EMAPI(EDTG_BURST_EN)
02049 #define ES_ABORT_BP          EMAPI(EDTS_ABORT_BP)
02050 #define ES_DOTIMEOUT         EMAPI(EDTS_DOTIMEOUT)
02051 #define ES_INCTIMEOUT         EMAPI(EDTS_INCTIMEOUT)
02052 #define ES_REFTMSTAMP           EMAPI(EDTS_REFTMSTAMP)
02053 #define ES_DMASYNC_FORDEV     EMAPI(EDTS_DMASYNC_FORDEV)
02054 #define ES_DMASYNC_FORCPU     EMAPI(EDTS_DMASYNC_FORCPU)
02055 #define EG_BUFBYTECOUNT       EMAPI(EDTG_BUFBYTECOUNT)
02056 #define ES_PDVCONT            EMAPI(EDTS_PDVCONT)
02057 #define ES_PDVDPATH           EMAPI(EDTS_PDVDPATH)
02058 #define ES_RESET_EVENT_COUNTER        EMAPI(EDTS_RESET_EVENT_COUNTER)
02059 #define ES_DUMP_SGLIST        EMAPI(EDTS_DUMP_SGLIST)
02060 #define EG_TODO         EMAPI(EDTG_TODO)
02061 #define ES_RESUME           EMAPI(EDTS_RESUME)
02062 #define ES_TIMETYPE            EMAPI(EDTS_TIMETYPE)
02063 #define ES_EVENT_HNDL          EMAPI(EDTS_EVENT_HNDL)
02064 #define ES_MAX_BUFFERS             EMAPI(EDTS_MAX_BUFFERS)
02065 #define EG_MAX_BUFFERS             EMAPI(EDTG_MAX_BUFFERS)
02066 #define ES_WRITE_PIO           EMAPI(EDTS_WRITE_PIO)
02067 #define ES_PROG_XILINX             EMAPI(EDTS_PROG_XILINX)
02068 #define ES_MAPMEM          EMAPI(EDTS_MAPMEM)
02069 #define ES_ETEC_ERASEBUF_INIT    EMAPI(EDTS_ETEC_ERASEBUF_INIT)
02070 #define ES_ETEC_ERASEBUF         EMAPI(EDTS_ETEC_ERASEBUF)
02071 #define EG_DRIVER_TYPE         EMAPI(EDTG_DRIVER_TYPE)
02072 #define ES_DRIVER_TYPE         EMAPI(EDTS_DRIVER_TYPE)
02073 #define ES_DRV_BUFFER          EMAPI(EDTS_DRV_BUFFER)
02074 #define ES_ABORTINTR           EMAPI(EDTS_ABORTINTR)
02075 #define ES_CUSTOMER            EMAPI(EDTS_CUSTOMER)
02076 #define ES_ETEC_SET_IDLE       EMAPI(EDTS_ETEC_SET_IDLE)
02077 #define ES_SOLARIS_DMA_MODE    EMAPI(EDTS_SOLARIS_DMA_MODE)
02078 #define ES_UMEM_LOCK           EMAPI(EDTS_UMEM_LOCK)
02079 #define EG_UMEM_LOCK           EMAPI(EDTG_UMEM_LOCK)
02080 #define ES_RCI_CHAN        EMAPI(EDTS_RCI_CHAN)
02081 #define EG_RCI_CHAN        EMAPI(EDTG_RCI_CHAN)
02082 #define ES_BITPATH         EMAPI(EDTS_BITPATH)
02083 #define EG_BITPATH         EMAPI(EDTG_BITPATH)
02084 #define EG_VERSION         EMAPI(EDTG_VERSION)
02085 #define EG_BUILDID         EMAPI(EDTG_BUILDID)
02086 #define ES_WAITCHAR         EMAPI(EDTS_WAITCHAR)
02087 #define ES_PDMA_MODE           EMAPI(EDTS_PDMA_MODE)
02088 #define ES_DIRECTION           EMAPI(EDTS_DIRECTION)
02089 #define EG_MEMSIZE          EMAPI(EDTG_MEMSIZE)
02090 #define EG_MEM2SIZE          EMAPI(EDTG_MEM2SIZE)
02091 #define ES_CLRCIFLAGS         EMAPI(EDTS_CLRCIFLAGS)
02092 #define EG_CLRCIFLAGS         EMAPI(EDTG_CLRCIFLAGS)
02093 #define ES_MERGEPARMS        EMAPI(EDTS_MERGEPARMS)
02094 #define ES_ABORTDMA_ONINTR        EMAPI(EDTS_ABORTDMA_ONINTR)
02095 #define ES_FVAL_DONE         EMAPI(EDTS_FVAL_DONE)
02096 #define EG_FVAL_DONE         EMAPI(EDTG_FVAL_DONE)
02097 #define EG_LINES_XFERRED         EMAPI(EDTG_LINES_XFERRED)
02098 #define ES_PROCESS_ISR         EMAPI(EDTS_PROCESS_ISR)
02099 #define ES_CLEAR_DMAID         EMAPI(EDTS_CLEAR_DMAID)
02100 #define ES_DRV_BUFFER_LEAD        EMAPI(EDTS_DRV_BUFFER_LEAD)
02101 #define EG_SERIAL_WRITE_AVAIL        EMAPI(EDTG_SERIAL_WRITE_AVAIL)
02102 #define ES_USER_DMA_WAKEUP        EMAPI(EDTS_USER_DMA_WAKEUP)
02103 #define EG_USER_DMA_WAKEUP        EMAPI(EDTG_USER_DMA_WAKEUP)
02104 #define EG_WAIT_STATUS        EMAPI(EDTG_WAIT_STATUS)
02105 #define ES_WAIT_STATUS        EMAPI(EDTS_WAIT_STATUS)
02106 #define ES_TIMEOUT_OK        EMAPI(EDTS_TIMEOUT_OK)
02107 #define EG_TIMEOUT_OK        EMAPI(EDTG_TIMEOUT_OK)
02108 #define ES_MULTI_DONE        EMAPI(EDTS_MULTI_DONE)
02109 #define EG_MULTI_DONE        EMAPI(EDTG_MULTI_DONE)
02110 #define ES_TEST_LOCK_ON        EMAPI(EDTS_TEST_LOCK_ON)
02111 #define EG_FVAL_LOW        EMAPI(EDTG_FVAL_LOW)
02112 #define ES_MEZZ_BITPATH      EMAPI(EDTS_MEZZ_BITPATH)
02113 #define EG_MEZZ_BITPATH      EMAPI(EDTG_MEZZ_BITPATH)
02114 #define EG_DMA_INFO      EMAPI(EDTG_DMA_INFO)
02115 #define ES_USER_FUNC         EMAPI(EDTS_USER_FUNC)
02116 #define ES_TEST_STATUS         EMAPI(EDTS_TEST_STATUS)
02117 #define ES_KERNEL_ALLOC         EMAPI(EDTS_KERNEL_ALLOC)
02118 #define EG_RESERVED_PAGES   EMAPI(EDTG_RESERVED_PAGES)
02119 #define ES_RAW_SGLIST            EMAPI(EDTS_RAW_SGLIST)
02120 #define ES_IGNORE_SIGNALS            EMAPI(EDTS_IGNORE_SIGNALS)
02121 #define ES_TRACE_REG            EMAPI(EDTS_TRACE_REG)
02122 #define ES_TIMESTAMP_LEVEL            EMAPI(EDTS_TIMESTAMP_LEVEL)
02123 #define ES_REG_BIT_CLEARSET            EMAPI(EDTS_REG_BIT_CLEARSET)
02124 #define ES_REG_BIT_SETCLEAR            EMAPI(EDTS_REG_BIT_SETCLEAR)
02125 #define ES_REG_READBACK                EMAPI(EDTS_REG_READBACK)
02126 #define ES_MEZZ_ID                EMAPI(EDTS_MEZZ_ID)
02127 #define EG_MEZZ_ID                EMAPI(EDTG_MEZZ_ID)
02128 #define EG_NUMBUFS                EMAPI(EDTG_NUMBUFS)
02129 #define ES_READ_STARTACT    EMAPI(EDTS_READ_STARTACT)
02130 #define ES_READ_ENDACT      EMAPI(EDTS_READ_ENDACT)
02131 #define ES_WRITE_STARTACT   EMAPI(EDTS_WRITE_STARTACT)
02132 #define ES_WRITE_ENDACT     EMAPI(EDTS_WRITE_ENDACT)
02133 #define ES_READ_START_DELAYS    EMAPI(EDTS_READ_START_DELAYS)
02134 #define ES_READ_END_DELAYS  EMAPI(EDTS_READ_END_DELAYS)
02135 #define ES_WRITE_START_DELAYS   EMAPI(EDTS_WRITE_START_DELAYS)
02136 #define ES_WRITE_END_DELAYS EMAPI(EDTS_WRITE_END_DELAYS)
02137 #define ES_INDIRECT_REG_BASE    EMAPI(EDTS_INDIRECT_REG_BASE)
02138 #define EG_INDIRECT_REG_BASE    EMAPI(EDTG_INDIRECT_REG_BASE)
02139 #define ES_BITLOAD              EMAPI(EDTS_BITLOAD)
02140 #define ES_MEZZLOAD             EMAPI(EDTS_MEZZLOAD)
02141 #define ES_PCILOAD              EMAPI(EDTS_PCILOAD)
02142 #define ES_SYNC_INTERVAL             EMAPI(EDTS_SYNC_INTERVAL)
02143 #define EG_SYNC_INTERVAL              EMAPI(EDTG_SYNC_INTERVAL)
02144 #define ES_DEBUG_MASK                EMAPI(EDTS_DEBUG_MASK)
02145 #define EG_DEBUG_MASK                EMAPI(EDTG_DEBUG_MASK)
02146 #define ES_ALLOC_KBUFFER             EMAPI(EDTS_ALLOC_KBUFFER)
02147 #define EG_TRACE_SIZE           EMAPI(EDTG_TRACE_SIZE)
02148 #define ES_TRACE_SIZE           EMAPI(EDTS_TRACE_SIZE)
02149 #define EG_TRACE_ENTRIES        EMAPI(EDTG_TRACE_ENTRIES)
02150 #define EG_TRACEBUF2            EMAPI(EDTG_TRACEBUF2)
02151 #define ES_TRACE_CLEAR          EMAPI(EDTS_TRACE_CLEAR)
02152 #define EG_MAXCHAN              EMAPI(EDTG_MAXCHAN)
02153 
02154 #define ES_INTR_MASK              EMAPI(EDTS_INTR_MASK)
02155 #define EG_INTR_MASK              EMAPI(EDTG_INTR_MASK)
02156 // Direct DMA support:  0 - Normal DMA; 1 - Direct DMA; mcm 10/2012
02157 #define ES_DMA_MODE       EMAPI(EDTS_DMA_MODE)
02158 #define EG_DMA_MODE       EMAPI(EDTG_DMA_MODE)
02159 
02160 #define EG_BUFSIZE          EMAPI(EDTG_BUFSIZE)
02161 
02162 #define ES_WAIT_DIRECT_DMA_DONE       EMAPI(EDTS_WAIT_DIRECT_DMA_DONE)
02163 #define ES_DIRECT_DMA_DONE       EMAPI(EDTS_DIRECT_DMA_DONE)
02164 #define EG_DIRECT_DMA_DONE       EMAPI(EDTG_DIRECT_DMA_DONE)
02165 
02166 #define ES_IND_2_REG             EMAPI(EDTS_IND_2_REG)
02167 #define EG_IND_2_REG              EMAPI(EDTG_IND_2_REG)
02168 
02169 
02170 /* MUST BE EQUAL AT LEAST ONE GREATER THAN THE HIGHEST EDT IOCTL ABOVE */
02171 #define MIN_PCI_IOCTL 300
02172 #define PCIIOC(action, type, size) EIOC(action+MIN_PCI_IOCTL, type, size)
02173 
02174 /* signals for pcd */
02175 #define  PCD_STAT1_SIG      1
02176 #define  PCD_STAT2_SIG      2
02177 #define  PCD_STAT3_SIG      3
02178 #define  PCD_STAT4_SIG      4
02179 #define  PCD_STATX_SIG      5
02180 
02181 /* signals for p16d */
02182 #define P16_DINT_SIG        1
02183 
02184 /* signals for p11w */
02185 #define P11_ATT_SIG     1
02186 #define P11_CNT_SIG     2
02187 
02188 /* signals for p53b */
02189 #define P53B_SRQ_SIG       1
02190 #define P53B_INTERVAL_SIG  2
02191 #define P53B_MODECODE_SIG  3
02192 
02193 /* board (really driver) types - so far we have 5 */
02194 
02195 #define EDT_BDTYPE_UNKN 0
02196 #define EDT_BDTYPE_PCD  1
02197 #define EDT_BDTYPE_PDV  2
02198 #define EDT_BDTYPE_P11W 3
02199 #define EDT_BDTYPE_P16D 4
02200 #define EDT_BDTYPE_P53B 5
02201 
02202 #define EDT_N_BDTYPES   6 /* well, 6 including UNKN */
02203 
02204 #define ID_IS_PCD(id) ((id == PCD20_ID) \
02205         || (id == PCD40_ID) \
02206         || (id == PCD60_ID) \
02207         || (id == PGP20_ID) \
02208         || (id == PGP40_ID) \
02209         || (id == PGP60_ID) \
02210         || (id == PGP_ECL_ID) \
02211         || (id == PGP_THARAS_ID) \
02212         || (id == PCDFCI_SIM_ID) \
02213         || (id == PCDFCI_PCD_ID) \
02214         || (id == PSS4_ID) \
02215         || (id == PSS16_ID) \
02216         || (id == PCDA_ID) \
02217         || (id == PCDCL_ID) \
02218         || (id == PCDA16_ID) \
02219         || (id == PE4CDA_ID) \
02220         || (id == PE4CDA16_ID) \
02221         || (id == PCDHSS_ID) \
02222         || (id == PGS4_ID) \
02223         || (id == PGS16_ID) \
02224         || (id == USB_ID) \
02225         || (id == PCD_16_ID) \
02226         || (id == PCDFOX_ID) \
02227         || (id == PE8LX1_ID) \
02228         || (id == PE8LX16_LS_ID) \
02229         || (id == PE8LX16_ID) \
02230         || (id == PE8LX32_ID) \
02231         || (id == PE8G2V7_ID) \
02232         || (id == PE8G3S5_ID) \
02233         || (id == PE8G3KU_ID) \
02234         || (id == WSU1_ID) \
02235         || (id == SNAP1_ID) \
02236         || (id == PE4BL_RADIO_ID) \
02237         || (id == PE8BL_10GNIC_ID) \
02238         || (id == PE1BL_TIMING_ID) \
02239         || (id == LCRBOOT_ID) \
02240         || (id == PE4AMC16_ID) \
02241         )
02242 
02243  /* move /remove these from this list as they are assigned */
02244 #define ID_IS_UNKNOWN(id) ( \
02245            ( id == UNKNOWNAB_ID) \
02246         || ( id == UNKNOWNAC_ID) \
02247         || ( id == UNKNOWNAD_ID) \
02248         || ( id == UNKNOWNAE_ID) \
02249         || ( id == UNKNOWNAF_ID) \
02250         )
02251 
02252 #define ID_IS_1553(id) ((id == P53B_ID) \
02253         || (id == PE1_53B_ID))
02254 
02255 #define ID_IS_SS(id) ((id == PSS4_ID) \
02256         || (id == PSS16_ID))
02257 
02258 #define ID_IS_GS(id) ((id == PGS4_ID) \
02259         || (id == PGS16_ID))
02260 
02261 #define ID_IS_LX(id) ((id == PE8LX1_ID) \
02262         || (id == PE8LX16_LS_ID) \
02263         || (id == PE4AMC16_ID) \
02264         || (id == PE4CDA_ID) \
02265         || (id == PE4CDA16_ID) \
02266         || (id == PE8LX16_ID) \
02267         || (id == PE8BL_10GNIC_ID) \
02268         || (id == PE4BL_RADIO_ID) \
02269         || (id == PE8LX32_ID))
02270 
02271 #define ID_HAS_CHANREG(id) (ID_HAS_MEZZ(id) || (id == PCDA_ID))
02272 
02273 #define ID_IS_PDV(id) ((id == PDV_ID) \
02274         || (id == PDVK_ID) \
02275         || (id == PDV44_ID) \
02276         || (id == PDVAERO_ID) \
02277         || (id == PDVCL_ID) \
02278         || (id == PE1DVVL_ID) \
02279         || (id == PE4DVVL_ID) \
02280         || (id == PE4DVCL_ID) \
02281         || (id == PE8DVCL_ID) \
02282         || (id == PE8DVCLS_ID) \
02283         || (id == PE4DVVLSIM_ID) \
02284         || (id == PDVCL2_ID) \
02285         || (id == PDVFOI_ID) \
02286         || (id == PDVFCI_AIAG_ID) \
02287         || (id == PDVFCI_USPS_ID) \
02288         || (id == PDVA_ID) \
02289         || (id == PDVFOX_ID) \
02290         || (id == PE4DVAFOX_ID) \
02291         || (id == PE8DVFOX_ID) \
02292         || (id == PE4DVVLFOX_ID) \
02293         || (id == PDVA16_ID) \
02294         || (id == PGP_RGB_ID) \
02295         || (id == PE4DVFCI_ID) \
02296         || (id == PE8DVFCI_ID) \
02297         || (id == PC104ICB_ID))
02298 
02299 #define ID_IS_DVFOX(id) \
02300     (    (id == PDVFOX_ID) \
02301       || (id == PE4DVVLFOX_ID) \
02302       || (id == PE4DVAFOX_ID) \
02303       || (id == PE8DVAFOX_ID))
02304 
02305 #define ID_IS_PCIE_DVFOX(id) \
02306     (    (id == PE4DVVLFOX_ID) \
02307       || (id == PE4DVAFOX_ID) \
02308       || (id == PE8DVAFOX_ID))
02309 
02310 #define ID_IS_DVCL(id) \
02311     (    (id == PDVCL_ID) \
02312       || (id == PE1DVVL_ID) \
02313       || (id == PE4DVVL_ID) \
02314       || (id == PE4DVVLFOX_ID) \
02315       || (id == PE4DVCL_ID) \
02316       || (id == PE8DVCL_ID) \
02317       || (id == PE4DVAFOX_ID))
02318 
02319 #define ID_IS_DVCL2(id) \
02320     (    (id == PDVCL2_ID) \
02321       || (id == PE8DVCLS_ID))  /* ALERT: we're going with distinct ID for PCIe CLS */
02322 /* so removed IDs for those boards as of 4.2.4.5 */
02323 
02324 /* this one is for all PCIE -- for PCIE + PCI, use ID_IS_DVCL2 */
02325 #define ID_IS_DVCLS(id) \
02326       ( (id == PE8DVCLS_ID) \
02327       || (id == PE4DVVLSIM_ID))
02328 
02329 #define ID_IS_FCIUSPS(id) \
02330     (    (id == PDVFCI_USPS_ID) \
02331       || (id == PC104ICB_ID))
02332 
02333 #define ID_HAS_IRIGB(id) \
02334     (    (id == PE1DVVL_ID) \
02335       || (id == PE4DVVL_ID) \
02336       || (id == PE4DVCL_ID) \
02337       || (id == PE8DVCL_ID) \
02338       || (id == PE4DVAFOX_ID))
02339 
02340 #define ID_STORES_MACADDRS(id) \
02341     (  (ID_HAS_MEZZ(id)) \
02342     || (id == PE8G3S5_ID) \
02343     || (id == PE8G3KU_ID) \
02344     || (id == WSU1_ID) \
02345     || (id == SNAP1_ID) \
02346     || (id == LCRBOOT_ID) \
02347     || (id == PE8BL_10GNIC_ID) \
02348     || (id == PE4AMC16_ID))
02349 
02350 #define ID_IS_LCRBLADE(id) \
02351     (  (id == PE4BL_RADIO_ID) \
02352     || (id == PE1BL_TIMING_ID) \
02353     || (id == PE8BL_10GNIC_ID))
02354 
02355 /* ADD any devices that don't have a separate interface FPGA here */
02356 #define ID_HAS_COMBINED_FPGA(id) \
02357     (  (id == P11W_ID) \
02358     || (id == P16D_ID) \
02359     || (id == PDVCL_ID) \
02360     || (id == PE4DVCL_ID) \
02361     || (id == PE8DVCL_ID) \
02362     || (id == PC104ICB_ID) \
02363     || (id == PE4CDA_ID) \
02364     || (id == PE4CDA16_ID) \
02365     || (id == PE8DVAFOX_ID) \
02366     || (id == PE4DVAFOX_ID) \
02367     || (id == PE4DVFCI_ID) \
02368     || (id == PE8DVFCI_ID) \
02369     || (id == PC104ICB_ID) \
02370     || (id == PE8DVCL2_ID) \
02371     || (id == PDVFCI_AIAG_ID) \
02372     || (id == PDVFCI_USPS_ID) \
02373     || (id == PCDFCI_SIM_ID) \
02374     || (id == PE8G3S5_ID) \
02375     || (id == PE8G3KU_ID) \
02376     || (id == WSU1_ID) \
02377     || (id == SNAP1_ID) \
02378     || (id == PE4BL_RADIO_ID) \
02379     || (id == PE1BL_TIMING_ID) \
02380     || (id == PE8BL_10GNIC_ID) \
02381     || (id == PE8G2V7_ID) \
02382     || (ID_IS_MICRON_PROM(id)) /* ALERT : for visionlink; may change in the future */  \
02383     || (id == PCDFCI_PCD_ID))
02384 
02385 #define ID_HAS_16BIT_PROM(id) \
02386     (      (id == PE8G3S5_ID) \
02387         || (id == WSU1_ID) \
02388         || (id == SNAP1_ID) \
02389         || (id == PE4CDA_ID) \
02390         || (id == PE4CDA16_ID) \
02391         || (id == PE8G3KU_ID) \
02392     )
02393 
02394 #define ID_IS_MICRON_PROM(id) \
02395     (      (id == PE1DVVL_ID) \
02396         || (id == PE4DVVL_ID) \
02397         || (id == PE4DVVLSIM_ID) \
02398         || (id == PE4DVVLFOX_ID) \
02399         || (id == PE4BL_RADIO_ID) \
02400         || (id == PE1BL_TIMING_ID) \
02401         || (id == PE8BL_10GNIC_ID) \
02402         || (id == LCRBOOT_ID) \
02403     )
02404   
02405 
02406 #define ID_IS_MULTICHAN(id) \
02407     (  (id == PSS16_ID) \
02408     || (id == PSS4_ID) \
02409     || (id == PCDA16_ID) \
02410     || (id == PE4CDA_ID) \
02411     || (id == PE4CDA16_ID) \
02412     || (id == PGS4_ID) \
02413     || (id == PGS16_ID) \
02414     || (id == PE8LX16_ID) \
02415     || (id == PE8LX32_ID) \
02416     || (id == PE8G2V7_ID) \
02417     || (id == PE8BL_10GNIC_ID) \
02418     || (id == PE8LX32_ID) \
02419     || (id == PE4AMC16_ID) \
02420     || (id == PE8G3S5_ID) \
02421     || (id == PE8G3KU_ID) \
02422     || (id == WSU1_ID) \
02423     || (id == SNAP1_ID) \
02424     || (id == PE4BL_RADIO_ID) \
02425     || (id == PE8LX16_LS_ID))
02426 
02427 #define ID_IS_2CHANNEL(id) \
02428     (  (id == PDVFCI_USPS_ID) \
02429     || (id == PE4DVFCI_ID) \
02430     || (id == PE8DVFCI_ID) \
02431     || (id == PE4DVVLSIM_ID) \
02432     || (id == PE8DVCLS_ID))
02433 
02434 #define ID_IS_3CHANNEL(id) \
02435     (  (id == PE1DVVL_ID) \
02436     || (id == PE4DVVL_ID) \
02437     || (id == PE4DVCL_ID) \
02438     || (id == PE8DVCL_ID) \
02439     || (id == PDVCL_ID) \
02440     || (id == PC104ICB_ID))
02441 
02442 #define ID_IS_4CHANNEL(id) \
02443     (  (id == PCD20_ID) \
02444     || (id == PCD40_ID) \
02445     || (id == PCD60_ID) \
02446     || (id == PGP20_ID) \
02447     || (id == PGP40_ID) \
02448     || (id == PGP60_ID) \
02449     || (id == PGP_ECL_ID) \
02450     || (id == PDVFOI_ID) \
02451     || (id == PDVAERO_ID) \
02452     || (id == PE4DVFOX_ID) \
02453     || (id == PE8DVFOX_ID) \
02454     || (id == PDVCL2_ID) )
02455 
02456 
02457 #define ID_HAS_PCD_DIR_BIT(id) \
02458     (  (id == PCD20_ID) \
02459     || (id == PCD40_ID) \
02460     || (id == PCD60_ID) \
02461     || (id == PGP20_ID) \
02462     || (id == PGP40_ID) \
02463     || (id == PGP60_ID) \
02464     || (id == PCDA_ID) \
02465     || (id == PE4CDA_ID) \
02466     || (id == PDVAERO_ID) )
02467 
02468 
02469 #define ID_IS_1OR4CHANNEL(id) \
02470     (  (id == PSS4_ID) \
02471     || (id == PGS4_ID) \
02472     || (id == PCDFOX_ID) \
02473     || (id == PE4CDA_ID) \
02474     || (id == PCDA_ID) \
02475     || (id == PCDCL_ID) \
02476     || (id == PDVFOX_ID) )
02477 
02478 #define ID_IS_16CHANNEL(id) \
02479     (  (id == PCD_16_ID) \
02480     || (id == PSS16_ID) \
02481     || (id == PGS16_ID) \
02482     || (id == PCDA16_ID) \
02483     || (id == PE4CDA16_ID) \
02484     || (id == PE8LX16_ID) \
02485     || (id == WSU1_ID) \
02486     || (id == SNAP1_ID) \
02487     || (id == PE8BL_10GNIC_ID) \
02488     || (id == PE4BL_RADIO_ID) \
02489     || (id == PE8G3S5_ID) \
02490     || (id == PE8G3KU_ID) \
02491     || (id == PE8LX16_LS_ID) \
02492     || (id == PE4AMC16_ID))
02493 
02494 #define ID_IS_32CHANNEL(id) \
02495     (  (id == PE8LX32_ID))
02496 
02497 #define ID_IS_DUMMY(id) \
02498     (  (id == DMY_ID) \
02499     || (id == DMYK_ID))
02500 
02501 #define ID_IS_1LANE(id) \
02502     (  (id == PE1_53B_ID) \
02503     || (id == PE1BL_TIMING_ID) \
02504     || (id == PE1_53B_ID) \
02505     || (id == PE1DVVL_ID))
02506 
02507 #define ID_IS_4LANE(id) \
02508     (  (id == PE4CDA_ID) \
02509     || (id == PE4CDA16_ID) \
02510     || (id == PE4DVCL_ID) \
02511     || (id == PE4DVVL_ID) \
02512     || (id == PE4DVVLFOX_ID) \
02513     || (id == PE4DVAFOX_ID) \
02514     || (id == PE4DVFCI_ID) \
02515     || (id == PE4BL_RADIO_ID) \
02516     || (id == PE4AMC16_ID))
02517 
02518 #define ID_IS_8LANE(id) \
02519     (  ( id == PE8DVAFOX_ID) \
02520     || ( id == PE8DVCL_ID) \
02521     || ( id == PE8DVFCI_ID) \
02522     || ( id == PE8LX1_ID) \
02523     || ( id == PE8LX16_ID) \
02524     || ( id == PE8LX16_LS_ID) \
02525     || ( id == PE8DVCL2_ID) \
02526     || ( id == PE8BL_10GNIC_ID) \
02527     || ( id == PE8LX32_ID) \
02528     || ( id == PE8G2V7_ID) \
02529     || ( id == PE8G3S5_ID) \
02530     || ( id == PE8G3KU_ID) \
02531     )
02532 
02533 
02534 #define ID_HAS_MEZZ(id) (ID_IS_SS(id) || ID_IS_GS(id) || ID_IS_LX(id)) || id == PE8G2V7_ID
02535 
02540 #define has_pcda_direction_bit(edt_p) (ID_HAS_PCD_DIR_BIT(edt_p->devid))
02541 #define edt_is_pdv(edt_p) (ID_IS_PDV(edt_p->devid))
02542 #define edt_is_pcd(edt_p) (ID_IS_PCD(edt_p->devid))
02543 #define edt_is_1553(edt_p) (ID_IS_1553(edt_p->devid))
02544 #define edt_is_dvfox(edt_p) (ID_IS_DVFOX(edt_p->devid))
02545 #define edt_is_pcie_dvfox(edt_p) (ID_IS_PCIE_DVFOX(edt_p->devid))
02546 #define edt_is_dvcl(edt_p) (ID_IS_DVCL(edt_p->devid))
02547 #define edt_is_dvcl2(edt_p) (ID_IS_DVCL2(edt_p->devid)) /* both PCI and PCIe simulators */
02548 #define edt_is_simulator(edt_p) (ID_IS_DVCL2(edt_p->devid)) /* same as previous */
02549 #define edt_is_dvcls(edt_p) (ID_IS_DVCLS(edt_p->devid)) /* only PCIe (2-ch) simulators */
02550 #define edt_is_fciusps(edt_p) (ID_IS_FCIUSPS(edt_p->devid))
02551 #define edt_has_irigb(edt_p) (ID_HAS_IRIGB(edt_p->devid))
02552 #define edt_has_combined_fpga(edt_p) (ID_HAS_COMBINED_FPGA(edt_p->devid))
02553 #define edt_has_chanreg(edt_p) (ID_HAS_CHANREG(edt_p->devid))
02554 #define edt_stores_macaddrs(edt_p) (ID_STORES_MACADDRS(edt_p->devid))
02555 #define edt_is_16bit_prom(edt_p) (ID_HAS_16BIT_PROM(edt_p->devid))
02556 #define edt_is_micron_prom(edt_p) (ID_IS_MICRON_PROM(edt_p->devid))
02557 #define edt_is_multichan(edt_p) (ID_IS_MULTICHAN(edt_p->devid))
02558 #define edt_is_2channel(edt_p) (ID_IS_2CHANNEL(edt_p->devid))
02559 #define edt_is_3channel(edt_p) (ID_IS_3CHANNEL(edt_p->devid))
02560 #define edt_is_4channel(edt_p) (ID_IS_4CHANNEL(edt_p->devid))
02561 #define edt_is_1or4channel(edt_p) (ID_IS_1OR4CHANNEL(edt_p->devid))
02562 #define edt_is_16channel(edt_p) (ID_IS_16CHANNEL(edt_p->devid))
02563 #define edt_is_32channel(edt_p) (ID_IS_32CHANNEL(edt_p->devid))
02564 #define edt_is_dummy(edt_p) (ID_IS_DUMMY(edt_p->devid))
02565 #define edt_is_1lane(edt_p) (ID_IS_1LANE(edt_p->devid))
02566 #define edt_is_4lane(edt_p) (ID_IS_4LANE(edt_p->devid))
02567 #define edt_is_8lane(edt_p) (ID_IS_8LANE(edt_p->devid))
02568 #define edt_is_unknown(edt_p) (ID_IS_UNKNOWN(edt_p->devid))
02569 
02570 #define edt_is_dv_multichannel(edt_p) (edt_is_dvcl(edt_p) || edt_is_dvfox(edt_p) || edt_p->devid == PDVAERO_ID)
02571  /* end dma_utility */
02573  /* end weakgroup dma */
02575 
02576 /* definition for header data for buffers */
02577 /* for disk I/O speed, header mem may be allocated with ring-buffer memory
02578    even if header not in the DMA stream. This covers all possible relationships
02579    of header info to acquisition info */
02580 
02581 #ifndef HDR_TYPE_IRIG1
02582 
02583 /* defined types of within-dma header data */
02584 #define HDR_TYPE_NONE            0
02585 #define HDR_TYPE_IRIG1           1
02586 #define HDR_TYPE_FRAMECNT        2
02587 #define HDR_TYPE_IRIG2           3
02588 #define HDR_TYPE_BUFHEADER       4 /* fro general data (wrap) */
02589 
02590 #endif
02591 
02592 /* Driver Debugging */
02593 
02594 #define TRL_NONE        0
02595 
02596 #define TRL_CRITICAL    1
02597 #define TRL_FATAL       1
02598 #define TRL_ERROR       2
02599 #define TRL_WARN    3
02600 #define TRL_INFO    4
02601 #define TRL_VERBOSE     5
02602 #define TRL_REALVERBOSE   6
02603 #define TRL_RESERVED7   7
02604 #define TRL_RESERVED8   8
02605 #define TRL_RESERVED9   9
02606 
02607 #define EDT_DEBUG_LEVELS 10
02608 
02609 /* Driver trace mask bits */
02610 
02611 #define DBG_INIT        0x00000100
02612 #define DBG_PNP         0x00000200
02613 #define DBG_POWER       0x00000400
02614 #define DBG_CREATE_CLOSE    0x00001000
02615 #define DBG_IOCTLS      0x00002000
02616 #define DBG_WRITE       0x00004000
02617 #define DBG_READ        0x00008000
02618 #define DBG_DPC         0x00010000
02619 #define DBG_ISR             0x00020000
02620 #define DBG_LOCKS       0x00040000
02621 #define DBG_EVENTS      0x00080000
02622 #define DBG_HW          0x00100000
02623 #define DBG_REG         0x00200000
02624 #define DBG_DMA         0x00400000
02625 #define DBG_DMA_SETUP       0x00800000
02626 #define DBG_SERIAL      0x01000000
02627 #define DBG_BOARD       0x02000000
02628 #define DBG_ALLOC       0x04000000
02629 #define DBG_MEMMAP      0x08000000
02630 #define DBG_TIME        0x10000000
02631 #define DBG_TIMEOUT     0x20000000
02632 #define DBG_INTR_EN     0x40000000
02633 
02634 #define DBG_ALL         0xffffff00
02635 
02636 #define N_DBG_STATES 24
02637 
02638 /* The debug level is in the lower 8 bits of a debug mask */
02639 
02640 #define DBG_MASK_VAL(x)     ((x) & 0xffffff00)
02641 #define DBG_MASK_LEVEL(x)   ((x) & 0xff)
02642 #define DBG_MASK(level,mask)  ((mask) | (level & 0xff))
02643 
02644 #define DBG_READWRITE  (DBG_READ | DBG_WRITE)
02645 
02652 enum EdtIOPort
02653 {
02654     EDT_NO_PORT = -1,
02655     EDT_IO_PORT_0 = 0,
02656     EDT_IO_PORT_1 = 1,
02657     EDT_IO_PORT_2 = 2,
02658     EDT_IO_PORT_3 = 3,
02659     EDT_IO_PORT_4 = 4,
02660     EDT_IO_PORT_5 = 5,
02661     EDT_IO_PORT_6 = 6,
02662     EDT_IO_PORT_7 = 7,
02663     EDT_IO_PORT_8 = 8,
02664     EDT_IO_PORT_9 = 9,
02665     EDT_IO_PORT_10 = 10,
02666     EDT_IO_PORT_11 = 11,
02667     EDT_IO_PORT_12 = 12,
02668     EDT_IO_PORT_13 = 13,
02669     EDT_IO_PORT_14 = 14,
02670     EDT_IO_PORT_15 = 15,
02671     EDT_IO_PORT_16 = 16,
02672     EDT_IO_PORT_17 = 17,
02673     EDT_IO_PORT_18 = 18,
02674     EDT_IO_PORT_19 = 19,
02675     EDT_IO_PORT_20 = 20,
02676     EDT_IO_PORT_21 = 21,
02677     EDT_IO_PORT_22 = 22,
02678     EDT_IO_PORT_23 = 23,
02679     EDT_IO_PORT_24 = 24,
02680     EDT_IO_PORT_25 = 25,
02681     EDT_IO_PORT_26 = 26,
02682     EDT_IO_PORT_27 = 27,
02683     EDT_IO_PORT_28 = 28,
02684     EDT_IO_PORT_29 = 29,
02685     EDT_IO_PORT_30 = 30,
02686     EDT_IO_PORT_31 = 31,
02687     EDT_IO_PORT_32 = 32
02688 };
02689 
02690 /* Device load tasks - 
02691   1. enumerate boards.
02692   2. load bitfile.
02693   a. from specified name
02694   b. auto update
02695   3. verify bitfile.
02696   4. set serial number values
02697   5. display one board's values
02698  */
02699 typedef enum {
02700     EDT_Enumerate,
02701     EDT_LoadProm,
02702     EDT_AutoUpdate,
02703     EDT_VerifyOnly,
02704     EDT_SetSerial,
02705     EDT_Display,
02706     EDT_Erase,
02707     EDT_CheckIdOnly,
02708     EDT_CheckUpdate
02709 } EdtLoadState;
02710 
02711 
02712 #endif /* INCLUDE_edtlib_h */

Generated on 19 Jun 2015 by  doxygen 1.4.7