kernelcapi.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* $Id: kernelcapi.h,v 1.1.4.2 2002/01/28 18:25:10 kai Exp $
  2.  * 
  3.  * Kernel CAPI 2.0 Interface for Linux
  4.  * 
  5.  * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
  6.  * 
  7.  * This software may be used and distributed according to the terms
  8.  * of the GNU General Public License, incorporated herein by reference.
  9.  *
  10.  */
  11. #ifndef __KERNELCAPI_H__
  12. #define __KERNELCAPI_H__
  13. #define CAPI_MAXAPPL 128 /* maximum number of applications  */
  14. #define CAPI_MAXCONTR 16 /* maximum number of controller    */
  15. #define CAPI_MAXDATAWINDOW 8
  16. typedef struct kcapi_flagdef {
  17. int contr;
  18. int flag;
  19. } kcapi_flagdef;
  20. typedef struct kcapi_carddef {
  21. char driver[32];
  22. unsigned int port;
  23. unsigned irq;
  24. unsigned int membase;
  25. int cardnr;
  26. } kcapi_carddef;
  27. /* new ioctls >= 10 */
  28. #define KCAPI_CMD_TRACE 10
  29. #define KCAPI_CMD_ADDCARD 11 /* add card to named driver */
  30. /* 
  31.  * flag > 2 => trace also data
  32.  * flag & 1 => show trace
  33.  */
  34. #define KCAPI_TRACE_OFF 0
  35. #define KCAPI_TRACE_SHORT_NO_DATA 1
  36. #define KCAPI_TRACE_FULL_NO_DATA 2
  37. #define KCAPI_TRACE_SHORT 3
  38. #define KCAPI_TRACE_FULL 4
  39. #ifdef __KERNEL__
  40. struct capi_interface {
  41. __u16 (*capi_isinstalled) (void);
  42. __u16 (*capi_register) (capi_register_params * rparam, __u16 * applidp);
  43. __u16 (*capi_release) (__u16 applid);
  44. __u16 (*capi_put_message) (__u16 applid, struct sk_buff * msg);
  45. __u16 (*capi_get_message) (__u16 applid, struct sk_buff ** msgp);
  46. __u16 (*capi_set_signal) (__u16 applid,
  47.       void (*signal) (__u16 applid, void *param),
  48.   void *param);
  49. __u16 (*capi_get_manufacturer) (__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
  50. __u16 (*capi_get_version) (__u32 contr, struct capi_version * verp);
  51.  __u16(*capi_get_serial) (__u32 contr, __u8 serial[CAPI_SERIAL_LEN]);
  52.  __u16(*capi_get_profile) (__u32 contr, struct capi_profile * profp);
  53. /*
  54.  * to init controllers, data is always in user memory
  55.  */
  56. int (*capi_manufacturer) (unsigned int cmd, void *data);
  57. };
  58. struct capi_ncciinfo {
  59. __u16 applid;
  60. __u32 ncci;
  61. };
  62. #define KCI_CONTRUP 0 /* struct capi_profile */
  63. #define KCI_CONTRDOWN 1 /* NULL */
  64. #define KCI_NCCIUP 2 /* struct capi_ncciinfo */
  65. #define KCI_NCCIDOWN 3 /* struct capi_ncciinfo */
  66. struct capi_interface_user {
  67. char name[20];
  68. void (*callback) (unsigned int cmd, __u32 contr, void *data);
  69. /* internal */
  70. struct capi_interface_user *next;
  71. };
  72. struct capi_interface *attach_capi_interface(struct capi_interface_user *);
  73. int detach_capi_interface(struct capi_interface_user *);
  74. #define CAPI_NOERROR                      0x0000
  75. #define CAPI_TOOMANYAPPLS   0x1001
  76. #define CAPI_LOGBLKSIZETOSMALL           0x1002
  77. #define CAPI_BUFFEXECEEDS64K            0x1003
  78. #define CAPI_MSGBUFSIZETOOSMALL           0x1004
  79. #define CAPI_ANZLOGCONNNOTSUPPORTED   0x1005
  80. #define CAPI_REGRESERVED   0x1006
  81. #define CAPI_REGBUSY            0x1007
  82. #define CAPI_REGOSRESOURCEERR           0x1008
  83. #define CAPI_REGNOTINSTALLED            0x1009
  84. #define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP  0x100a
  85. #define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
  86. #define CAPI_ILLAPPNR           0x1101
  87. #define CAPI_ILLCMDORSUBCMDORMSGTOSMALL   0x1102
  88. #define CAPI_SENDQUEUEFULL   0x1103
  89. #define CAPI_RECEIVEQUEUEEMPTY           0x1104
  90. #define CAPI_RECEIVEOVERFLOW            0x1105
  91. #define CAPI_UNKNOWNNOTPAR   0x1106
  92. #define CAPI_MSGBUSY            0x1107
  93. #define CAPI_MSGOSRESOURCEERR           0x1108
  94. #define CAPI_MSGNOTINSTALLED            0x1109
  95. #define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP  0x110a
  96. #define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
  97. typedef enum {
  98.         CapiMessageNotSupportedInCurrentState = 0x2001,
  99.         CapiIllContrPlciNcci                  = 0x2002,
  100.         CapiNoPlciAvailable                   = 0x2003,
  101.         CapiNoNcciAvailable                   = 0x2004,
  102.         CapiNoListenResourcesAvailable        = 0x2005,
  103.         CapiNoFaxResourcesAvailable           = 0x2006,
  104.         CapiIllMessageParmCoding              = 0x2007,
  105. } RESOURCE_CODING_PROBLEM;
  106. typedef enum {
  107.         CapiB1ProtocolNotSupported                      = 0x3001,
  108.         CapiB2ProtocolNotSupported                      = 0x3002,
  109.         CapiB3ProtocolNotSupported                      = 0x3003,
  110.         CapiB1ProtocolParameterNotSupported             = 0x3004,
  111.         CapiB2ProtocolParameterNotSupported             = 0x3005,
  112.         CapiB3ProtocolParameterNotSupported             = 0x3006,
  113.         CapiBProtocolCombinationNotSupported            = 0x3007,
  114.         CapiNcpiNotSupported                            = 0x3008,
  115.         CapiCipValueUnknown                             = 0x3009,
  116.         CapiFlagsNotSupported                           = 0x300a,
  117.         CapiFacilityNotSupported                        = 0x300b,
  118.         CapiDataLengthNotSupportedByCurrentProtocol     = 0x300c,
  119.         CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
  120.         CapiTeiAssignmentFailed                         = 0x300e,
  121. } REQUESTED_SERVICES_PROBLEM;
  122. typedef enum {
  123. CapiSuccess                                     = 0x0000,
  124. CapiSupplementaryServiceNotSupported            = 0x300e,
  125. CapiRequestNotAllowedInThisState                = 0x3010,
  126. } SUPPLEMENTARY_SERVICE_INFO;
  127. typedef enum {
  128. CapiProtocolErrorLayer1                         = 0x3301,
  129. CapiProtocolErrorLayer2                         = 0x3302,
  130. CapiProtocolErrorLayer3                         = 0x3303,
  131. CapiTimeOut                                     = 0x3303, // SuppServiceReason
  132. CapiCallGivenToOtherApplication                 = 0x3304,
  133. } CAPI_REASON;
  134. #endif /* __KERNEL__ */
  135. #endif /* __KERNELCAPI_H__ */