ibConf.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /***************************************************************************
  2. lib/ibConf.h
  3. -------------------
  4. copyright : (C) 2001,2002 by Frank Mori Hess
  5. email : fmhess@users.sourceforge.net
  6. ***************************************************************************/
  7. /***************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. ***************************************************************************/
  15. #ifndef _IBCONF_H
  16. #define _IBCONF_H
  17. #include <unistd.h>
  18. #include <sys/types.h>
  19. #include <pthread.h>
  20. /* meaning for flags */
  21. #define CN_SDCL (1<<1) /* Send DCL on init */
  22. #define CN_SLLO (1<<2) /* Send LLO on init */
  23. #define CN_NETWORK (1<<3) /* is a network device */
  24. #define CN_AUTOPOLL (1<<4) /* Auto serial poll devices */
  25. #define CN_EXCLUSIVE (1<<5) /* Exclusive use only */
  26. /*---------------------------------------------------------------------- */
  27. struct async_operation
  28. {
  29. pthread_t thread; /* thread used for asynchronous io operations */
  30. pthread_mutex_t lock;
  31. pthread_mutex_t join_lock;
  32. pthread_cond_t condition;
  33. uint8_t *buffer;
  34. volatile long buffer_length;
  35. volatile int iberr;
  36. volatile int ibsta;
  37. volatile long ibcntl;
  38. volatile short in_progress;
  39. volatile short abort;
  40. };
  41. typedef struct
  42. {
  43. int pad; /* device primary address */
  44. int sad; /* device secodnary address (negative disables) */
  45. int board; /* board index */
  46. unsigned int usec_timeout;
  47. unsigned int spoll_usec_timeout;
  48. unsigned int ppoll_usec_timeout;
  49. char eos; /* eos character */
  50. int eos_flags;
  51. int ppoll_config; /* current parallel poll configuration */
  52. unsigned send_eoi : 1; /* assert EOI at end of writes */
  53. unsigned local_lockout : 1; /* send local lockout when device is brought online */
  54. unsigned local_ppc : 1; /* enable local configuration of board's parallel poll response */
  55. unsigned readdr : 1; /* useless, exists for compatibility only at present */
  56. }descriptor_settings_t;
  57. typedef struct ibConfStruct
  58. {
  59. int handle;
  60. char name[100]; /* name of the device (for ibfind()) */
  61. descriptor_settings_t defaults; /* initial settings stored so ibonl() can restore them */
  62. descriptor_settings_t settings; /* various software settings for this descriptor */
  63. char init_string[100]; /* initialization string (optional) */
  64. int flags; /* some flags, deprecated */
  65. struct async_operation async; /* used by asynchronous operations ibcmda(), ibrda(), etc. */
  66. unsigned end : 1; /* EOI asserted or EOS received at end of IO operation */
  67. unsigned is_interface : 1; /* is interface board */
  68. unsigned board_is_open : 1;
  69. unsigned has_lock : 1;
  70. unsigned timed_out : 1; /* io operation timed out */
  71. } ibConf_t;
  72. /*---------------------------------------------------------------------- */
  73. typedef struct ibBoardStruct {
  74. char board_type[100]; /* name (model) of interface board */
  75. unsigned long base; /* base configuration */
  76. unsigned int irq;
  77. unsigned int dma;
  78. int pci_bus;
  79. int pci_slot;
  80. int fileno; /* device file descriptor */
  81. char device[100]; /* name of device file ( /dev/gpib0, etc.) */
  82. unsigned int open_count; /* reference count */
  83. unsigned is_system_controller : 1; /* board is busmaster or not */
  84. unsigned use_event_queue : 1; /* use event queue, or DTAS/DCAS */
  85. unsigned autospoll : 1; /* do auto serial polling */
  86. } ibBoard_t;
  87. #endif /* _IBCONF_H */