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