pxa2x0_i2s.h revision 1.3 1 1.3 jmcneill /* $NetBSD: pxa2x0_i2s.h,v 1.3 2011/11/23 23:07:29 jmcneill 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.3 jmcneill kmutex_t *sc_intr_lock;
31 1.1 peter
32 1.1 peter bus_space_tag_t sc_iot;
33 1.1 peter bus_space_handle_t sc_ioh;
34 1.1 peter bus_size_t sc_size;
35 1.1 peter bus_dma_tag_t sc_dmat;
36 1.1 peter
37 1.1 peter int sc_open;
38 1.1 peter uint32_t sc_sadiv;
39 1.1 peter
40 1.1 peter struct pxa2x0_i2s_dma *sc_dmas;
41 1.1 peter
42 1.1 peter /* Dummy DMA segment which points to the I2S SADR */
43 1.1 peter bus_dma_segment_t sc_dr;
44 1.1 peter
45 1.1 peter /* PCM Output (Tx) state */
46 1.1 peter struct pxa2x0_i2s_dma *sc_txdma;
47 1.1 peter void (*sc_txfunc)(void *);
48 1.1 peter void *sc_txarg;
49 1.1 peter
50 1.1 peter /* PCM Input (Rx) state */
51 1.1 peter struct pxa2x0_i2s_dma *sc_rxdma;
52 1.1 peter void (*sc_rxfunc)(void *);
53 1.1 peter void *sc_rxarg;
54 1.1 peter };
55 1.1 peter
56 1.1 peter void pxa2x0_i2s_init(struct pxa2x0_i2s_softc *sc);
57 1.1 peter int pxa2x0_i2s_attach_sub(struct pxa2x0_i2s_softc *);
58 1.1 peter int pxa2x0_i2s_detach_sub(struct pxa2x0_i2s_softc *);
59 1.1 peter void pxa2x0_i2s_open(struct pxa2x0_i2s_softc *);
60 1.1 peter void pxa2x0_i2s_close(struct pxa2x0_i2s_softc *);
61 1.1 peter void pxa2x0_i2s_write(struct pxa2x0_i2s_softc *, u_int32_t);
62 1.1 peter
63 1.1 peter void pxa2x0_i2s_setspeed(struct pxa2x0_i2s_softc *, u_int *);
64 1.1 peter
65 1.3 jmcneill void * pxa2x0_i2s_allocm(void *, int, size_t);
66 1.3 jmcneill void pxa2x0_i2s_freem(void *, void *, size_t);
67 1.1 peter paddr_t pxa2x0_i2s_mappage(void *, void *, off_t, int);
68 1.1 peter int pxa2x0_i2s_round_blocksize(void *, int, int, const struct audio_params *);
69 1.1 peter size_t pxa2x0_i2s_round_buffersize(void *, int, size_t);
70 1.1 peter int pxa2x0_i2s_halt_output(void *);
71 1.1 peter int pxa2x0_i2s_halt_input(void *);
72 1.1 peter int pxa2x0_i2s_start_output(void *, void *, int, void (*)(void *), void *);
73 1.1 peter int pxa2x0_i2s_start_input(void *, void *, int, void (*)(void *), void *);
74 1.1 peter
75 1.1 peter #endif
76