at91spivar.h revision 1.2 1 1.2 matt /* $NetBSD: at91spivar.h,v 1.2 2008/07/03 01:15:38 matt Exp $ */
2 1.2 matt
3 1.2 matt /*-
4 1.2 matt * Copyright (c) 2007 Embedtronics Oy.
5 1.2 matt * All rights reserved.
6 1.2 matt *
7 1.2 matt * Redistribution and use in source and binary forms, with or
8 1.2 matt * without modification, are permitted provided that the following
9 1.2 matt * conditions are met:
10 1.2 matt * 1. Redistributions of source code must retain the above copyright
11 1.2 matt * notice, this list of conditions and the following disclaimer.
12 1.2 matt * 2. Redistributions in binary form must reproduce the above
13 1.2 matt * copyright notice, this list of conditions and the following
14 1.2 matt * disclaimer in the documentation and/or other materials provided
15 1.2 matt * with the distribution.
16 1.2 matt * 3. All advertising materials mentioning features or use of this
17 1.2 matt * software must display the following acknowledgements:
18 1.2 matt * This product includes software developed by the Urbana-Champaign
19 1.2 matt * Independent Media Center.
20 1.2 matt * This product includes software developed by Garrett D'Amore.
21 1.2 matt * 4. Urbana-Champaign Independent Media Center's name and Garrett
22 1.2 matt * D'Amore's name may not be used to endorse or promote products
23 1.2 matt * derived from this software without specific prior written permission.
24 1.2 matt *
25 1.2 matt * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT
26 1.2 matt * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR
27 1.2 matt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 1.2 matt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.2 matt * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
30 1.2 matt * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
31 1.2 matt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 1.2 matt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 1.2 matt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 1.2 matt * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 1.2 matt * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.2 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37 1.2 matt * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 1.2 matt */
39 1.2 matt
40 1.2 matt #ifndef _AT91SPIVAR_H_
41 1.2 matt #define _AT91SPIVAR_H_
42 1.2 matt
43 1.2 matt #include <dev/spi/spivar.h>
44 1.2 matt
45 1.2 matt struct at91spi_machdep {
46 1.2 matt int (*select_slave)(void *self, int);
47 1.2 matt };
48 1.2 matt
49 1.2 matt typedef const struct at91spi_machdep *at91spi_machdep_tag_t;
50 1.2 matt
51 1.2 matt struct at91spi_softc {
52 1.2 matt device_t sc_dev;
53 1.2 matt bus_space_tag_t sc_iot;
54 1.2 matt bus_space_handle_t sc_ioh;
55 1.2 matt
56 1.2 matt bus_dma_tag_t sc_dmat;
57 1.2 matt
58 1.2 matt int sc_pid; /* peripheral identifier */
59 1.2 matt struct spi_controller sc_spi; /* SPI implementation ops */
60 1.2 matt at91spi_machdep_tag_t sc_md; /* board-specific support */
61 1.2 matt struct at91spi_job *sc_job; /* current job */
62 1.2 matt struct spi_chunk *sc_wchunk;
63 1.2 matt struct spi_chunk *sc_rchunk;
64 1.2 matt void *sc_ih; /* interrupt handler (what?) */
65 1.2 matt
66 1.2 matt void *sc_dmapage;
67 1.2 matt bus_addr_t sc_dmaaddr;
68 1.2 matt bus_dmamap_t sc_dmamap;
69 1.2 matt int sc_dmaoffs; /* current dma offset */
70 1.2 matt
71 1.2 matt struct spi_transfer *sc_transfer;
72 1.2 matt bool sc_running; /* is it processing stuff? */
73 1.2 matt
74 1.2 matt SIMPLEQ_HEAD(,spi_transfer) sc_q;
75 1.2 matt };
76 1.2 matt
77 1.2 matt void at91spi_attach_common(device_t parent, device_t self, void *aux,
78 1.2 matt at91spi_machdep_tag_t md);
79 1.2 matt
80 1.2 matt #endif /* _AT91SPIVAR_H_ */
81