Move some RC timing macros out of the core (nw)

This commit is contained in:
AJR 2020-05-03 20:20:36 -04:00
parent c4ee747357
commit 065410f825
11 changed files with 22 additions and 13 deletions

View File

@ -3,7 +3,7 @@
#ifndef MAME_MACHINE_RESCAP_H #ifndef MAME_MACHINE_RESCAP_H
#define MAME_MACHINE_RESCAP_H #define MAME_MACHINE_RESCAP_H
/* Little helpers for magnitude conversions */ // Little helpers for magnitude conversions
#define RES_R(res) ((double)(res)) #define RES_R(res) ((double)(res))
#define RES_K(res) ((double)(res) * 1e3) #define RES_K(res) ((double)(res) * 1e3)
#define RES_M(res) ((double)(res) * 1e6) #define RES_M(res) ((double)(res) * 1e6)
@ -15,7 +15,7 @@
#define IND_N(ind) ((double)(ind) * 1e-9) #define IND_N(ind) ((double)(ind) * 1e-9)
#define IND_P(ind) ((double)(ind) * 1e-12) #define IND_P(ind) ((double)(ind) * 1e-12)
/* vin --/\r1/\-- out --/\r2/\-- gnd */ // vin --/\r1/\-- out --/\r2/\-- gnd
#define RES_VOLTAGE_DIVIDER(r1, r2) ((double)(r2) / ((double)(r1) + (double)(r2))) #define RES_VOLTAGE_DIVIDER(r1, r2) ((double)(r2) / ((double)(r1) + (double)(r2)))
#define RES_2_PARALLEL(r1, r2) (((r1) * (r2)) / ((r1) + (r2))) #define RES_2_PARALLEL(r1, r2) (((r1) * (r2)) / ((r1) + (r2)))
@ -26,4 +26,15 @@
#define RES_2_SERIAL(r1,r2) ((r1)+(r2)) #define RES_2_SERIAL(r1,r2) ((r1)+(r2))
// macro for the RC time constant on a 74LS123 with C > 1000pF
// R is in ohms, C is in farads
#define TIME_OF_74LS123(r,c) (0.45 * (double)(r) * (double)(c))
// macros for the RC time constant on a 555 timer IC
// R is in ohms, C is in farads
#define PERIOD_OF_555_MONOSTABLE_NSEC(r,c) ((attoseconds_t)(1100000000 * (double)(r) * (double)(c)))
#define PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c) ((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c)))
#define PERIOD_OF_555_MONOSTABLE(r,c) attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
#define PERIOD_OF_555_ASTABLE(r1,r2,c) attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
#endif // MAME_MACHINE_RESCAP_H #endif // MAME_MACHINE_RESCAP_H

View File

@ -24,17 +24,6 @@
#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, s32 param) #define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, s32 param)
// macro for the RC time constant on a 74LS123 with C > 1000pF
// R is in ohms, C is in farads
#define TIME_OF_74LS123(r,c) (0.45 * (double)(r) * (double)(c))
// macros for the RC time constant on a 555 timer IC
// R is in ohms, C is in farads
#define PERIOD_OF_555_MONOSTABLE_NSEC(r,c) ((attoseconds_t)(1100000000 * (double)(r) * (double)(c)))
#define PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c) ((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c)))
#define PERIOD_OF_555_MONOSTABLE(r,c) attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
#define PERIOD_OF_555_ASTABLE(r1,r2,c) attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
//************************************************************************** //**************************************************************************
// TYPE DEFINITIONS // TYPE DEFINITIONS

View File

@ -33,6 +33,7 @@
#include "emu.h" #include "emu.h"
#include "williams.h" #include "williams.h"
#include "machine/6821pia.h" #include "machine/6821pia.h"
#include "machine/rescap.h"
#include "cpu/m6809/m6809.h" #include "cpu/m6809/m6809.h"
#include "sound/ym2151.h" #include "sound/ym2151.h"
#include "sound/okim6295.h" #include "sound/okim6295.h"

View File

@ -101,6 +101,7 @@ Optional (on expansion card) (Viper)
#include "machine/gen_latch.h" #include "machine/gen_latch.h"
#include "machine/watchdog.h" #include "machine/watchdog.h"
#include "machine/bfm_comn.h" #include "machine/bfm_comn.h"
#include "machine/rescap.h"
#include "speaker.h" #include "speaker.h"
#include "sc1_vfd.lh" #include "sc1_vfd.lh"

View File

@ -160,6 +160,7 @@ Adder hardware:
#include "machine/bfm_bd1.h" // vfd #include "machine/bfm_bd1.h" // vfd
#include "machine/meters.h" #include "machine/meters.h"
#include "machine/rescap.h"
#include "speaker.h" #include "speaker.h"

View File

@ -90,6 +90,7 @@
#include "emu.h" #include "emu.h"
#include "includes/capbowl.h" #include "includes/capbowl.h"
#include "machine/rescap.h"
#include "machine/ticket.h" #include "machine/ticket.h"
#include "cpu/m6809/m6809.h" #include "cpu/m6809/m6809.h"
#include "sound/2203intf.h" #include "sound/2203intf.h"

View File

@ -200,6 +200,7 @@ VBlank duration: 1/VSYNC * (16/256) = 1017.6 us
#include "includes/gottlieb.h" #include "includes/gottlieb.h"
#include "machine/nvram.h" #include "machine/nvram.h"
#include "machine/rescap.h"
#include "machine/watchdog.h" #include "machine/watchdog.h"
#include "sound/dac.h" #include "sound/dac.h"
#include "speaker.h" #include "speaker.h"

View File

@ -19,6 +19,7 @@
#include "cpu/nec/nec.h" #include "cpu/nec/nec.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/adc0808.h" #include "machine/adc0808.h"
#include "machine/rescap.h"
#include "sound/2203intf.h" #include "sound/2203intf.h"
#include "sound/flt_vol.h" #include "sound/flt_vol.h"
#include "speaker.h" #include "speaker.h"

View File

@ -112,6 +112,7 @@ TODO: - Distinguish door switches using manual
#include "machine/steppers.h" #include "machine/steppers.h"
#include "machine/roc10937.h" #include "machine/roc10937.h"
#include "machine/meters.h" #include "machine/meters.h"
#include "machine/rescap.h"
#include "mpu3.lh" #include "mpu3.lh"

View File

@ -104,6 +104,7 @@
// pcw/pcw16 beeper // pcw/pcw16 beeper
#include "sound/beep.h" #include "sound/beep.h"
#include "machine/ram.h" #include "machine/ram.h"
#include "machine/rescap.h"
#include "render.h" #include "render.h"
#include "softlist.h" #include "softlist.h"
#include "speaker.h" #include "speaker.h"

View File

@ -264,6 +264,7 @@ TODO: - Distinguish door switches using manual
#include "video/awpvid.h" //Fruit Machines Only #include "video/awpvid.h" //Fruit Machines Only
#include "machine/rescap.h"
#include "speaker.h" #include "speaker.h"
#include "mpu4.lh" #include "mpu4.lh"