Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef __CC32LIB_H__
  2. #define __CC32LIB_H__
  3. //****************************************************************************
  4. // Copyright (C) 2000-2004  ARW Elektronik Germany
  5. //
  6. //
  7. // This program is free software; you can redistribute it and/or modify
  8. // it under the terms of the GNU Lesser General Public License as published by
  9. // the Free Software Foundation; either version 2 of the License, or
  10. // (at your option) any later version.
  11. //
  12. // This program is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. // GNU General Public License for more details.
  16. //
  17. // You should have received a copy of the GNU General Public License
  18. // along with this program; if not, write to the Free Software
  19. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. //
  21. // This product is not authorized for use as critical component in
  22. // life support systems without the express written approval of
  23. // ARW Elektronik Germany.
  24. //  
  25. // Please announce changes and hints to ARW Elektronik
  26. //
  27. // Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de)
  28. //
  29. //****************************************************************************
  30.  
  31. //****************************************************************************
  32. //
  33. // cc32lib.h -- header for a simple access library for the
  34. //                                     PCICC32 PCI to CAMAC Interface
  35. //
  36. // $Log: libcc32.h,v $
  37. // Revision 1.9  2005/10/03 17:46:31  klaus
  38. // simple cosmetic changes, upgrade lib to libcc32.so.3.0.0
  39. //
  40. // Revision 1.8  2004/11/29 20:43:12  klaus
  41. // added _qx functions to get Q and X for every transfer. Release libcc32.so.2.
  42. //
  43. // Revision 1.7  2004/08/13 19:48:25  klaus
  44. // changed license from GPL to LGPL
  45. //
  46. // Revision 1.6  2004/08/12 20:00:41  klaus
  47. // conversion to kernel-version 2.6, released version 6.0
  48. //
  49. // Revision 1.5  2003/05/29 08:29:08  klaus
  50. // added _cplusplus extention
  51. //
  52. // Revision 1.4  2002/04/17 19:41:06  klaus
  53. // added support for autoread
  54. //
  55. // Revision 1.3  2002/04/14 18:25:38  klaus
  56. // added interrupt handling, driver 4.4. ...3.5.tar.gz
  57. //
  58. // Revision 1.2  2001/11/20 20:12:50  klaus
  59. // included new header and CVS log
  60. //
  61. //****************************************************************************
  62.  
  63. /*--- INCLUDES --------------------------------------------------------------------------*/
  64. #include <asm/types.h>
  65.  
  66. /*--- TYPEDEFS --------------------------------------------------------------------------*/
  67. typedef void* CC32_HANDLE;  /* type of the device handle */
  68.  
  69. /*--- DEFINES ---------------------------------------------------------------------------*/
  70.  
  71. /*--- PROTOTYPES ------------------------------------------------------------------------*/
  72. #ifdef __cplusplus
  73. extern "C"
  74. {
  75. #endif
  76.  
  77. /* open a path to a device. E.g. "/dev/pcicc32_1" */
  78. int   cc32_open(char *cszPath, CC32_HANDLE *handle);
  79.  
  80. /* close the opened path */
  81. int   cc32_close(CC32_HANDLE handle);
  82.  
  83. /* read only a word - 16 bits - from a address made out of N,A,F */
  84. __u16 cc32_read_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F);
  85.  
  86. /* read only a word - 16 bits - from a address made out of N,A,F, get Q and X */
  87. __u16 cc32_read_word_qx(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, int *Q, int *X);
  88.  
  89. /* read a long - 32 bits - from a address made out of N,A,F and get the result Q and X */
  90. __u32 cc32_read_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F);
  91.  
  92. /* read a long - 32 bits - from a address made out of N,A,F get Q and X */
  93. __u32 cc32_read_long_qx(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, int *Q, int *X);
  94.  
  95. /* read a long - 32 bits - without any interpretaion */
  96. __u32 cc32_read_long_all(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F);
  97.  
  98. /* write a word - 16 bits - to a destination made out of N,A,F */
  99. void  cc32_write_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, __u16 uwData);
  100.  
  101. /* write a word - 16 bits - to a destination made out of N,A,F, get Q and X */
  102. void  cc32_write_word_qx(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, __u16 uwData, int *Q, int *X);
  103.  
  104. /* write a long - 32 bits - uninterpreted to a destination made out of N,A,F */
  105. void  cc32_write_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, __u32 ulData);
  106.  
  107. /* write a long - 32 bits - uninterpreted to a destination made out of N,A,F, get Q and X */
  108. void  cc32_write_long_qx(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, __u32 ulData, int *Q, int *X);
  109.  
  110. /* poll the state of the timeout line and the LAM state. The timeout line is cleared if it was set */
  111. int   cc32_poll_event(CC32_HANDLE handle, int *nTimeout, int *nLam);
  112.  
  113. /* control interrupts caused by timeouts or LAMs */
  114. int   cc32_interrupt_disable(CC32_HANDLE handle);
  115. int   cc32_interrupt_enable(CC32_HANDLE handle);
  116.  
  117. /* same as cc32_poll_event(), but wait for a state change of timeout or LAMs. */
  118. int   cc32_wait_event(CC32_HANDLE handle, int *nTimeout, int *nLam);
  119.  
  120. /* switch cc32 autoread on or off - return the last switch state */
  121. int   cc32_autoread_on(CC32_HANDLE handle);
  122. int   cc32_autoread_off(CC32_HANDLE handle);
  123.  
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127.  
  128. #endif /* __CC32LIB_H__ */
  129.