]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/mISDNif.h
mISDN: Add ISDN sample clock API to mISDN core
[linux-2.6-omap-h63xx.git] / include / linux / mISDNif.h
index 5c948f337817da7bb1386826d84f4e9f52e3d49a..364f1018f0d124b8dec8600b16dd2999cd9b5079 100644 (file)
@@ -36,8 +36,8 @@
  *              - should be incremented on every checkin
  */
 #define        MISDN_MAJOR_VERSION     1
-#define        MISDN_MINOR_VERSION     0
-#define MISDN_RELEASE          18
+#define        MISDN_MINOR_VERSION     1
+#define MISDN_RELEASE          20
 
 /* primitives for information exchange
  * generell format
@@ -80,6 +80,7 @@
 #define PH_DEACTIVATE_IND      0x0202
 #define PH_DEACTIVATE_CNF      0x4202
 #define PH_DATA_IND            0x2002
+#define PH_DATA_E_IND          0x3002
 #define MPH_ACTIVATE_IND       0x0502
 #define MPH_DEACTIVATE_IND     0x0602
 #define MPH_INFORMATION_IND    0x0702
@@ -242,7 +243,8 @@ struct mISDNhead {
 #define TEI_SAPI               63
 #define CTRL_SAPI              0
 
-#define MISDN_CHMAP_SIZE       4
+#define MISDN_MAX_CHANNEL      127
+#define MISDN_CHMAP_SIZE       ((MISDN_MAX_CHANNEL + 1) >> 3)
 
 #define SOL_MISDN      0
 
@@ -254,16 +256,6 @@ struct sockaddr_mISDN {
        unsigned char   tei;
 };
 
-/* timer device ioctl */
-#define IMADDTIMER     _IOR('I', 64, int)
-#define IMDELTIMER     _IOR('I', 65, int)
-/* socket ioctls */
-#define        IMGETVERSION    _IOR('I', 66, int)
-#define        IMGETCOUNT      _IOR('I', 67, int)
-#define IMGETDEVINFO   _IOR('I', 68, int)
-#define IMCTRLREQ      _IOR('I', 69, int)
-#define IMCLEAR_L2     _IOR('I', 70, int)
-
 struct mISDNversion {
        unsigned char   major;
        unsigned char   minor;
@@ -275,11 +267,49 @@ struct mISDN_devinfo {
        u_int                   Dprotocols;
        u_int                   Bprotocols;
        u_int                   protocol;
-       u_long                  channelmap[MISDN_CHMAP_SIZE];
+       u_char                  channelmap[MISDN_CHMAP_SIZE];
        u_int                   nrbchan;
        char                    name[MISDN_MAX_IDLEN];
 };
 
+struct mISDN_devrename {
+       u_int                   id;
+       char                    name[MISDN_MAX_IDLEN]; /* new name */
+};
+
+/* timer device ioctl */
+#define IMADDTIMER     _IOR('I', 64, int)
+#define IMDELTIMER     _IOR('I', 65, int)
+
+/* socket ioctls */
+#define        IMGETVERSION    _IOR('I', 66, int)
+#define        IMGETCOUNT      _IOR('I', 67, int)
+#define IMGETDEVINFO   _IOR('I', 68, int)
+#define IMCTRLREQ      _IOR('I', 69, int)
+#define IMCLEAR_L2     _IOR('I', 70, int)
+#define IMSETDEVNAME   _IOR('I', 71, struct mISDN_devrename)
+
+static inline int
+test_channelmap(u_int nr, u_char *map)
+{
+       if (nr <= MISDN_MAX_CHANNEL)
+               return map[nr >> 3] & (1 << (nr & 7));
+       else
+               return 0;
+}
+
+static inline void
+set_channelmap(u_int nr, u_char *map)
+{
+       map[nr >> 3] |= (1 << (nr & 7));
+}
+
+static inline void
+clear_channelmap(u_int nr, u_char *map)
+{
+       map[nr >> 3] &= ~(1 << (nr & 7));
+}
+
 /* CONTROL_CHANNEL parameters */
 #define MISDN_CTRL_GETOP               0x0000
 #define MISDN_CTRL_LOOP                        0x0001
@@ -290,6 +320,7 @@ struct mISDN_devinfo {
 #define MISDN_CTRL_SETPEER             0x0040
 #define MISDN_CTRL_UNSETPEER           0x0080
 #define MISDN_CTRL_RX_OFF              0x0100
+#define MISDN_CTRL_FILL_EMPTY          0x0200
 #define MISDN_CTRL_HW_FEATURES_OP      0x2000
 #define MISDN_CTRL_HW_FEATURES         0x2001
 #define MISDN_CTRL_HFC_OP              0x4000
@@ -340,6 +371,7 @@ struct mISDN_ctrl_req {
 #define DEBUG_L2_TEI           0x00100000
 #define DEBUG_L2_TEIFSM                0x00200000
 #define DEBUG_TIMER            0x01000000
+#define DEBUG_CLOCK            0x02000000
 
 #define mISDN_HEAD_P(s)                ((struct mISDNhead *)&s->cb[0])
 #define mISDN_HEAD_PRIM(s)     (((struct mISDNhead *)&s->cb[0])->prim)
@@ -353,6 +385,7 @@ struct mISDN_ctrl_req {
 struct mISDNchannel;
 struct mISDNdevice;
 struct mISDNstack;
+struct mISDNclock;
 
 struct channel_req {
        u_int                   protocol;
@@ -401,11 +434,10 @@ struct mISDN_sock {
 struct mISDNdevice {
        struct mISDNchannel     D;
        u_int                   id;
-       char                    name[MISDN_MAX_IDLEN];
        u_int                   Dprotocols;
        u_int                   Bprotocols;
        u_int                   nrbchan;
-       u_long                  channelmap[MISDN_CHMAP_SIZE];
+       u_char                  channelmap[MISDN_CHMAP_SIZE];
        struct list_head        bchannels;
        struct mISDNchannel     *teimgr;
        struct device           dev;
@@ -430,7 +462,17 @@ struct mISDNstack {
 #endif
 };
 
-/* global alloc/queue dunctions */
+typedef        int     (clockctl_func_t)(void *, int);
+
+struct mISDNclock {
+       struct list_head        list;
+       char                    name[64];
+       int                     pri;
+       clockctl_func_t         *ctl;
+       void                    *priv;
+};
+
+/* global alloc/queue functions */
 
 static inline struct sk_buff *
 mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
@@ -480,8 +522,13 @@ extern int mISDN_register_device(struct mISDNdevice *, char *name);
 extern void    mISDN_unregister_device(struct mISDNdevice *);
 extern int     mISDN_register_Bprotocol(struct Bprotocol *);
 extern void    mISDN_unregister_Bprotocol(struct Bprotocol *);
+extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
+                                               void *);
+extern void    mISDN_unregister_clock(struct mISDNclock *);
 
 extern void    set_channel_address(struct mISDNchannel *, u_int, u_int);
+extern void    mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
+extern unsigned short mISDN_clock_get(void);
 
 #endif /* __KERNEL__ */
 #endif /* mISDNIF_H */