1107120Sjulian/*
2107120Sjulian * ng_bt3c.h
3139823Simp */
4139823Simp
5139823Simp/*-
6107120Sjulian * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7107120Sjulian * All rights reserved.
8107120Sjulian *
9107120Sjulian * Redistribution and use in source and binary forms, with or without
10107120Sjulian * modification, are permitted provided that the following conditions
11107120Sjulian * are met:
12107120Sjulian * 1. Redistributions of source code must retain the above copyright
13107120Sjulian *    notice, this list of conditions and the following disclaimer.
14107120Sjulian * 2. Redistributions in binary form must reproduce the above copyright
15107120Sjulian *    notice, this list of conditions and the following disclaimer in the
16107120Sjulian *    documentation and/or other materials provided with the distribution.
17107120Sjulian *
18107120Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19107120Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20107120Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21107120Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22107120Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23107120Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24107120Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25107120Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26107120Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27107120Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28107120Sjulian * SUCH DAMAGE.
29107120Sjulian *
30114878Sjulian * $Id: ng_bt3c.h,v 1.1 2002/11/24 19:47:05 max Exp $
31107120Sjulian * $FreeBSD$
32107120Sjulian *
33107120Sjulian * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
34107120Sjulian *
35107120Sjulian * Based on information obrained from: Jose Orlando Pereira <jop@di.uminho.pt>
36107120Sjulian * and disassembled w2k driver.
37107120Sjulian *
38107120Sjulian * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
39107120Sjulian *
40107120Sjulian */
41107120Sjulian
42107120Sjulian#ifndef _NG_BT3C_H_
43107120Sjulian#define _NG_BT3C_H_
44107120Sjulian
45107120Sjulian/**************************************************************************
46107120Sjulian **************************************************************************
47107120Sjulian **     Netgraph node hook name, type name and type cookie and commands
48107120Sjulian **************************************************************************
49107120Sjulian **************************************************************************/
50107120Sjulian
51107120Sjulian#define NG_BT3C_NODE_TYPE	"btccc"	/* XXX can't use bt3c in pccard.conf */
52107120Sjulian#define NG_BT3C_HOOK		"hook"
53107120Sjulian
54107120Sjulian#define NGM_BT3C_COOKIE		1014752016
55107120Sjulian
56107120Sjulian/* Debug levels */
57107120Sjulian#define NG_BT3C_ALERT_LEVEL	1
58107120Sjulian#define NG_BT3C_ERR_LEVEL	2
59107120Sjulian#define NG_BT3C_WARN_LEVEL	3
60107120Sjulian#define NG_BT3C_INFO_LEVEL	4
61107120Sjulian
62107120Sjulian/* Node states */
63107120Sjulian#define NG_BT3C_W4_PKT_IND	1               /* wait for packet indicator */
64107120Sjulian#define NG_BT3C_W4_PKT_HDR	2               /* wait for packet header */
65107120Sjulian#define NG_BT3C_W4_PKT_DATA	3               /* wait for packet data */
66107120Sjulian
67107120Sjulian/**************************************************************************
68107120Sjulian **************************************************************************
69107120Sjulian **                    BT3C node command/event parameters
70107120Sjulian **************************************************************************
71107120Sjulian **************************************************************************/
72107120Sjulian
73107120Sjulian#define NGM_BT3C_NODE_GET_STATE	1		/* get node state */
74107120Sjuliantypedef u_int16_t		ng_bt3c_node_state_ep;
75107120Sjulian
76107120Sjulian#define NGM_BT3C_NODE_SET_DEBUG	2		/* set debug level */
77107120Sjulian#define NGM_BT3C_NODE_GET_DEBUG	3		/* get debug level */
78107120Sjuliantypedef u_int16_t		ng_bt3c_node_debug_ep;
79107120Sjulian
80107120Sjulian#define NGM_BT3C_NODE_GET_QLEN	4		/* get queue length */
81107120Sjulian#define NGM_BT3C_NODE_SET_QLEN	5		/* set queue length */
82107120Sjuliantypedef struct {
83107120Sjulian	int32_t	queue;				/* queue index */
84107120Sjulian#define NGM_BT3C_NODE_IN_QUEUE	1		/* incoming queue */
85107120Sjulian#define NGM_BT3C_NODE_OUT_QUEUE	2		/* outgoing queue */
86107120Sjulian
87107120Sjulian	int32_t	qlen;				/* queue length */
88107120Sjulian} ng_bt3c_node_qlen_ep;
89107120Sjulian
90107120Sjulian#define NGM_BT3C_NODE_GET_STAT	6		/* get statistic */
91107120Sjuliantypedef struct {
92107120Sjulian	u_int32_t	pckts_recv;		/* # of packets received */
93107120Sjulian	u_int32_t	bytes_recv;		/* # of bytes received */
94107120Sjulian	u_int32_t	pckts_sent;		/* # of packets sent */
95107120Sjulian	u_int32_t	bytes_sent;		/* # of bytes sent */
96107120Sjulian	u_int32_t	oerrors;		/* # of output errors */
97107120Sjulian	u_int32_t	ierrors;		/* # of input errors */
98107120Sjulian} ng_bt3c_node_stat_ep;
99107120Sjulian
100107120Sjulian#define NGM_BT3C_NODE_RESET_STAT 7		/* reset statistic */
101107120Sjulian
102107120Sjulian#define NGM_BT3C_NODE_DOWNLOAD_FIRMWARE	8	/* download firmware */
103107120Sjulian
104107120Sjuliantypedef struct {
105107120Sjulian	u_int32_t	block_address;
106107120Sjulian	u_int16_t	block_size;		/* in words */
107107120Sjulian	u_int16_t	block_alignment;	/* in bytes */
108107120Sjulian} ng_bt3c_firmware_block_ep;
109107120Sjulian
110107120Sjulian#endif /* ndef _NG_BT3C_H_ */
111107120Sjulian
112