1 /*
2  * ng_bt3c.h
3  */
4 
5 /*-
6  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $Id: ng_bt3c.h,v 1.1 2002/11/24 19:47:05 max Exp $
31  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_bt3c.h,v 1.4 2005/01/07 01:45:43 imp Exp $
32  * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_bt3c.h,v 1.2 2008/06/26 23:05:40 dillon Exp $
33  *
34  * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
35  *
36  * Based on information obrained from: Jose Orlando Pereira <jop@di.uminho.pt>
37  * and disassembled w2k driver.
38  *
39  * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
40  *
41  */
42 
43 #ifndef _NG_BT3C_H_
44 #define _NG_BT3C_H_
45 
46 /**************************************************************************
47  **************************************************************************
48  **     Netgraph node hook name, type name and type cookie and commands
49  **************************************************************************
50  **************************************************************************/
51 
52 #define NG_BT3C_NODE_TYPE	"btccc"	/* XXX can't use bt3c in pccard.conf */
53 #define NG_BT3C_HOOK		"hook"
54 
55 #define NGM_BT3C_COOKIE		1014752016
56 
57 /* Debug levels */
58 #define NG_BT3C_ALERT_LEVEL	1
59 #define NG_BT3C_ERR_LEVEL	2
60 #define NG_BT3C_WARN_LEVEL	3
61 #define NG_BT3C_INFO_LEVEL	4
62 
63 /* Node states */
64 #define NG_BT3C_W4_PKT_IND	1               /* wait for packet indicator */
65 #define NG_BT3C_W4_PKT_HDR	2               /* wait for packet header */
66 #define NG_BT3C_W4_PKT_DATA	3               /* wait for packet data */
67 
68 /**************************************************************************
69  **************************************************************************
70  **                    BT3C node command/event parameters
71  **************************************************************************
72  **************************************************************************/
73 
74 #define NGM_BT3C_NODE_GET_STATE	1		/* get node state */
75 typedef u_int16_t		ng_bt3c_node_state_ep;
76 
77 #define NGM_BT3C_NODE_SET_DEBUG	2		/* set debug level */
78 #define NGM_BT3C_NODE_GET_DEBUG	3		/* get debug level */
79 typedef u_int16_t		ng_bt3c_node_debug_ep;
80 
81 #define NGM_BT3C_NODE_GET_QLEN	4		/* get queue length */
82 #define NGM_BT3C_NODE_SET_QLEN	5		/* set queue length */
83 typedef struct {
84 	int32_t	queue;				/* queue index */
85 #define NGM_BT3C_NODE_IN_QUEUE	1		/* incoming queue */
86 #define NGM_BT3C_NODE_OUT_QUEUE	2		/* outgoing queue */
87 
88 	int32_t	qlen;				/* queue length */
89 } ng_bt3c_node_qlen_ep;
90 
91 #define NGM_BT3C_NODE_GET_STAT	6		/* get statistic */
92 typedef struct {
93 	u_int32_t	pckts_recv;		/* # of packets received */
94 	u_int32_t	bytes_recv;		/* # of bytes received */
95 	u_int32_t	pckts_sent;		/* # of packets sent */
96 	u_int32_t	bytes_sent;		/* # of bytes sent */
97 	u_int32_t	oerrors;		/* # of output errors */
98 	u_int32_t	ierrors;		/* # of input errors */
99 } ng_bt3c_node_stat_ep;
100 
101 #define NGM_BT3C_NODE_RESET_STAT 7		/* reset statistic */
102 
103 #define NGM_BT3C_NODE_DOWNLOAD_FIRMWARE	8	/* download firmware */
104 
105 typedef struct {
106 	u_int32_t	block_address;
107 	u_int16_t	block_size;		/* in words */
108 	u_int16_t	block_alignment;	/* in bytes */
109 } ng_bt3c_firmware_block_ep;
110 
111 #endif /* ndef _NG_BT3C_H_ */
112 
113