/***************************************************************************************1* Genesis Plus2* CD drive processor & CD-DA fader3*4* Copyright (C) 2012-2013 Eke-Eke (Genesis Plus GX)5*6* Redistribution and use of this code or any derivative works are permitted7* provided that the following conditions are met:8*9* - Redistributions may not be sold, nor may they be used in a commercial10* product or activity.11*12* - Redistributions that are modified from the original source must include the13* complete source code, including the source code for all components used by a14* binary built from the modified sources. However, as a special exception, the15* source code distributed need not include anything that is normally distributed16* (in either source or binary form) with the major components (compiler, kernel,17* and so on) of the operating system on which the executable runs, unless that18* component itself accompanies the executable.19*20* - Redistributions must reproduce the above copyright notice, this list of21* conditions and the following disclaimer in the documentation and/or other22* materials provided with the distribution.23*24* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"25* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE26* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE27* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE28* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR29* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF30* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS31* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN32* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)33* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE34* POSSIBILITY OF SUCH DAMAGE.35*36****************************************************************************************/37#ifndef _HW_CDD_38#define _HW_CDD_3940#include "blip_buf.h"4142#ifdef USE_LIBTREMOR43#include "tremor/ivorbisfile.h"44#endif4546#define cdd scd.cdd_hw4748/* CDD status */49#define NO_DISC 0x0050#define CD_PLAY 0x0151#define CD_SEEK 0x0252#define CD_SCAN 0x0353#define CD_READY 0x0454#define CD_OPEN 0x05 /* similar to 0x0E ? */55#define CD_STOP 0x0956#define CD_END 0x0C5758/* CD blocks scanning speed */59#define CD_SCAN_SPEED 306061#define CD_MAX_TRACKS 1006263/* CD track */64typedef struct65{66int start;67int end;68} track_t;6970/* CD TOC */71typedef struct72{73int end;74int last;75track_t tracks[CD_MAX_TRACKS];76} toc_t;7778/* CDD hardware */79typedef struct80{81uint32 cycles;82uint32 latency;83int loaded;84int index;85int lba;86int scanOffset;87int volume;88int sampleOffset;89int sampleLba;90uint8 status;91toc_t toc;92int16 audio[2];93} cdd_t;9495/* Function prototypes */96extern void cdd_init(blip_t* left, blip_t* right);97extern void cdd_reset(void);98extern int cdd_context_save(uint8 *state);99extern int cdd_context_load(uint8 *state);100extern int cdd_load(const char *key, char *header);101extern void cdd_unload(void);102extern void cdd_read_data(uint8 *dst);103extern void cdd_read_audio(unsigned int samples);104extern void cdd_update(void);105extern void cdd_process(void);106107#endif108109110