pxa2x0_i2s.h revision 1.2 1 1.2 dyoung /* $NetBSD: pxa2x0_i2s.h,v 1.2 2011/07/01 20:32:51 dyoung Exp $ */
2 1.1 peter /* $OpenBSD: pxa2x0_i2s.h,v 1.3 2006/04/04 11:45:40 pascoe Exp $ */
3 1.1 peter
4 1.1 peter /*
5 1.1 peter * Copyright (c) 2005 Uwe Stuehler <uwe (at) bsdx.de>
6 1.1 peter *
7 1.1 peter * Permission to use, copy, modify, and distribute this software for any
8 1.1 peter * purpose with or without fee is hereby granted, provided that the above
9 1.1 peter * copyright notice and this permission notice appear in all copies.
10 1.1 peter *
11 1.1 peter * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 1.1 peter * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 1.1 peter * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 1.1 peter * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 1.1 peter * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 1.1 peter * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 1.1 peter * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 1.1 peter */
19 1.1 peter
20 1.1 peter #ifndef _PXA2X0_I2S_H_
21 1.1 peter #define _PXA2X0_I2S_H_
22 1.1 peter
23 1.2 dyoung #include <sys/bus.h>
24 1.1 peter
25 1.1 peter struct pxa2x0_i2s_dma;
26 1.1 peter struct audio_params;
27 1.1 peter
28 1.1 peter struct pxa2x0_i2s_softc {
29 1.1 peter struct device sc_dev;
30 1.1 peter
31 1.1 peter bus_space_tag_t sc_iot;
32 1.1 peter bus_space_handle_t sc_ioh;
33 1.1 peter bus_size_t sc_size;
34 1.1 peter bus_dma_tag_t sc_dmat;
35 1.1 peter
36 1.1 peter int sc_open;
37 1.1 peter uint32_t sc_sadiv;
38 1.1 peter
39 1.1 peter struct pxa2x0_i2s_dma *sc_dmas;
40 1.1 peter
41 1.1 peter /* Dummy DMA segment which points to the I2S SADR */
42 1.1 peter bus_dma_segment_t sc_dr;
43 1.1 peter
44 1.1 peter /* PCM Output (Tx) state */
45 1.1 peter struct pxa2x0_i2s_dma *sc_txdma;
46 1.1 peter void (*sc_txfunc)(void *);
47 1.1 peter void *sc_txarg;
48 1.1 peter
49 1.1 peter /* PCM Input (Rx) state */
50 1.1 peter struct pxa2x0_i2s_dma *sc_rxdma;
51 1.1 peter void (*sc_rxfunc)(void *);
52 1.1 peter void *sc_rxarg;
53 1.1 peter };
54 1.1 peter
55 1.1 peter void pxa2x0_i2s_init(struct pxa2x0_i2s_softc *sc);
56 1.1 peter int pxa2x0_i2s_attach_sub(struct pxa2x0_i2s_softc *);
57 1.1 peter int pxa2x0_i2s_detach_sub(struct pxa2x0_i2s_softc *);
58 1.1 peter void pxa2x0_i2s_open(struct pxa2x0_i2s_softc *);
59 1.1 peter void pxa2x0_i2s_close(struct pxa2x0_i2s_softc *);
60 1.1 peter void pxa2x0_i2s_write(struct pxa2x0_i2s_softc *, u_int32_t);
61 1.1 peter
62 1.1 peter void pxa2x0_i2s_setspeed(struct pxa2x0_i2s_softc *, u_int *);
63 1.1 peter
64 1.1 peter void * pxa2x0_i2s_allocm(void *, int, size_t, struct malloc_type *, int);
65 1.1 peter void pxa2x0_i2s_freem(void *, void *, struct malloc_type *);
66 1.1 peter paddr_t pxa2x0_i2s_mappage(void *, void *, off_t, int);
67 1.1 peter int pxa2x0_i2s_round_blocksize(void *, int, int, const struct audio_params *);
68 1.1 peter size_t pxa2x0_i2s_round_buffersize(void *, int, size_t);
69 1.1 peter int pxa2x0_i2s_halt_output(void *);
70 1.1 peter int pxa2x0_i2s_halt_input(void *);
71 1.1 peter int pxa2x0_i2s_start_output(void *, void *, int, void (*)(void *), void *);
72 1.1 peter int pxa2x0_i2s_start_input(void *, void *, int, void (*)(void *), void *);
73 1.1 peter
74 1.1 peter #endif
75