include/linux/mISDNif.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
    34  *
    34  *
    35  * <16 bit> Release number
    35  * <16 bit> Release number
    36  *              - should be incremented on every checkin
    36  *              - should be incremented on every checkin
    37  */
    37  */
    38 #define	MISDN_MAJOR_VERSION	1
    38 #define	MISDN_MAJOR_VERSION	1
    39 #define	MISDN_MINOR_VERSION	0
    39 #define	MISDN_MINOR_VERSION	1
    40 #define MISDN_RELEASE		19
    40 #define MISDN_RELEASE		20
    41 
    41 
    42 /* primitives for information exchange
    42 /* primitives for information exchange
    43  * generell format
    43  * generell format
    44  * <16  bit  0 >
    44  * <16  bit  0 >
    45  * <8  bit command>
    45  * <8  bit command>
    78 #define PH_ACTIVATE_IND		0x0102
    78 #define PH_ACTIVATE_IND		0x0102
    79 #define PH_ACTIVATE_CNF		0x4102
    79 #define PH_ACTIVATE_CNF		0x4102
    80 #define PH_DEACTIVATE_IND	0x0202
    80 #define PH_DEACTIVATE_IND	0x0202
    81 #define PH_DEACTIVATE_CNF	0x4202
    81 #define PH_DEACTIVATE_CNF	0x4202
    82 #define PH_DATA_IND		0x2002
    82 #define PH_DATA_IND		0x2002
       
    83 #define PH_DATA_E_IND		0x3002
    83 #define MPH_ACTIVATE_IND	0x0502
    84 #define MPH_ACTIVATE_IND	0x0502
    84 #define MPH_DEACTIVATE_IND	0x0602
    85 #define MPH_DEACTIVATE_IND	0x0602
    85 #define MPH_INFORMATION_IND	0x0702
    86 #define MPH_INFORMATION_IND	0x0702
    86 #define PH_DATA_CNF		0x6002
    87 #define PH_DATA_CNF		0x6002
    87 #define PH_CONTROL_IND		0x0802
    88 #define PH_CONTROL_IND		0x0802
   197 #define ISDN_P_BASE		0
   198 #define ISDN_P_BASE		0
   198 #define ISDN_P_TE_S0		0x01
   199 #define ISDN_P_TE_S0		0x01
   199 #define ISDN_P_NT_S0  		0x02
   200 #define ISDN_P_NT_S0  		0x02
   200 #define ISDN_P_TE_E1		0x03
   201 #define ISDN_P_TE_E1		0x03
   201 #define ISDN_P_NT_E1  		0x04
   202 #define ISDN_P_NT_E1  		0x04
       
   203 #define ISDN_P_TE_UP0		0x05
       
   204 #define ISDN_P_NT_UP0		0x06
       
   205 
       
   206 #define IS_ISDN_P_TE(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_TE_E1) || \
       
   207 				(p == ISDN_P_TE_UP0) || (p == ISDN_P_LAPD_TE))
       
   208 #define IS_ISDN_P_NT(p) ((p == ISDN_P_NT_S0) || (p == ISDN_P_NT_E1) || \
       
   209 				(p == ISDN_P_NT_UP0) || (p == ISDN_P_LAPD_NT))
       
   210 #define IS_ISDN_P_S0(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_NT_S0))
       
   211 #define IS_ISDN_P_E1(p) ((p == ISDN_P_TE_E1) || (p == ISDN_P_NT_E1))
       
   212 #define IS_ISDN_P_UP0(p) ((p == ISDN_P_TE_UP0) || (p == ISDN_P_NT_UP0))
       
   213 
       
   214 
   202 #define ISDN_P_LAPD_TE		0x10
   215 #define ISDN_P_LAPD_TE		0x10
   203 #define	ISDN_P_LAPD_NT		0x11
   216 #define	ISDN_P_LAPD_NT		0x11
   204 
   217 
   205 #define ISDN_P_B_MASK		0x1f
   218 #define ISDN_P_B_MASK		0x1f
   206 #define ISDN_P_B_START		0x20
   219 #define ISDN_P_B_START		0x20
   252 	unsigned char	dev;
   265 	unsigned char	dev;
   253 	unsigned char	channel;
   266 	unsigned char	channel;
   254 	unsigned char	sapi;
   267 	unsigned char	sapi;
   255 	unsigned char	tei;
   268 	unsigned char	tei;
   256 };
   269 };
   257 
       
   258 /* timer device ioctl */
       
   259 #define IMADDTIMER	_IOR('I', 64, int)
       
   260 #define IMDELTIMER	_IOR('I', 65, int)
       
   261 /* socket ioctls */
       
   262 #define	IMGETVERSION	_IOR('I', 66, int)
       
   263 #define	IMGETCOUNT	_IOR('I', 67, int)
       
   264 #define IMGETDEVINFO	_IOR('I', 68, int)
       
   265 #define IMCTRLREQ	_IOR('I', 69, int)
       
   266 #define IMCLEAR_L2	_IOR('I', 70, int)
       
   267 
   270 
   268 struct mISDNversion {
   271 struct mISDNversion {
   269 	unsigned char	major;
   272 	unsigned char	major;
   270 	unsigned char	minor;
   273 	unsigned char	minor;
   271 	unsigned short	release;
   274 	unsigned short	release;
   278 	u_int			protocol;
   281 	u_int			protocol;
   279 	u_char			channelmap[MISDN_CHMAP_SIZE];
   282 	u_char			channelmap[MISDN_CHMAP_SIZE];
   280 	u_int			nrbchan;
   283 	u_int			nrbchan;
   281 	char			name[MISDN_MAX_IDLEN];
   284 	char			name[MISDN_MAX_IDLEN];
   282 };
   285 };
       
   286 
       
   287 struct mISDN_devrename {
       
   288 	u_int			id;
       
   289 	char			name[MISDN_MAX_IDLEN]; /* new name */
       
   290 };
       
   291 
       
   292 /* MPH_INFORMATION_REQ payload */
       
   293 struct ph_info_ch {
       
   294         __u32 protocol;
       
   295         __u64 Flags;
       
   296 };
       
   297 
       
   298 struct ph_info_dch {
       
   299         struct ph_info_ch ch;
       
   300         __u16 state;
       
   301         __u16 num_bch;
       
   302 };
       
   303 
       
   304 struct ph_info {
       
   305         struct ph_info_dch dch;
       
   306         struct ph_info_ch  bch[];
       
   307 };
       
   308 
       
   309 /* timer device ioctl */
       
   310 #define IMADDTIMER	_IOR('I', 64, int)
       
   311 #define IMDELTIMER	_IOR('I', 65, int)
       
   312 
       
   313 /* socket ioctls */
       
   314 #define	IMGETVERSION	_IOR('I', 66, int)
       
   315 #define	IMGETCOUNT	_IOR('I', 67, int)
       
   316 #define IMGETDEVINFO	_IOR('I', 68, int)
       
   317 #define IMCTRLREQ	_IOR('I', 69, int)
       
   318 #define IMCLEAR_L2	_IOR('I', 70, int)
       
   319 #define IMSETDEVNAME	_IOR('I', 71, struct mISDN_devrename)
   283 
   320 
   284 static inline int
   321 static inline int
   285 test_channelmap(u_int nr, u_char *map)
   322 test_channelmap(u_int nr, u_char *map)
   286 {
   323 {
   287 	if (nr <= MISDN_MAX_CHANNEL)
   324 	if (nr <= MISDN_MAX_CHANNEL)
   310 #define MISDN_CTRL_PCMCONNECT		0x0010
   347 #define MISDN_CTRL_PCMCONNECT		0x0010
   311 #define MISDN_CTRL_PCMDISCONNECT	0x0020
   348 #define MISDN_CTRL_PCMDISCONNECT	0x0020
   312 #define MISDN_CTRL_SETPEER		0x0040
   349 #define MISDN_CTRL_SETPEER		0x0040
   313 #define MISDN_CTRL_UNSETPEER		0x0080
   350 #define MISDN_CTRL_UNSETPEER		0x0080
   314 #define MISDN_CTRL_RX_OFF		0x0100
   351 #define MISDN_CTRL_RX_OFF		0x0100
       
   352 #define MISDN_CTRL_FILL_EMPTY		0x0200
       
   353 #define MISDN_CTRL_GETPEER		0x0400
   315 #define MISDN_CTRL_HW_FEATURES_OP	0x2000
   354 #define MISDN_CTRL_HW_FEATURES_OP	0x2000
   316 #define MISDN_CTRL_HW_FEATURES		0x2001
   355 #define MISDN_CTRL_HW_FEATURES		0x2001
   317 #define MISDN_CTRL_HFC_OP		0x4000
   356 #define MISDN_CTRL_HFC_OP		0x4000
   318 #define MISDN_CTRL_HFC_PCM_CONN		0x4001
   357 #define MISDN_CTRL_HFC_PCM_CONN		0x4001
   319 #define MISDN_CTRL_HFC_PCM_DISC		0x4002
   358 #define MISDN_CTRL_HFC_PCM_DISC		0x4002
   360 #define DEBUG_L2_CTRL		0x00040000
   399 #define DEBUG_L2_CTRL		0x00040000
   361 #define DEBUG_L2_RECV		0x00080000
   400 #define DEBUG_L2_RECV		0x00080000
   362 #define DEBUG_L2_TEI		0x00100000
   401 #define DEBUG_L2_TEI		0x00100000
   363 #define DEBUG_L2_TEIFSM		0x00200000
   402 #define DEBUG_L2_TEIFSM		0x00200000
   364 #define DEBUG_TIMER		0x01000000
   403 #define DEBUG_TIMER		0x01000000
       
   404 #define DEBUG_CLOCK		0x02000000
   365 
   405 
   366 #define mISDN_HEAD_P(s)		((struct mISDNhead *)&s->cb[0])
   406 #define mISDN_HEAD_P(s)		((struct mISDNhead *)&s->cb[0])
   367 #define mISDN_HEAD_PRIM(s)	(((struct mISDNhead *)&s->cb[0])->prim)
   407 #define mISDN_HEAD_PRIM(s)	(((struct mISDNhead *)&s->cb[0])->prim)
   368 #define mISDN_HEAD_ID(s)	(((struct mISDNhead *)&s->cb[0])->id)
   408 #define mISDN_HEAD_ID(s)	(((struct mISDNhead *)&s->cb[0])->id)
   369 
   409 
   373 #define MISDN_CLOSED	3
   413 #define MISDN_CLOSED	3
   374 
   414 
   375 struct mISDNchannel;
   415 struct mISDNchannel;
   376 struct mISDNdevice;
   416 struct mISDNdevice;
   377 struct mISDNstack;
   417 struct mISDNstack;
       
   418 struct mISDNclock;
   378 
   419 
   379 struct channel_req {
   420 struct channel_req {
   380 	u_int			protocol;
   421 	u_int			protocol;
   381 	struct sockaddr_mISDN	adr;
   422 	struct sockaddr_mISDN	adr;
   382 	struct mISDNchannel	*ch;
   423 	struct mISDNchannel	*ch;
   421 
   462 
   422 
   463 
   423 struct mISDNdevice {
   464 struct mISDNdevice {
   424 	struct mISDNchannel	D;
   465 	struct mISDNchannel	D;
   425 	u_int			id;
   466 	u_int			id;
   426 	char			name[MISDN_MAX_IDLEN];
       
   427 	u_int			Dprotocols;
   467 	u_int			Dprotocols;
   428 	u_int			Bprotocols;
   468 	u_int			Bprotocols;
   429 	u_int			nrbchan;
   469 	u_int			nrbchan;
   430 	u_char			channelmap[MISDN_CHMAP_SIZE];
   470 	u_char			channelmap[MISDN_CHMAP_SIZE];
   431 	struct list_head	bchannels;
   471 	struct list_head	bchannels;
   450 	u_int			sleep_cnt;
   490 	u_int			sleep_cnt;
   451 	u_int			stopped_cnt;
   491 	u_int			stopped_cnt;
   452 #endif
   492 #endif
   453 };
   493 };
   454 
   494 
       
   495 typedef	int	(clockctl_func_t)(void *, int);
       
   496 
       
   497 struct	mISDNclock {
       
   498 	struct list_head	list;
       
   499 	char			name[64];
       
   500 	int			pri;
       
   501 	clockctl_func_t		*ctl;
       
   502 	void			*priv;
       
   503 };
       
   504 
   455 /* global alloc/queue functions */
   505 /* global alloc/queue functions */
   456 
   506 
   457 static inline struct sk_buff *
   507 static inline struct sk_buff *
   458 mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
   508 mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
   459 {
   509 {
   496 		dev_kfree_skb(skb);
   546 		dev_kfree_skb(skb);
   497 }
   547 }
   498 
   548 
   499 /* global register/unregister functions */
   549 /* global register/unregister functions */
   500 
   550 
   501 extern int	mISDN_register_device(struct mISDNdevice *, char *name);
   551 extern int	mISDN_register_device(struct mISDNdevice *,
       
   552 					struct device *parent, char *name);
   502 extern void	mISDN_unregister_device(struct mISDNdevice *);
   553 extern void	mISDN_unregister_device(struct mISDNdevice *);
   503 extern int	mISDN_register_Bprotocol(struct Bprotocol *);
   554 extern int	mISDN_register_Bprotocol(struct Bprotocol *);
   504 extern void	mISDN_unregister_Bprotocol(struct Bprotocol *);
   555 extern void	mISDN_unregister_Bprotocol(struct Bprotocol *);
       
   556 extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
       
   557 						void *);
       
   558 extern void	mISDN_unregister_clock(struct mISDNclock *);
       
   559 
       
   560 static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
       
   561 {
       
   562 	if (dev)
       
   563 		return dev_get_drvdata(dev);
       
   564 	else
       
   565 		return NULL;
       
   566 }
   505 
   567 
   506 extern void	set_channel_address(struct mISDNchannel *, u_int, u_int);
   568 extern void	set_channel_address(struct mISDNchannel *, u_int, u_int);
       
   569 extern void	mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
       
   570 extern unsigned short mISDN_clock_get(void);
   507 
   571 
   508 #endif /* __KERNEL__ */
   572 #endif /* __KERNEL__ */
   509 #endif /* mISDNIF_H */
   573 #endif /* mISDNIF_H */