capilli.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* $Id: capilli.h,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
  2. *
  3. * Kernel CAPI 2.0 Driver Interface for Linux
  4. *
  5. * Copyright 1999 by Carsten Paeth <calle@calle.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 __CAPILLI_H__
  12. #define __CAPILLI_H__
  13. #include <linux/kernel.h>
  14. #include <linux/list.h>
  15. #include <linux/capi.h>
  16. #include <linux/kernelcapi.h>
  17. typedef struct capiloaddatapart {
  18. int user; /* data in userspace ? */
  19. int len;
  20. unsigned char *data;
  21. } capiloaddatapart;
  22. typedef struct capiloaddata {
  23. capiloaddatapart firmware;
  24. capiloaddatapart configuration;
  25. } capiloaddata;
  26. typedef struct capicardparams {
  27. unsigned int port;
  28. unsigned irq;
  29. int cardtype;
  30. int cardnr;
  31. unsigned int membase;
  32. } capicardparams;
  33. struct capi_ctr {
  34. /* filled in before calling attach_capi_ctr */
  35. struct module *owner;
  36. void *driverdata; /* driver specific */
  37. char name[32]; /* name of controller */
  38. char *driver_name; /* name of driver */
  39. int (*load_firmware)(struct capi_ctr *, capiloaddata *);
  40. void (*reset_ctr)(struct capi_ctr *);
  41. void (*register_appl)(struct capi_ctr *, u16 appl,
  42. capi_register_params *);
  43. void (*release_appl)(struct capi_ctr *, u16 appl);
  44. u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
  45. char *(*procinfo)(struct capi_ctr *);
  46. const struct file_operations *proc_fops;
  47. /* filled in before calling ready callback */
  48. u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */
  49. capi_version version; /* CAPI_GET_VERSION */
  50. capi_profile profile; /* CAPI_GET_PROFILE */
  51. u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */
  52. /* management information for kcapi */
  53. unsigned long nrecvctlpkt;
  54. unsigned long nrecvdatapkt;
  55. unsigned long nsentctlpkt;
  56. unsigned long nsentdatapkt;
  57. int cnr; /* controller number */
  58. unsigned short state; /* controller state */
  59. int blocked; /* output blocked */
  60. int traceflag; /* capi trace */
  61. wait_queue_head_t state_wait_queue;
  62. struct proc_dir_entry *procent;
  63. char procfn[128];
  64. };
  65. int attach_capi_ctr(struct capi_ctr *);
  66. int detach_capi_ctr(struct capi_ctr *);
  67. void capi_ctr_ready(struct capi_ctr * card);
  68. void capi_ctr_down(struct capi_ctr * card);
  69. void capi_ctr_suspend_output(struct capi_ctr * card);
  70. void capi_ctr_resume_output(struct capi_ctr * card);
  71. void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
  72. // ---------------------------------------------------------------------------
  73. // needed for AVM capi drivers
  74. struct capi_driver {
  75. char name[32]; /* driver name */
  76. char revision[32];
  77. int (*add_card)(struct capi_driver *driver, capicardparams *data);
  78. /* management information for kcapi */
  79. struct list_head list;
  80. };
  81. void register_capi_driver(struct capi_driver *driver);
  82. void unregister_capi_driver(struct capi_driver *driver);
  83. // ---------------------------------------------------------------------------
  84. // library functions for use by hardware controller drivers
  85. void capilib_new_ncci(struct list_head *head, u16 applid, u32 ncci, u32 winsize);
  86. void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci);
  87. void capilib_release_appl(struct list_head *head, u16 applid);
  88. void capilib_release(struct list_head *head);
  89. void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
  90. u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
  91. #endif /* __CAPILLI_H__ */