1/*-
2 * Copyright 2008-2012 - Symmetricom, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions, and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 *  $FreeBSD$
27 */
28
29/*
30 * FTDI USB serial converter chip ioctl commands.
31 */
32
33#ifndef _USB_UFTDIIO_H_
34#define _USB_UFTDIIO_H_
35
36#include <sys/ioccom.h>
37
38enum uftdi_bitmodes
39{
40	UFTDI_BITMODE_ASYNC = 0,
41	UFTDI_BITMODE_MPSSE = 1,
42	UFTDI_BITMODE_SYNC = 2,
43	UFTDI_BITMODE_CPU_EMUL = 3,
44	UFTDI_BITMODE_FAST_SERIAL = 4,
45	UFTDI_BITMODE_CBUS = 5,
46	UFTDI_BITMODE_NONE = 0xff,
47};
48
49/*
50 * For UFTDIIOC_SET_BITMODE:
51 *   mode   = One of the uftdi_bitmodes enum values.
52 *   iomask = Mask of bits enabled for bitbang output.
53 *
54 * For UFTDIIOC_GET_BITMODE:
55 *   mode   = Unused.
56 *   iomask = Returned snapshot of bitbang pin states at time of call.
57 */
58struct uftdi_bitmode
59{
60	uint8_t mode;
61	uint8_t iomask;
62};
63
64#define	UFTDIIOC_RESET_IO	_IO('c', 0)	/* Reset config, flush fifos.*/
65#define	UFTDIIOC_RESET_RX	_IO('c', 1)	/* Flush input fifo. */
66#define	UFTDIIOC_RESET_TX	_IO('c', 2)	/* Flush output fifo. */
67#define	UFTDIIOC_SET_BITMODE	_IOW('c', 3, struct uftdi_bitmode)
68#define	UFTDIIOC_GET_BITMODE	_IOR('c', 4, struct uftdi_bitmode)
69#define	UFTDIIOC_SET_ERROR_CHAR	_IOW('c', 5, int)	/* -1 to disable */
70#define	UFTDIIOC_SET_EVENT_CHAR	_IOW('c', 6, int)	/* -1 to disable */
71#define	UFTDIIOC_SET_LATENCY	_IOW('c', 7, int)	/* 1-255 ms */
72#define	UFTDIIOC_GET_LATENCY	_IOR('c', 8, int)
73#define	UFTDIIOC_GET_HWREV	_IOR('c', 9, int)
74
75#endif
76