xref: /netbsd-src/sys/arch/dreamcast/dev/g2/aicavar.h (revision 90313c06e62e910bf0d1bb24faa9d17dcefd0ab6)
1*90313c06Smsaitoh /*	$NetBSD: aicavar.h,v 1.4 2024/02/07 04:20:27 msaitoh Exp $	*/
27973c332Smarcus 
37973c332Smarcus /*
4*90313c06Smsaitoh  * Copyright (c) 2003 SHIMIZU Ryo
57973c332Smarcus  * All rights reserved.
67973c332Smarcus  *
77973c332Smarcus  * Redistribution and use in source and binary forms, with or without
87973c332Smarcus  * modification, are permitted provided that the following conditions
97973c332Smarcus  * are met:
107973c332Smarcus  *
117973c332Smarcus  * 1. Redistributions of source code must retain the above copyright
127973c332Smarcus  *    notice, this list of conditions and the following disclaimer.
137973c332Smarcus  * 2. Redistributions in binary form must reproduce the above copyright
147973c332Smarcus  *    notice, this list of conditions and the following disclaimer in the
157973c332Smarcus  *    documentation and/or other materials provided with the distribution.
167973c332Smarcus  * 3. The name of the author may not be used to endorse or promote products
177973c332Smarcus  *    derived from this software without specific prior written permission.
187973c332Smarcus  *
197973c332Smarcus  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
207973c332Smarcus  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
217973c332Smarcus  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
227973c332Smarcus  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
237973c332Smarcus  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
247973c332Smarcus  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
257973c332Smarcus  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
267973c332Smarcus  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
277973c332Smarcus  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
287973c332Smarcus  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
297973c332Smarcus  */
307973c332Smarcus 
317973c332Smarcus #ifndef _AICAVAR_H_
327973c332Smarcus #define _AICAVAR_H_
337973c332Smarcus 
347973c332Smarcus typedef struct {
3593293b9eSkent 	uint32_t serial;
3693293b9eSkent 	uint32_t command;
3793293b9eSkent 	uint32_t blocksize;
3893293b9eSkent 	uint32_t channel;
3993293b9eSkent 	uint32_t rate;
4093293b9eSkent 	uint32_t precision;
4193293b9eSkent 	uint32_t l_param;	/* volume,etc... for left */
4293293b9eSkent 	uint32_t r_param;	/* volume,etc... for right */
437973c332Smarcus } aica_cmd_t;
447973c332Smarcus 
457973c332Smarcus #define	AICA_COMMAND_NOP	0
467973c332Smarcus #define	AICA_COMMAND_PLAY	1
477973c332Smarcus #define	AICA_COMMAND_STOP	2
487973c332Smarcus #define	AICA_COMMAND_INIT	3
497973c332Smarcus #define	AICA_COMMAND_MVOL	4
507973c332Smarcus #define	AICA_COMMAND_VOL	5
517973c332Smarcus 
527973c332Smarcus #define	AICA_ARM_CODE		0x00000000	/* text+data+bss+stack
537973c332Smarcus 						   0x00000000-0x0000ff00 */
547973c332Smarcus #define	AICA_ARM_CMD		0x0000ff00	/* SH4<->ARM work for
557973c332Smarcus 						   communication */
567973c332Smarcus #define	AICA_ARM_CMDADDR(x)	(AICA_ARM_CMD + offsetof(aica_cmd_t, x))
577973c332Smarcus #define	AICA_ARM_CMD_SERIAL	AICA_ARM_CMDADDR(serial)
587973c332Smarcus #define	AICA_ARM_CMD_COMMAND	AICA_ARM_CMDADDR(command)
597973c332Smarcus #define	AICA_ARM_CMD_BLOCKSIZE	AICA_ARM_CMDADDR(blocksize)
607973c332Smarcus #define	AICA_ARM_CMD_CHANNEL	AICA_ARM_CMDADDR(channel)
617973c332Smarcus #define	AICA_ARM_CMD_RATE	AICA_ARM_CMDADDR(rate)
627973c332Smarcus #define	AICA_ARM_CMD_PRECISION	AICA_ARM_CMDADDR(precision)
637973c332Smarcus #define	AICA_ARM_CMD_LPARAM	AICA_ARM_CMDADDR(l_param)
647973c332Smarcus #define	AICA_ARM_CMD_RPARAM	AICA_ARM_CMDADDR(r_param)
657973c332Smarcus 
667973c332Smarcus #define	AICA_ARM_END		0x00010000
677973c332Smarcus 
687973c332Smarcus #define	AICA_DMABUF_START	0x00010000
697973c332Smarcus #define	AICA_DMABUF_LEFT	0x00010000	/* DMA buffer for PLAY
707973c332Smarcus 						   0x00010000-0x0001FFFF */
717973c332Smarcus #define	AICA_DMABUF_RIGHT	0x00020000	/* DMA buffer for PLAY
727973c332Smarcus 						   0x00020000-0x0002FFFF */
737973c332Smarcus #define	AICA_DMABUF_MONO	AICA_DMABUF_LEFT
747973c332Smarcus #define	AICA_DMABUF_END		0x00030000
757973c332Smarcus 
767973c332Smarcus #define	AICA_DMABUF_SIZE	0x0000ffc0
777973c332Smarcus 
787973c332Smarcus #define	AICA_MEMORY_END		0x00200000
797973c332Smarcus 
807973c332Smarcus 
817973c332Smarcus #define L256TO16(l)	(((l) >> 4) & 0x0f)
827973c332Smarcus #define L16TO256(l)	((((l) << 4) & 0xf0) + ((l) & 0x0f))
837973c332Smarcus 
847973c332Smarcus 
857973c332Smarcus enum MIXER_CLASS {
867973c332Smarcus 	AICA_MASTER_VOL = 0,
877973c332Smarcus 	AICA_OUTPUT_GAIN,
887973c332Smarcus 	AICA_OUTPUT_CLASS,
897973c332Smarcus 
907973c332Smarcus 	AICA_NDEVS
917973c332Smarcus };
927973c332Smarcus 
937973c332Smarcus #endif /* _AICAVAR_H_ */
947973c332Smarcus 
95