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: head/sys/netgraph/bluetooth/include/ng_bt3c.h 139823 2005-01-07 01:45:51Z imp $
32  *
33  * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
34  *
35  * Based on information obrained from: Jose Orlando Pereira <jop@di.uminho.pt>
36  * and disassembled w2k driver.
37  *
38  * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
39  *
40  */
41 
42 #ifndef _NG_BT3C_H_
43 #define _NG_BT3C_H_
44 
45 /**************************************************************************
46  **************************************************************************
47  **     Netgraph node hook name, type name and type cookie and commands
48  **************************************************************************
49  **************************************************************************/
50 
51 #define NG_BT3C_NODE_TYPE	"btccc"	/* XXX can't use bt3c in pccard.conf */
52 #define NG_BT3C_HOOK		"hook"
53 
54 #define NGM_BT3C_COOKIE		1014752016
55 
56 /* Debug levels */
57 #define NG_BT3C_ALERT_LEVEL	1
58 #define NG_BT3C_ERR_LEVEL	2
59 #define NG_BT3C_WARN_LEVEL	3
60 #define NG_BT3C_INFO_LEVEL	4
61 
62 /* Node states */
63 #define NG_BT3C_W4_PKT_IND	1               /* wait for packet indicator */
64 #define NG_BT3C_W4_PKT_HDR	2               /* wait for packet header */
65 #define NG_BT3C_W4_PKT_DATA	3               /* wait for packet data */
66 
67 /**************************************************************************
68  **************************************************************************
69  **                    BT3C node command/event parameters
70  **************************************************************************
71  **************************************************************************/
72 
73 #define NGM_BT3C_NODE_GET_STATE	1		/* get node state */
74 typedef u_int16_t		ng_bt3c_node_state_ep;
75 
76 #define NGM_BT3C_NODE_SET_DEBUG	2		/* set debug level */
77 #define NGM_BT3C_NODE_GET_DEBUG	3		/* get debug level */
78 typedef u_int16_t		ng_bt3c_node_debug_ep;
79 
80 #define NGM_BT3C_NODE_GET_QLEN	4		/* get queue length */
81 #define NGM_BT3C_NODE_SET_QLEN	5		/* set queue length */
82 typedef struct {
83 	int32_t	queue;				/* queue index */
84 #define NGM_BT3C_NODE_IN_QUEUE	1		/* incoming queue */
85 #define NGM_BT3C_NODE_OUT_QUEUE	2		/* outgoing queue */
86 
87 	int32_t	qlen;				/* queue length */
88 } ng_bt3c_node_qlen_ep;
89 
90 #define NGM_BT3C_NODE_GET_STAT	6		/* get statistic */
91 typedef struct {
92 	u_int32_t	pckts_recv;		/* # of packets received */
93 	u_int32_t	bytes_recv;		/* # of bytes received */
94 	u_int32_t	pckts_sent;		/* # of packets sent */
95 	u_int32_t	bytes_sent;		/* # of bytes sent */
96 	u_int32_t	oerrors;		/* # of output errors */
97 	u_int32_t	ierrors;		/* # of input errors */
98 } ng_bt3c_node_stat_ep;
99 
100 #define NGM_BT3C_NODE_RESET_STAT 7		/* reset statistic */
101 
102 #define NGM_BT3C_NODE_DOWNLOAD_FIRMWARE	8	/* download firmware */
103 
104 typedef struct {
105 	u_int32_t	block_address;
106 	u_int16_t	block_size;		/* in words */
107 	u_int16_t	block_alignment;	/* in bytes */
108 } ng_bt3c_firmware_block_ep;
109 
110 #endif /* ndef _NG_BT3C_H_ */
111 
112