vs1001k.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. #ifndef _VS1001K_H_
  2. #define _VS1001K_H_
  3. /*
  4. * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  23. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. * -
  35. * Portions Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.
  36. *
  37. * This file is part of the yampp system.
  38. *
  39. * This program is free software; you can redistribute it and/or
  40. * modify it under the terms of the GNU General Public License
  41. * as published by the Free Software Foundation; either version 2
  42. * of the License, or (at your option) any later version.
  43. *
  44. * This program is distributed in the hope that it will be useful,
  45. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  46. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  47. * GNU General Public License for more details.
  48. *
  49. * You should have received a copy of the GNU General Public License
  50. * along with this program; if not, write to the Free Software Foundation,
  51. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  52. */
  53. /*
  54. * $Log: vs1001k.h,v $
  55. * Revision 1.4 2006/05/15 11:46:00 haraldkipp
  56. * Bug corrected, which stopped player on flush. Now flushing plays
  57. * the remaining bytes in the buffer.
  58. * VS1001 ports are now fully configurable.
  59. * Several changes had been added to adapt the code to newer
  60. * Nut/OS style, like replacing outp with outb and using API
  61. * routines for interrupt control.
  62. *
  63. * Revision 1.3 2004/03/16 16:48:28 haraldkipp
  64. * Added Jan Dubiec's H8/300 port.
  65. *
  66. * Revision 1.2 2003/07/13 19:37:39 haraldkipp
  67. * Enable application to control decoder interrupts.
  68. *
  69. * Revision 1.1.1.1 2003/05/09 14:41:10 haraldkipp
  70. * Initial using 3.2.1
  71. *
  72. * Revision 1.9 2003/05/06 18:44:58 harald
  73. * Cleanup
  74. *
  75. * Revision 1.8 2003/04/21 16:46:53 harald
  76. * New functions
  77. *
  78. * Revision 1.7 2003/04/07 20:08:09 harald
  79. * Redesigned by Pavel Chromy
  80. *
  81. * Revision 1.5 2003/02/04 18:00:37 harald
  82. * Version 3 released
  83. *
  84. * Revision 1.4 2002/10/29 15:40:49 harald
  85. * *** empty log message ***
  86. *
  87. * Revision 1.3 2002/08/16 17:51:19 harald
  88. * First public release
  89. *
  90. * Revision 1.2 2002/06/26 17:29:15 harald
  91. * First pre-release with 2.4 stack
  92. *
  93. */
  94. #include <sys/types.h>
  95. /*!
  96. * \file dev/vs1001k.h
  97. * \brief Network interface controller definitions.
  98. */
  99. /*!
  100. * \addtogroup xgVs1001
  101. */
  102. /*@{*/
  103. /*
  104. * Instruction opcodes.
  105. */
  106. #define VS_OPCODE_READ 3
  107. #define VS_OPCODE_WRITE 2
  108. /*
  109. * Decoder registers.
  110. */
  111. #define VS_MODE_REG 0
  112. #define VS_STATUS_REG 1
  113. #define VS_INT_FCTLH_REG 2
  114. #define VS_CLOCKF_REG 3
  115. #define VS_DECODE_TIME_REG 4
  116. #define VS_AUDATA_REG 5
  117. #define VS_WRAM_REG 6
  118. #define VS_WRAMADDR_REG 7
  119. #define VS_HDAT0_REG 8
  120. #define VS_HDAT1_REG 9
  121. #define VS_A1ADDR_REG 10
  122. #define VS_VOL_REG 11
  123. #define VS_A1CTRL_REG 13
  124. /*
  125. * Mode register bits.
  126. */
  127. #define VS_SM_DIFF 0x0001
  128. #define VS_SM_FFWD 0x0002
  129. #define VS_SM_RESET 0x0004
  130. #define VS_SM_MP12 0x0008
  131. #define VS_SM_PDOWN 0x0010
  132. #define VS_SM_DAC 0x0020
  133. #define VS_SM_DACMONO 0x0040
  134. #define VS_SM_BASS 0x0080
  135. #define VS_SM_DACT 0x0100
  136. #define VS_SM_BYTEORD 0x0200
  137. #define VS_SM_IBMODE 0x0400
  138. #define VS_SM_IBCLK 0x0800
  139. /*
  140. * Clock register bits.
  141. */
  142. #define VS_CF_DOUBLER 0x8000
  143. /*
  144. * Bytes needed to flush internal VS buffer (size of VS interbal buffer)
  145. */
  146. #define VS_FLUSH_BYTES 2048
  147. /*
  148. * Status of the decoder
  149. */
  150. #define VS_STATUS_STOPPED 0
  151. #define VS_STATUS_RUNNING 1
  152. #define VS_STATUS_EOF 2
  153. #define VS_STATUS_EMPTY 4
  154. /*
  155. * Header info filled by VsGetHeaderInfo.
  156. */
  157. #ifdef __GNUC__
  158. typedef struct {
  159. u_short vshi_no_crc:1;
  160. u_short vshi_layer:2;
  161. u_short vshi_id:2;
  162. u_short vshi_syncword:11;
  163. u_short vshi_emphasis:2;
  164. u_short vshi_original:1;
  165. u_short vshi_copyright:1;
  166. u_short vshi_extension:2;
  167. u_short vshi_mode:2;
  168. u_short vshi_private_bit:1;
  169. u_short vshi_pad_bit:1;
  170. u_short vshi_sample_rate:2;
  171. u_short vshi_bitrate:4;
  172. } VS_HEADERINFO;
  173. #endif
  174. __BEGIN_DECLS
  175. /* Function prototypes */
  176. extern int VsPlayerInit(void);
  177. extern int VsPlayerReset(u_short mode);
  178. extern int VsPlayerSetMode(u_short mode);
  179. extern int VsPlayerKick(void);
  180. extern int VsPlayerStop(void);
  181. extern int VsPlayerFlush(void);
  182. extern u_char VsPlayerInterrupts(u_char enable);
  183. extern u_char *VsBufferInit(u_short size);
  184. extern u_char *VsBufferReset(void);
  185. extern u_char *VsBufferRequest(u_short *sizep);
  186. extern u_char *VsBufferAcknowledge(u_short nbytes);
  187. extern u_short VsBufferAvailable(void);
  188. extern u_short VsPlayTime(void);
  189. extern u_char VsGetStatus(void);
  190. #ifdef __GNUC__
  191. extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
  192. #endif
  193. extern u_short VsMemoryTest(void);
  194. extern int VsSetVolume(u_char left, u_char right);
  195. extern int VsBeep(u_char fsin, u_char ms);
  196. /*@}*/
  197. __END_DECLS
  198. /* End of prototypes */
  199. #endif