vs1001k.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 THE COPYRIGHT HOLDERS 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 THE
  23. * COPYRIGHT OWNER 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$
  55. * Revision 1.5 2008/08/11 06:59:59 haraldkipp
  56. * BSD types replaced by stdint types (feature request #1282721).
  57. *
  58. * Revision 1.4 2006/05/15 11:46:00 haraldkipp
  59. * Bug corrected, which stopped player on flush. Now flushing plays
  60. * the remaining bytes in the buffer.
  61. * VS1001 ports are now fully configurable.
  62. * Several changes had been added to adapt the code to newer
  63. * Nut/OS style, like replacing outp with outb and using API
  64. * routines for interrupt control.
  65. *
  66. * Revision 1.3 2004/03/16 16:48:28 haraldkipp
  67. * Added Jan Dubiec's H8/300 port.
  68. *
  69. * Revision 1.2 2003/07/13 19:37:39 haraldkipp
  70. * Enable application to control decoder interrupts.
  71. *
  72. * Revision 1.1.1.1 2003/05/09 14:41:10 haraldkipp
  73. * Initial using 3.2.1
  74. *
  75. * Revision 1.9 2003/05/06 18:44:58 harald
  76. * Cleanup
  77. *
  78. * Revision 1.8 2003/04/21 16:46:53 harald
  79. * New functions
  80. *
  81. * Revision 1.7 2003/04/07 20:08:09 harald
  82. * Redesigned by Pavel Chromy
  83. *
  84. * Revision 1.5 2003/02/04 18:00:37 harald
  85. * Version 3 released
  86. *
  87. * Revision 1.4 2002/10/29 15:40:49 harald
  88. * *** empty log message ***
  89. *
  90. * Revision 1.3 2002/08/16 17:51:19 harald
  91. * First public release
  92. *
  93. * Revision 1.2 2002/06/26 17:29:15 harald
  94. * First pre-release with 2.4 stack
  95. *
  96. */
  97. #include <sys/types.h>
  98. #include <stdint.h>
  99. /*!
  100. * \file dev/vs1001k.h
  101. * \brief Network interface controller definitions.
  102. */
  103. /*!
  104. * \addtogroup xgVs1001
  105. */
  106. /*@{*/
  107. /*
  108. * Instruction opcodes.
  109. */
  110. #define VS_OPCODE_READ 3
  111. #define VS_OPCODE_WRITE 2
  112. /*
  113. * Decoder registers.
  114. */
  115. #define VS_MODE_REG 0
  116. #define VS_STATUS_REG 1
  117. #define VS_INT_FCTLH_REG 2
  118. #define VS_CLOCKF_REG 3
  119. #define VS_DECODE_TIME_REG 4
  120. #define VS_AUDATA_REG 5
  121. #define VS_WRAM_REG 6
  122. #define VS_WRAMADDR_REG 7
  123. #define VS_HDAT0_REG 8
  124. #define VS_HDAT1_REG 9
  125. #define VS_A1ADDR_REG 10
  126. #define VS_VOL_REG 11
  127. #define VS_A1CTRL_REG 13
  128. /*
  129. * Mode register bits.
  130. */
  131. #define VS_SM_DIFF 0x0001
  132. #define VS_SM_FFWD 0x0002
  133. #define VS_SM_RESET 0x0004
  134. #define VS_SM_MP12 0x0008
  135. #define VS_SM_PDOWN 0x0010
  136. #define VS_SM_DAC 0x0020
  137. #define VS_SM_DACMONO 0x0040
  138. #define VS_SM_BASS 0x0080
  139. #define VS_SM_DACT 0x0100
  140. #define VS_SM_BYTEORD 0x0200
  141. #define VS_SM_IBMODE 0x0400
  142. #define VS_SM_IBCLK 0x0800
  143. /*
  144. * Clock register bits.
  145. */
  146. #define VS_CF_DOUBLER 0x8000
  147. /*
  148. * Bytes needed to flush internal VS buffer (size of VS interbal buffer)
  149. */
  150. #define VS_FLUSH_BYTES 2048
  151. /*
  152. * Status of the decoder
  153. */
  154. #define VS_STATUS_STOPPED 0
  155. #define VS_STATUS_RUNNING 1
  156. #define VS_STATUS_EOF 2
  157. #define VS_STATUS_EMPTY 4
  158. /*
  159. * Header info filled by VsGetHeaderInfo.
  160. */
  161. #ifdef __GNUC__
  162. typedef struct {
  163. uint16_t vshi_no_crc:1;
  164. uint16_t vshi_layer:2;
  165. uint16_t vshi_id:2;
  166. uint16_t vshi_syncword:11;
  167. uint16_t vshi_emphasis:2;
  168. uint16_t vshi_original:1;
  169. uint16_t vshi_copyright:1;
  170. uint16_t vshi_extension:2;
  171. uint16_t vshi_mode:2;
  172. uint16_t vshi_private_bit:1;
  173. uint16_t vshi_pad_bit:1;
  174. uint16_t vshi_sample_rate:2;
  175. uint16_t vshi_bitrate:4;
  176. } VS_HEADERINFO;
  177. #endif
  178. extern int VsPlayerInit(void);
  179. extern int VsPlayerReset(uint16_t mode);
  180. extern int VsPlayerSetMode(uint16_t mode);
  181. extern int VsPlayerKick(void);
  182. extern int VsPlayerStop(void);
  183. extern int VsPlayerFlush(void);
  184. extern uint8_t VsPlayerInterrupts(uint8_t enable);
  185. extern uint8_t *VsBufferInit(uint16_t size);
  186. extern uint8_t *VsBufferReset(void);
  187. extern uint8_t *VsBufferRequest(uint16_t *sizep);
  188. extern uint8_t *VsBufferAcknowledge(uint16_t nbytes);
  189. extern uint16_t VsBufferAvailable(void);
  190. extern uint16_t VsPlayTime(void);
  191. extern uint8_t VsGetStatus(void);
  192. #ifdef __GNUC__
  193. extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
  194. #endif
  195. extern uint16_t VsMemoryTest(void);
  196. extern int VsSetVolume(uint8_t left, uint8_t right);
  197. extern int VsBeep(uint8_t fsin, uint8_t ms);
  198. /*@}*/
  199. #endif