aica.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* aica.h
  2. * Header file for ALSA driver for
  3. * Sega Dreamcast Yamaha AICA sound
  4. * Copyright Adrian McMenamin
  5. * <adrian@mcmen.demon.co.uk>
  6. * 2006
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of version 2 of the GNU General Public License as published by
  10. * the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. /* SPU memory and register constants etc */
  23. #define G2_FIFO 0xa05f688c
  24. #define SPU_MEMORY_BASE 0xA0800000
  25. #define ARM_RESET_REGISTER 0xA0702C00
  26. #define SPU_REGISTER_BASE 0xA0700000
  27. /* AICA channels stuff */
  28. #define AICA_CONTROL_POINT 0xA0810000
  29. #define AICA_CONTROL_CHANNEL_SAMPLE_NUMBER 0xA0810008
  30. #define AICA_CHANNEL0_CONTROL_OFFSET 0x10004
  31. /* Command values */
  32. #define AICA_CMD_KICK 0x80000000
  33. #define AICA_CMD_NONE 0
  34. #define AICA_CMD_START 1
  35. #define AICA_CMD_STOP 2
  36. #define AICA_CMD_VOL 3
  37. /* Sound modes */
  38. #define SM_8BIT 1
  39. #define SM_16BIT 0
  40. #define SM_ADPCM 2
  41. /* Buffer and period size */
  42. #define AICA_BUFFER_SIZE 0x8000
  43. #define AICA_PERIOD_SIZE 0x800
  44. #define AICA_PERIOD_NUMBER 16
  45. #define AICA_CHANNEL0_OFFSET 0x11000
  46. #define AICA_CHANNEL1_OFFSET 0x21000
  47. #define CHANNEL_OFFSET 0x10000
  48. #define AICA_DMA_CHANNEL 5
  49. #define AICA_DMA_MODE 5
  50. #define SND_AICA_DRIVER "AICA"
  51. struct aica_channel {
  52. uint32_t cmd; /* Command ID */
  53. uint32_t pos; /* Sample position */
  54. uint32_t length; /* Sample length */
  55. uint32_t freq; /* Frequency */
  56. uint32_t vol; /* Volume 0-255 */
  57. uint32_t pan; /* Pan 0-255 */
  58. uint32_t sfmt; /* Sound format */
  59. uint32_t flags; /* Bit flags */
  60. };
  61. struct snd_card_aica {
  62. struct work_struct spu_dma_work;
  63. struct snd_card *card;
  64. struct aica_channel *channel;
  65. struct snd_pcm_substream *substream;
  66. int clicks;
  67. int current_period;
  68. struct timer_list timer;
  69. int master_volume;
  70. int dma_check;
  71. };