00001 #ifndef _VS1001K_H_ 00002 #define _VS1001K_H_ 00003 /* 00004 * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 3. Neither the name of the copyright holders nor the names of 00016 * contributors may be used to endorse or promote products derived 00017 * from this software without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00020 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00022 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00023 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00024 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00025 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00026 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00027 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00028 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00029 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00030 * SUCH DAMAGE. 00031 * 00032 * For additional information see http://www.ethernut.de/ 00033 * 00034 * - 00035 * Portions Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>. 00036 * 00037 * This file is part of the yampp system. 00038 * 00039 * This program is free software; you can redistribute it and/or 00040 * modify it under the terms of the GNU General Public License 00041 * as published by the Free Software Foundation; either version 2 00042 * of the License, or (at your option) any later version. 00043 * 00044 * This program is distributed in the hope that it will be useful, 00045 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00046 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00047 * GNU General Public License for more details. 00048 * 00049 * You should have received a copy of the GNU General Public License 00050 * along with this program; if not, write to the Free Software Foundation, 00051 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00052 */ 00053 00054 /* 00055 * $Log: vs1001k.h,v $ 00056 * Revision 1.4 2006/05/15 11:46:00 haraldkipp 00057 * Bug corrected, which stopped player on flush. Now flushing plays 00058 * the remaining bytes in the buffer. 00059 * VS1001 ports are now fully configurable. 00060 * Several changes had been added to adapt the code to newer 00061 * Nut/OS style, like replacing outp with outb and using API 00062 * routines for interrupt control. 00063 * 00064 * Revision 1.3 2004/03/16 16:48:28 haraldkipp 00065 * Added Jan Dubiec's H8/300 port. 00066 * 00067 * Revision 1.2 2003/07/13 19:37:39 haraldkipp 00068 * Enable application to control decoder interrupts. 00069 * 00070 * Revision 1.1.1.1 2003/05/09 14:41:10 haraldkipp 00071 * Initial using 3.2.1 00072 * 00073 * Revision 1.9 2003/05/06 18:44:58 harald 00074 * Cleanup 00075 * 00076 * Revision 1.8 2003/04/21 16:46:53 harald 00077 * New functions 00078 * 00079 * Revision 1.7 2003/04/07 20:08:09 harald 00080 * Redesigned by Pavel Chromy 00081 * 00082 * Revision 1.5 2003/02/04 18:00:37 harald 00083 * Version 3 released 00084 * 00085 * Revision 1.4 2002/10/29 15:40:49 harald 00086 * *** empty log message *** 00087 * 00088 * Revision 1.3 2002/08/16 17:51:19 harald 00089 * First public release 00090 * 00091 * Revision 1.2 2002/06/26 17:29:15 harald 00092 * First pre-release with 2.4 stack 00093 * 00094 */ 00095 00096 #include <sys/types.h> 00097 00107 00108 00109 00110 /* 00111 * Instruction opcodes. 00112 */ 00113 #define VS_OPCODE_READ 3 00114 #define VS_OPCODE_WRITE 2 00115 00116 /* 00117 * Decoder registers. 00118 */ 00119 #define VS_MODE_REG 0 00120 #define VS_STATUS_REG 1 00121 #define VS_INT_FCTLH_REG 2 00122 #define VS_CLOCKF_REG 3 00123 #define VS_DECODE_TIME_REG 4 00124 #define VS_AUDATA_REG 5 00125 #define VS_WRAM_REG 6 00126 #define VS_WRAMADDR_REG 7 00127 #define VS_HDAT0_REG 8 00128 #define VS_HDAT1_REG 9 00129 #define VS_A1ADDR_REG 10 00130 #define VS_VOL_REG 11 00131 #define VS_A1CTRL_REG 13 00132 00133 00134 /* 00135 * Mode register bits. 00136 */ 00137 #define VS_SM_DIFF 0x0001 00138 #define VS_SM_FFWD 0x0002 00139 #define VS_SM_RESET 0x0004 00140 #define VS_SM_MP12 0x0008 00141 #define VS_SM_PDOWN 0x0010 00142 #define VS_SM_DAC 0x0020 00143 #define VS_SM_DACMONO 0x0040 00144 #define VS_SM_BASS 0x0080 00145 #define VS_SM_DACT 0x0100 00146 #define VS_SM_BYTEORD 0x0200 00147 #define VS_SM_IBMODE 0x0400 00148 #define VS_SM_IBCLK 0x0800 00149 00150 00151 /* 00152 * Clock register bits. 00153 */ 00154 #define VS_CF_DOUBLER 0x8000 00155 00156 00157 /* 00158 * Bytes needed to flush internal VS buffer (size of VS interbal buffer) 00159 */ 00160 #define VS_FLUSH_BYTES 2048 00161 00162 00163 /* 00164 * Status of the decoder 00165 */ 00166 #define VS_STATUS_STOPPED 0 00167 #define VS_STATUS_RUNNING 1 00168 #define VS_STATUS_EOF 2 00169 #define VS_STATUS_EMPTY 4 00170 00171 /* 00172 * Header info filled by VsGetHeaderInfo. 00173 */ 00174 #ifdef __GNUC__ 00175 typedef struct { 00176 u_short vshi_no_crc:1; 00177 u_short vshi_layer:2; 00178 u_short vshi_id:2; 00179 u_short vshi_syncword:11; 00180 00181 u_short vshi_emphasis:2; 00182 u_short vshi_original:1; 00183 u_short vshi_copyright:1; 00184 u_short vshi_extension:2; 00185 u_short vshi_mode:2; 00186 u_short vshi_private_bit:1; 00187 u_short vshi_pad_bit:1; 00188 u_short vshi_sample_rate:2; 00189 u_short vshi_bitrate:4; 00190 } VS_HEADERINFO; 00191 #endif 00192 00193 __BEGIN_DECLS 00194 /* Function prototypes */ 00195 00196 extern int VsPlayerInit(void); 00197 extern int VsPlayerReset(u_short mode); 00198 extern int VsPlayerSetMode(u_short mode); 00199 extern int VsPlayerKick(void); 00200 extern int VsPlayerStop(void); 00201 extern int VsPlayerFlush(void); 00202 extern u_char VsPlayerInterrupts(u_char enable); 00203 00204 extern u_char *VsBufferInit(u_short size); 00205 extern u_char *VsBufferReset(void); 00206 extern u_char *VsBufferRequest(u_short *sizep); 00207 extern u_char *VsBufferAcknowledge(u_short nbytes); 00208 00209 extern u_short VsBufferAvailable(void); 00210 extern u_short VsPlayTime(void); 00211 extern u_char VsGetStatus(void); 00212 #ifdef __GNUC__ 00213 extern int VsGetHeaderInfo(VS_HEADERINFO *vshi); 00214 #endif 00215 extern u_short VsMemoryTest(void); 00216 00217 extern int VsSetVolume(u_char left, u_char right); 00218 extern int VsBeep(u_char fsin, u_char ms); 00219 00222 __END_DECLS 00223 /* End of prototypes */ 00224 00225 #endif