at91_twiio.h revision 155324
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 * 13155324Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14155324Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15155324Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16155324Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17155324Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18155324Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19155324Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20155324Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21155324Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22155324Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23155324Simp * 24155324Simp * $FreeBSD: head/sys/arm/at91/at91_twiio.h 155324 2006-02-04 23:32:13Z imp $ 25155324Simp */ 26155324Simp 27155324Simp#ifndef _ARM_AT91_AT91_TWIIO_H 28155324Simp#define _ARM_AT91_AT91_TWIIO_H 29155324Simp 30155324Simp#include <sys/ioccom.h> 31155324Simp 32155324Simpstruct at91_twi_io 33155324Simp{ 34155324Simp int dadr; /* Device address */ 35155324Simp int type; /* read/write */ 36155324Simp#define TWI_IO_READ_MASTER 1 37155324Simp#define TWI_IO_WRITE_MASTER 2 38155324Simp int iadrsz; /* Internal addr size */ 39155324Simp uint32_t iadr; /* Interbak addr */ 40155324Simp size_t xfer_len; /* Size to transfer */ 41155324Simp caddr_t xfer_buf; /* buffer for xfer */ 42155324Simp}; 43155324Simp 44155324Simpstruct at91_twi_clock 45155324Simp{ 46155324Simp int ckdiv; /* Clock divider */ 47155324Simp int high_rate; /* rate of clock high period */ 48155324Simp int low_rate; /* rate of clock low period */ 49155324Simp}; 50155324Simp 51155324Simp/** TWIIOCXFER: Do a two-wire transfer 52155324Simp */ 53155324Simp#define TWIIOCXFER _IOW('x', 1, struct at91_twi_io) 54155324Simp 55155324Simp/** TWIIOCSETCLOCK: Sets the clocking parameters for this operation. 56155324Simp */ 57155324Simp#define TWIIOCSETCLOCK _IOW('x', 2, struct at91_twi_clock) 58155324Simp 59155324Simp#endif /* !_ARM_AT91_AT91_TWIIO_H */ 60155324Simp 61155324Simp 62