/***************************************************************************************1* Genesis Plus2* Mega CD / Sega CD hardware3*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_SCD_38#define _HW_SCD_3940#include "cdd.h"41#include "cdc.h"42#include "gfx.h"43#include "pcm.h"44#include "cd_cart.h"4546#define scd ext.cd_hw4748/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */49/* This would be slightly (~30 clocks) more on PAL systems because of the slower */50/* Master Clock (53.203424 MHz) but not enough to really care about since clocks */51/* are not running in sync anyway. */52#define SCD_CLOCK 5000000053#define SCYCLES_PER_LINE 31845455/* Timer & Stopwatch clocks divider */56#define TIMERS_SCYCLES_RATIO (384 * 4)5758/* CD hardware */59typedef struct60{61cd_cart_t cartridge; /* ROM/RAM Cartridge */62uint8 *bootrom; /* 128K internal BOOT ROM */63uint8 *prg_ram; /* 512K PRG-RAM */64uint8 *word_ram[2]; /* 2 x 128K Word RAM (1M mode) */65uint8 *word_ram_2M; /* 256K Word RAM (2M mode) */66uint8 *bram; /* 8K Backup RAM */67reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */68uint32 cycles; /* Master clock counter */69int32 stopwatch; /* Stopwatch counter */70int32 timer; /* Timer counter */71uint8 pending; /* Pending interrupts */72uint8 dmna; /* Pending DMNA write status */73gfx_t gfx_hw; /* Graphics processor */74cdc_t cdc_hw; /* CD data controller */75cdd_t cdd_hw; /* CD drive processor */76pcm_t pcm_hw; /* PCM chip */77} cd_hw_t;7879/* Function prototypes */80extern void scd_init(void);81extern void scd_reset(int hard);82extern void scd_update(unsigned int cycles);83extern void scd_end_frame(unsigned int cycles);84extern int scd_68k_irq_ack(int level);85extern void prg_ram_dma_w(unsigned int words);8687#endif888990