18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* aica.h 38c2ecf20Sopenharmony_ci * Header file for ALSA driver for 48c2ecf20Sopenharmony_ci * Sega Dreamcast Yamaha AICA sound 58c2ecf20Sopenharmony_ci * Copyright Adrian McMenamin 68c2ecf20Sopenharmony_ci * <adrian@mcmen.demon.co.uk> 78c2ecf20Sopenharmony_ci * 2006 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* SPU memory and register constants etc */ 118c2ecf20Sopenharmony_ci#define G2_FIFO 0xa05f688c 128c2ecf20Sopenharmony_ci#define SPU_MEMORY_BASE 0xA0800000 138c2ecf20Sopenharmony_ci#define ARM_RESET_REGISTER 0xA0702C00 148c2ecf20Sopenharmony_ci#define SPU_REGISTER_BASE 0xA0700000 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* AICA channels stuff */ 178c2ecf20Sopenharmony_ci#define AICA_CONTROL_POINT 0xA0810000 188c2ecf20Sopenharmony_ci#define AICA_CONTROL_CHANNEL_SAMPLE_NUMBER 0xA0810008 198c2ecf20Sopenharmony_ci#define AICA_CHANNEL0_CONTROL_OFFSET 0x10004 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* Command values */ 228c2ecf20Sopenharmony_ci#define AICA_CMD_KICK 0x80000000 238c2ecf20Sopenharmony_ci#define AICA_CMD_NONE 0 248c2ecf20Sopenharmony_ci#define AICA_CMD_START 1 258c2ecf20Sopenharmony_ci#define AICA_CMD_STOP 2 268c2ecf20Sopenharmony_ci#define AICA_CMD_VOL 3 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* Sound modes */ 298c2ecf20Sopenharmony_ci#define SM_8BIT 1 308c2ecf20Sopenharmony_ci#define SM_16BIT 0 318c2ecf20Sopenharmony_ci#define SM_ADPCM 2 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* Buffer and period size */ 348c2ecf20Sopenharmony_ci#define AICA_BUFFER_SIZE 0x8000 358c2ecf20Sopenharmony_ci#define AICA_PERIOD_SIZE 0x800 368c2ecf20Sopenharmony_ci#define AICA_PERIOD_NUMBER 16 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define AICA_CHANNEL0_OFFSET 0x11000 398c2ecf20Sopenharmony_ci#define AICA_CHANNEL1_OFFSET 0x21000 408c2ecf20Sopenharmony_ci#define CHANNEL_OFFSET 0x10000 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define AICA_DMA_CHANNEL 5 438c2ecf20Sopenharmony_ci#define AICA_DMA_MODE 5 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define SND_AICA_DRIVER "AICA" 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct aica_channel { 488c2ecf20Sopenharmony_ci uint32_t cmd; /* Command ID */ 498c2ecf20Sopenharmony_ci uint32_t pos; /* Sample position */ 508c2ecf20Sopenharmony_ci uint32_t length; /* Sample length */ 518c2ecf20Sopenharmony_ci uint32_t freq; /* Frequency */ 528c2ecf20Sopenharmony_ci uint32_t vol; /* Volume 0-255 */ 538c2ecf20Sopenharmony_ci uint32_t pan; /* Pan 0-255 */ 548c2ecf20Sopenharmony_ci uint32_t sfmt; /* Sound format */ 558c2ecf20Sopenharmony_ci uint32_t flags; /* Bit flags */ 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cistruct snd_card_aica { 598c2ecf20Sopenharmony_ci struct work_struct spu_dma_work; 608c2ecf20Sopenharmony_ci struct snd_card *card; 618c2ecf20Sopenharmony_ci struct aica_channel *channel; 628c2ecf20Sopenharmony_ci struct snd_pcm_substream *substream; 638c2ecf20Sopenharmony_ci int clicks; 648c2ecf20Sopenharmony_ci int current_period; 658c2ecf20Sopenharmony_ci struct timer_list timer; 668c2ecf20Sopenharmony_ci int master_volume; 678c2ecf20Sopenharmony_ci int dma_check; 688c2ecf20Sopenharmony_ci}; 69