i2sreg.h revision 1.2 1 1.2 macallan /* $NetBSD: i2sreg.h,v 1.2 2025/09/08 08:06:19 macallan Exp $ */
2 1.1 macallan
3 1.1 macallan /*-
4 1.1 macallan * Copyright (c) 2002, 2003 Tsubai Masanari. All rights reserved.
5 1.1 macallan *
6 1.1 macallan * Redistribution and use in source and binary forms, with or without
7 1.1 macallan * modification, are permitted provided that the following conditions
8 1.1 macallan * are met:
9 1.1 macallan * 1. Redistributions of source code must retain the above copyright
10 1.1 macallan * notice, this list of conditions and the following disclaimer.
11 1.1 macallan * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 macallan * notice, this list of conditions and the following disclaimer in the
13 1.1 macallan * documentation and/or other materials provided with the distribution.
14 1.1 macallan * 3. The name of the author may not be used to endorse or promote products
15 1.1 macallan * derived from this software without specific prior written permission.
16 1.1 macallan *
17 1.1 macallan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.1 macallan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1 macallan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1 macallan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.1 macallan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.1 macallan * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.1 macallan * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.1 macallan * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.1 macallan * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 1.1 macallan * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1 macallan */
28 1.1 macallan
29 1.2 macallan #include <sys/cdefs.h>
30 1.2 macallan __KERNEL_RCSID(0, "$NetBSD: i2sreg.h,v 1.2 2025/09/08 08:06:19 macallan Exp $");
31 1.2 macallan
32 1.2 macallan #ifndef I2SREG_H
33 1.2 macallan #define I2SREG_H
34 1.2 macallan
35 1.1 macallan /* I2S registers */
36 1.1 macallan #define I2S_INT 0x00
37 1.1 macallan #define I2S_FORMAT 0x10
38 1.1 macallan #define I2S_FRAMECOUNT 0x40
39 1.1 macallan #define I2S_FRAMEMATCH 0x50
40 1.1 macallan #define I2S_WORDSIZE 0x60
41 1.1 macallan
42 1.1 macallan /* I2S_INT register definitions */
43 1.1 macallan #define I2S_INT_CLKSTOPPEND 0x01000000 /* clock-stop interrupt pending */
44 1.1 macallan
45 1.1 macallan /* I2S_WORDSIZE register definitions */
46 1.1 macallan #define INPUT_STEREO (2 << 24)
47 1.1 macallan #define INPUT_MONO (1 << 24)
48 1.1 macallan #define INPUT_16BIT (0 << 16)
49 1.1 macallan #define INPUT_24BIT (3 << 16)
50 1.1 macallan #define OUTPUT_STEREO (2 << 8)
51 1.1 macallan #define OUTPUT_MONO (1 << 8)
52 1.1 macallan #define OUTPUT_16BIT (0 << 0)
53 1.1 macallan #define OUTPUT_24BIT (3 << 0)
54 1.2 macallan
55 1.2 macallan /* I2S_FORMAT register definitions */
56 1.2 macallan #define CLKSRC_49MHz 0x80000000 /* Use 49152000Hz Osc. */
57 1.2 macallan #define CLKSRC_45MHz 0x40000000 /* Use 45158400Hz Osc. */
58 1.2 macallan #define CLKSRC_18MHz 0x00000000 /* Use 18432000Hz Osc. */
59 1.2 macallan #define MCLK_DIV 0x1f000000 /* MCLK = SRC / DIV */
60 1.2 macallan #define MCLK_DIV1 0x14000000 /* MCLK = SRC */
61 1.2 macallan #define MCLK_DIV3 0x13000000 /* MCLK = SRC / 3 */
62 1.2 macallan #define MCLK_DIV5 0x12000000 /* MCLK = SRC / 5 */
63 1.2 macallan #define SCLK_DIV 0x00f00000 /* SCLK = MCLK / DIV */
64 1.2 macallan #define SCLK_DIV1 0x00800000
65 1.2 macallan #define SCLK_DIV3 0x00900000
66 1.2 macallan #define SCLK_MASTER 0x00080000 /* Master mode */
67 1.2 macallan #define SCLK_SLAVE 0x00000000 /* Slave mode */
68 1.2 macallan #define SERIAL_FORMAT 0x00070000
69 1.2 macallan #define SERIAL_SONY 0x00000000
70 1.2 macallan #define SERIAL_64x 0x00010000
71 1.2 macallan #define SERIAL_32x 0x00020000
72 1.2 macallan #define SERIAL_DAV 0x00040000
73 1.2 macallan #define SERIAL_SILICON 0x00050000
74 1.2 macallan
75 1.2 macallan #endif