vs10xx.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  21. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. *
  32. * -
  33. * Portions Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.
  34. *
  35. * This file is part of the yampp system.
  36. *
  37. * This program is free software; you can redistribute it and/or
  38. * modify it under the terms of the GNU General Public License
  39. * as published by the Free Software Foundation; either version 2
  40. * of the License, or (at your option) any later version.
  41. *
  42. * This program is distributed in the hope that it will be useful,
  43. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  44. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  45. * GNU General Public License for more details.
  46. *
  47. * You should have received a copy of the GNU General Public License
  48. * along with this program; if not, write to the Free Software Foundation,
  49. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  50. */
  51. /*
  52. *
  53. * Revision 2.0 2004/09/30 19:37:39 johan van der stoel
  54. * Fully rewritten to support VS1011 / VS1003. For VS1001: use driver from
  55. * Ethernut distribution
  56. *
  57. * Revision 1.2 2003/07/13 19:37:39 haraldkipp
  58. * Enable application to control decoder interrupts.
  59. *
  60. *
  61. */
  62. #include <sys/nutconfig.h>
  63. #include <sys/types.h>
  64. /*-------------------------------------------------------------------------*/
  65. /* global defines */
  66. /*-------------------------------------------------------------------------*/
  67. // Instruction opcodes
  68. #define VS_OPCODE_READ 3
  69. #define VS_OPCODE_WRITE 2
  70. // Decoder registers VS1011/VS1003
  71. #define VS_MODE_REG 0
  72. #define VS_STATUS_REG 1
  73. #define VS_BASS_REG 2
  74. #define VS_CLOCKF_REG 3
  75. #define VS_DECODE_TIME_REG 4
  76. #define VS_AUDATA_REG 5
  77. #define VS_WRAM_REG 6
  78. #define VS_WRAMADDR_REG 7
  79. #define VS_HDAT0_REG 8
  80. #define VS_HDAT1_REG 9
  81. #define VS_AIADDR_REG 10
  82. #define VS_VOL_REG 11
  83. #define VS_AICTRL0_REG 12
  84. #define VS_AICTRL1_REG 13
  85. #define VS_AICTRL2_REG 14
  86. #define VS_AICTRL3_REG 15
  87. #define NROF_VS_REGS (VS_AICTRL3_REG+1)
  88. // SCI Mode register bits VS1011/VS1003
  89. #define VS_SM_DIFF 0x0001
  90. #define VS_SM_JUMP 0x0002 /* VS1011 */
  91. #define VS_SM_SETTOZERO 0x0002 /* VS1003 */
  92. #define VS_SM_RESET 0x0004
  93. #define VS_SM_OUTOFWAV 0x0008
  94. #define VS_SM_PDOWN 0x0010
  95. #define VS_SM_TESTS 0x0020
  96. #define VS_SM_STREAM 0x0040
  97. #define VS_SM_SETTOZERO1 0x0080 /* VS1011 */
  98. #define VS_SM_PLUSV 0x0080 /* VS1003 */
  99. #define VS_SM_DACT 0x0100
  100. #define VS_SM_SDIORD 0x0200 /* VS1011 */
  101. #define VS_SM_SDISHARE 0x0400 /* VS1011 */
  102. #define VS_SM_SDINEW 0x0800 /* VS1011 */
  103. #define VS_SM_SETTOZERO2 0x1000 /* VS1011 */
  104. #define VS_SM_ADPCM 0x1000 /* VS1003 */
  105. #define VS_SM_SETTOZERO3 0x2000 /* VS1011 */
  106. #define VS_SM_ADPCM_HP 0x2000 /* VS1003 */
  107. #define VS_SM_LINE_IN 0x4000 /* VS1003 */
  108. // SCI Status register bits 6-4 contains the ID number of the chip
  109. #define VS_VS1001 0 /* not supported by this driver */
  110. #define VS_VS1011 1
  111. #define VS_VS1011e 2 /* VS1002 also returns this, but is not supported by this driver */
  112. #define VS_VS1003 3
  113. #define VS_VS1053 4
  114. #define VS_VS1033 5
  115. // Status of the decoder
  116. #define VS_STATUS_STOPPED 0
  117. #define VS_STATUS_RUNNING 1
  118. #define VS_STATUS_EOF 2
  119. #define VS_STATUS_EMPTY 4
  120. /*-------------------------------------------------------------------------*/
  121. /* typedefs & structs */
  122. /*-------------------------------------------------------------------------*/
  123. /*-------------------------------------------------------------------------*/
  124. /* export global variables */
  125. /*-------------------------------------------------------------------------*/
  126. /*-------------------------------------------------------------------------*/
  127. /* export global routines (interface) */
  128. /*-------------------------------------------------------------------------*/
  129. extern int VsPlayerInit(void);
  130. extern int VsPlayerReset(u_short mode);
  131. extern int VsPlayerSetMode(u_short mode);
  132. extern int VsPlayerKick(void);
  133. extern int VsPlayerStop(void);
  134. extern u_char VsPlayerInterrupts(u_char enable);
  135. extern u_char VsGetStatus(void);
  136. extern u_short VsMemoryTest(void);
  137. extern u_short VsGetType(void);
  138. extern u_short VsGetTypeHex(void);
  139. extern int VsSetVolume(u_char left, u_char right);
  140. extern u_short VsGetVolume(void);
  141. extern int VsBeep(u_char fsin, u_short ms);
  142. extern int VsBeepStart(u_char fsin);
  143. extern int VsBeepStartRaw(u_char Raw);
  144. extern int VsBeepStop(void);
  145. extern u_short VsRegInfo(u_char reg);
  146. extern void VsRegWrite(u_char reg, u_short data);
  147. extern u_short VsStreamValid(void);
  148. /*@}*/