1 // license:BSD-3-Clause 2 // copyright-holders:windyfairy 3 #ifndef MAME_MACHINE_K573FPGA_H 4 #define MAME_MACHINE_K573FPGA_H 5 6 #pragma once 7 8 #include "sound/mas3507d.h" 9 #include "machine/ds2401.h" 10 DECLARE_DEVICE_TYPE(KONAMI_573_DIGITAL_FPGA,k573fpga_device)11DECLARE_DEVICE_TYPE(KONAMI_573_DIGITAL_FPGA, k573fpga_device) 12 13 class k573fpga_device : public device_t 14 { 15 public: 16 k573fpga_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); 17 18 void set_ddrsbm_fpga(bool flag) { use_ddrsbm_fpga = flag; } 19 20 void set_ram(u16 *v) { ram = v; } 21 u16 get_decrypted(); 22 23 void set_crypto_key1(u16 v) { crypto_key1 = v; } 24 void set_crypto_key2(u16 v) { crypto_key2 = v; } 25 void set_crypto_key3(u8 v) { crypto_key3 = v; } 26 27 uint32_t get_mp3_cur_adr() { return mp3_cur_adr; } 28 void set_mp3_cur_adr(u32 v) { mp3_cur_adr = v; } 29 30 uint32_t get_mp3_end_adr() { return mp3_end_adr; } 31 void set_mp3_end_adr(u32 v) { mp3_end_adr = v; } 32 33 u16 i2c_read(); 34 void i2c_write(u16 data); 35 36 u16 get_mpeg_ctrl(); 37 void set_mpeg_ctrl(u16 data); 38 39 bool is_playing() { return (mpeg_ctrl_flag & 0xe000) == 0xe000 && mp3_cur_adr < mp3_end_adr; } 40 41 protected: 42 virtual void device_start() override; 43 virtual void device_reset() override; 44 45 private: 46 u16 *ram; 47 48 u16 crypto_key1, crypto_key2; 49 u8 crypto_key3; 50 51 u32 mp3_cur_adr, mp3_end_adr, mpeg_ctrl_flag; 52 bool use_ddrsbm_fpga; 53 54 u16 decrypt_default(u16 data); 55 u16 decrypt_ddrsbm(u16 data); 56 }; 57 58 #endif // MAME_MACHINE_K573FPGA_H 59