kernelcapi.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:5k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $
  3.  * 
  4.  * Kernel CAPI 2.0 Interface for Linux
  5.  * 
  6.  * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
  7.  * 
  8.  */
  9. #ifndef __KERNELCAPI_H__
  10. #define __KERNELCAPI_H__
  11. #define CAPI_MAXAPPL 240 /* maximum number of applications  */
  12. #define CAPI_MAXCONTR 32 /* maximum number of controller    */
  13. #define CAPI_MAXDATAWINDOW 8
  14. typedef struct kcapi_flagdef {
  15. int contr;
  16. int flag;
  17. } kcapi_flagdef;
  18. typedef struct kcapi_carddef {
  19. char driver[32];
  20. unsigned int port;
  21. unsigned irq;
  22. unsigned int membase;
  23. int cardnr;
  24. } kcapi_carddef;
  25. /* new ioctls >= 10 */
  26. #define KCAPI_CMD_TRACE 10
  27. #define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */
  28. /* 
  29.  * flag > 2 => trace also data
  30.  * flag & 1 => show trace
  31.  */
  32. #define KCAPI_TRACE_OFF 0
  33. #define KCAPI_TRACE_SHORT_NO_DATA 1
  34. #define KCAPI_TRACE_FULL_NO_DATA 2
  35. #define KCAPI_TRACE_SHORT 3
  36. #define KCAPI_TRACE_FULL 4
  37. #ifdef __KERNEL__
  38. #include <linux/list.h>
  39. #include <linux/skbuff.h>
  40. #define KCI_CONTRUP 0 /* arg: struct capi_profile */
  41. #define KCI_CONTRDOWN 1 /* arg: NULL */
  42. struct capi20_appl {
  43. u16 applid;
  44. capi_register_params rparam;
  45. void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
  46. void *private;
  47. /* internal to kernelcapi.o */
  48. unsigned long nrecvctlpkt;
  49. unsigned long nrecvdatapkt;
  50. unsigned long nsentctlpkt;
  51. unsigned long nsentdatapkt;
  52. struct semaphore recv_sem;
  53. struct sk_buff_head recv_queue;
  54. struct work_struct recv_work;
  55. int release_in_progress;
  56. /* ugly hack to allow for notification of added/removed
  57.  * controllers. The Right Way (tm) is known. XXX
  58.  */
  59. void (*callback) (unsigned int cmd, __u32 contr, void *data);
  60. };
  61. u16 capi20_isinstalled(void);
  62. u16 capi20_register(struct capi20_appl *ap);
  63. u16 capi20_release(struct capi20_appl *ap);
  64. u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
  65. u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
  66. u16 capi20_get_version(u32 contr, struct capi_version *verp);
  67. u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
  68. u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
  69. int capi20_manufacturer(unsigned int cmd, void __user *data);
  70. /* temporary hack XXX */
  71. void capi20_set_callback(struct capi20_appl *ap, 
  72.  void (*callback) (unsigned int cmd, __u32 contr, void *data));
  73. #define CAPI_NOERROR                      0x0000
  74. #define CAPI_TOOMANYAPPLS   0x1001
  75. #define CAPI_LOGBLKSIZETOSMALL           0x1002
  76. #define CAPI_BUFFEXECEEDS64K            0x1003
  77. #define CAPI_MSGBUFSIZETOOSMALL           0x1004
  78. #define CAPI_ANZLOGCONNNOTSUPPORTED   0x1005
  79. #define CAPI_REGRESERVED   0x1006
  80. #define CAPI_REGBUSY            0x1007
  81. #define CAPI_REGOSRESOURCEERR           0x1008
  82. #define CAPI_REGNOTINSTALLED            0x1009
  83. #define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP  0x100a
  84. #define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
  85. #define CAPI_ILLAPPNR           0x1101
  86. #define CAPI_ILLCMDORSUBCMDORMSGTOSMALL   0x1102
  87. #define CAPI_SENDQUEUEFULL   0x1103
  88. #define CAPI_RECEIVEQUEUEEMPTY           0x1104
  89. #define CAPI_RECEIVEOVERFLOW            0x1105
  90. #define CAPI_UNKNOWNNOTPAR   0x1106
  91. #define CAPI_MSGBUSY            0x1107
  92. #define CAPI_MSGOSRESOURCEERR           0x1108
  93. #define CAPI_MSGNOTINSTALLED            0x1109
  94. #define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP  0x110a
  95. #define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
  96. typedef enum {
  97.         CapiMessageNotSupportedInCurrentState = 0x2001,
  98.         CapiIllContrPlciNcci                  = 0x2002,
  99.         CapiNoPlciAvailable                   = 0x2003,
  100.         CapiNoNcciAvailable                   = 0x2004,
  101.         CapiNoListenResourcesAvailable        = 0x2005,
  102.         CapiNoFaxResourcesAvailable           = 0x2006,
  103.         CapiIllMessageParmCoding              = 0x2007,
  104. } RESOURCE_CODING_PROBLEM;
  105. typedef enum {
  106.         CapiB1ProtocolNotSupported                      = 0x3001,
  107.         CapiB2ProtocolNotSupported                      = 0x3002,
  108.         CapiB3ProtocolNotSupported                      = 0x3003,
  109.         CapiB1ProtocolParameterNotSupported             = 0x3004,
  110.         CapiB2ProtocolParameterNotSupported             = 0x3005,
  111.         CapiB3ProtocolParameterNotSupported             = 0x3006,
  112.         CapiBProtocolCombinationNotSupported            = 0x3007,
  113.         CapiNcpiNotSupported                            = 0x3008,
  114.         CapiCipValueUnknown                             = 0x3009,
  115.         CapiFlagsNotSupported                           = 0x300a,
  116.         CapiFacilityNotSupported                        = 0x300b,
  117.         CapiDataLengthNotSupportedByCurrentProtocol     = 0x300c,
  118.         CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
  119.         CapiTeiAssignmentFailed                         = 0x300e,
  120. } REQUESTED_SERVICES_PROBLEM;
  121. typedef enum {
  122. CapiSuccess                                     = 0x0000,
  123. CapiSupplementaryServiceNotSupported            = 0x300e,
  124. CapiRequestNotAllowedInThisState                = 0x3010,
  125. } SUPPLEMENTARY_SERVICE_INFO;
  126. typedef enum {
  127. CapiProtocolErrorLayer1                         = 0x3301,
  128. CapiProtocolErrorLayer2                         = 0x3302,
  129. CapiProtocolErrorLayer3                         = 0x3303,
  130. CapiTimeOut                                     = 0x3303, // SuppServiceReason
  131. CapiCallGivenToOtherApplication                 = 0x3304,
  132. } CAPI_REASON;
  133. #endif /* __KERNEL__ */
  134. #endif /* __KERNELCAPI_H__ */