aicavar.h revision 1.1 1 1.1 marcus /* $NetBSD: aicavar.h,v 1.1 2003/08/24 17:33:29 marcus Exp $ */
2 1.1 marcus
3 1.1 marcus /*
4 1.1 marcus * Copyright (c) 2003 SHIMIZU Ryo <ryo (at) misakimix.org>
5 1.1 marcus * All rights reserved.
6 1.1 marcus *
7 1.1 marcus * Redistribution and use in source and binary forms, with or without
8 1.1 marcus * modification, are permitted provided that the following conditions
9 1.1 marcus * are met:
10 1.1 marcus *
11 1.1 marcus * 1. Redistributions of source code must retain the above copyright
12 1.1 marcus * notice, this list of conditions and the following disclaimer.
13 1.1 marcus * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 marcus * notice, this list of conditions and the following disclaimer in the
15 1.1 marcus * documentation and/or other materials provided with the distribution.
16 1.1 marcus * 3. The name of the author may not be used to endorse or promote products
17 1.1 marcus * derived from this software without specific prior written permission.
18 1.1 marcus *
19 1.1 marcus * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 1.1 marcus * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 1.1 marcus * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 1.1 marcus * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 marcus * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 1.1 marcus * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 1.1 marcus * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 1.1 marcus * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 1.1 marcus * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 1.1 marcus * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 1.1 marcus */
30 1.1 marcus
31 1.1 marcus #ifndef _AICAVAR_H_
32 1.1 marcus #define _AICAVAR_H_
33 1.1 marcus
34 1.1 marcus typedef struct {
35 1.1 marcus u_int32_t serial;
36 1.1 marcus u_int32_t command;
37 1.1 marcus u_int32_t blocksize;
38 1.1 marcus u_int32_t channel;
39 1.1 marcus u_int32_t rate;
40 1.1 marcus u_int32_t precision;
41 1.1 marcus u_int32_t l_param; /* volume,etc... for left */
42 1.1 marcus u_int32_t r_param; /* volume,etc... for right */
43 1.1 marcus } aica_cmd_t;
44 1.1 marcus
45 1.1 marcus #define AICA_COMMAND_NOP 0
46 1.1 marcus #define AICA_COMMAND_PLAY 1
47 1.1 marcus #define AICA_COMMAND_STOP 2
48 1.1 marcus #define AICA_COMMAND_INIT 3
49 1.1 marcus #define AICA_COMMAND_MVOL 4
50 1.1 marcus #define AICA_COMMAND_VOL 5
51 1.1 marcus
52 1.1 marcus #define AICA_ARM_CODE 0x00000000 /* text+data+bss+stack
53 1.1 marcus 0x00000000-0x0000ff00 */
54 1.1 marcus #define AICA_ARM_CMD 0x0000ff00 /* SH4<->ARM work for
55 1.1 marcus communication */
56 1.1 marcus #define AICA_ARM_CMDADDR(x) (AICA_ARM_CMD + offsetof(aica_cmd_t, x))
57 1.1 marcus #define AICA_ARM_CMD_SERIAL AICA_ARM_CMDADDR(serial)
58 1.1 marcus #define AICA_ARM_CMD_COMMAND AICA_ARM_CMDADDR(command)
59 1.1 marcus #define AICA_ARM_CMD_BLOCKSIZE AICA_ARM_CMDADDR(blocksize)
60 1.1 marcus #define AICA_ARM_CMD_CHANNEL AICA_ARM_CMDADDR(channel)
61 1.1 marcus #define AICA_ARM_CMD_RATE AICA_ARM_CMDADDR(rate)
62 1.1 marcus #define AICA_ARM_CMD_PRECISION AICA_ARM_CMDADDR(precision)
63 1.1 marcus #define AICA_ARM_CMD_LPARAM AICA_ARM_CMDADDR(l_param)
64 1.1 marcus #define AICA_ARM_CMD_RPARAM AICA_ARM_CMDADDR(r_param)
65 1.1 marcus
66 1.1 marcus #define AICA_ARM_END 0x00010000
67 1.1 marcus
68 1.1 marcus #define AICA_DMABUF_START 0x00010000
69 1.1 marcus #define AICA_DMABUF_LEFT 0x00010000 /* DMA buffer for PLAY
70 1.1 marcus 0x00010000-0x0001FFFF */
71 1.1 marcus #define AICA_DMABUF_RIGHT 0x00020000 /* DMA buffer for PLAY
72 1.1 marcus 0x00020000-0x0002FFFF */
73 1.1 marcus #define AICA_DMABUF_MONO AICA_DMABUF_LEFT
74 1.1 marcus #define AICA_DMABUF_END 0x00030000
75 1.1 marcus
76 1.1 marcus #define AICA_DMABUF_SIZE 0x0000ffc0
77 1.1 marcus
78 1.1 marcus #define AICA_MEMORY_END 0x00200000
79 1.1 marcus
80 1.1 marcus
81 1.1 marcus #define L256TO16(l) (((l) >> 4) & 0x0f)
82 1.1 marcus #define L16TO256(l) ((((l) << 4) & 0xf0) + ((l) & 0x0f))
83 1.1 marcus
84 1.1 marcus
85 1.1 marcus enum MIXER_CLASS {
86 1.1 marcus AICA_MASTER_VOL = 0,
87 1.1 marcus AICA_OUTPUT_GAIN,
88 1.1 marcus AICA_OUTPUT_CLASS,
89 1.1 marcus
90 1.1 marcus AICA_NDEVS
91 1.1 marcus };
92 1.1 marcus
93 1.1 marcus #endif /* _AICAVAR_H_ */
94 1.1 marcus
95