1155324Simp/*-
2155324Simp * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
3155324Simp *
4155324Simp * Redistribution and use in source and binary forms, with or without
5155324Simp * modification, are permitted provided that the following conditions
6155324Simp * are met:
7155324Simp * 1. Redistributions of source code must retain the above copyright
8155324Simp *    notice, this list of conditions and the following disclaimer.
9155324Simp * 2. Redistributions in binary form must reproduce the above copyright
10155324Simp *    notice, this list of conditions and the following disclaimer in the
11155324Simp *    documentation and/or other materials provided with the distribution.
12155324Simp *
13185265Simp * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14185265Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15185265Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16185265Simp * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17185265Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18185265Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19185265Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20185265Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21185265Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22185265Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23185265Simp * SUCH DAMAGE.
24155324Simp *
25155324Simp * $FreeBSD: releng/10.2/sys/arm/at91/at91_twiio.h 185265 2008-11-25 00:13:26Z imp $
26155324Simp */
27155324Simp
28155324Simp#ifndef _ARM_AT91_AT91_TWIIO_H
29155324Simp#define _ARM_AT91_AT91_TWIIO_H
30155324Simp
31155324Simp#include <sys/ioccom.h>
32155324Simp
33155324Simpstruct at91_twi_io
34155324Simp{
35155324Simp	int	dadr;			/* Device address */
36155324Simp	int	type;			/* read/write */
37155324Simp#define TWI_IO_READ_MASTER	1
38155324Simp#define TWI_IO_WRITE_MASTER	2
39155324Simp	int	iadrsz;			/* Internal addr size */
40155324Simp	uint32_t iadr;			/* Interbak addr */
41155324Simp	size_t  xfer_len;		/* Size to transfer */
42155324Simp	caddr_t xfer_buf;		/* buffer for xfer */
43155324Simp};
44155324Simp
45155324Simpstruct at91_twi_clock
46155324Simp{
47155324Simp	int	ckdiv;			/* Clock divider */
48155324Simp	int	high_rate;		/* rate of clock high period */
49155324Simp	int	low_rate;		/* rate of clock low period */
50155324Simp};
51155324Simp
52155324Simp/** TWIIOCXFER: Do a two-wire transfer
53155324Simp */
54155324Simp#define TWIIOCXFER	_IOW('x', 1, struct at91_twi_io)
55155324Simp
56155324Simp/** TWIIOCSETCLOCK: Sets the clocking parameters for this operation.
57155324Simp */
58155324Simp#define TWIIOCSETCLOCK _IOW('x', 2, struct at91_twi_clock)
59155324Simp
60155324Simp#endif /* !_ARM_AT91_AT91_TWIIO_H */
61155324Simp
62155324Simp
63