branches/alto2/src/emu/drivers/xtal.h
| r26159 | r26160 | |
| 1 | 1 | /************************************************************************* |
| 2 | 2 | |
| 3 | | xtal.h |
| 3 | xtal.h |
| 4 | 4 | |
| 5 | | Documentation and consistent naming for known existing crystals. |
| 5 | Documentation and consistent naming for known existing crystals. |
| 6 | 6 | |
| 7 | | Copyright Nicola Salmoria and the MAME Team. |
| 8 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | 9 | |
| 10 | 10 | *************************************************************************** |
| 11 | 11 | |
| 12 | | PCB Crystal Reference |
| 13 | | ---------------------- |
| 14 | | _____ ________ |
| 15 | | |16 | |o | |
| 16 | | |MHZ| |16.0MHZ | |
| 17 | | |___| |________| |
| 18 | | | | |
| 12 | PCB Crystal Reference |
| 13 | ---------------------- |
| 14 | _____ ________ |
| 15 | |16 | |o | |
| 16 | |MHZ| |16.0MHZ | |
| 17 | |___| |________| |
| 18 | | | |
| 19 | 19 | |
| 20 | | There is a finite list of _manufactured_ crystals. This file aims |
| 21 | | to document all of the known speeds that crystals were available in. |
| 22 | | Feel free to add to the list if you find another speed crystal on |
| 23 | | a PCB, but please DON'T GUESS! |
| 20 | There is a finite list of _manufactured_ crystals. This file aims |
| 21 | to document all of the known speeds that crystals were available in. |
| 22 | Feel free to add to the list if you find another speed crystal on |
| 23 | a PCB, but please DON'T GUESS! |
| 24 | 24 | |
| 25 | | Remember that some very high frequencies (typically above 100MHz) are |
| 26 | | generated by a frequency multiplying IC from a lower frequency |
| 27 | | crystal. |
| 25 | Remember that some very high frequencies (typically above 100MHz) are |
| 26 | generated by a frequency multiplying IC from a lower frequency |
| 27 | crystal. |
| 28 | 28 | |
| 29 | | This is intended as a reference of existing parts to prevent incorrect |
| 30 | | clock speed measurements with digital frequency counters being used |
| 31 | | in drivers. When measuring clocks, remember that most parts have a |
| 32 | | tolerance so be sure to reference existing parts only and not just |
| 33 | | accept direct readings as 100% true. |
| 29 | This is intended as a reference of existing parts to prevent incorrect |
| 30 | clock speed measurements with digital frequency counters being used |
| 31 | in drivers. When measuring clocks, remember that most parts have a |
| 32 | tolerance so be sure to reference existing parts only and not just |
| 33 | accept direct readings as 100% true. |
| 34 | 34 | |
| 35 | | MAME doesn't yet support fractions in crystal frequencies. For example, |
| 36 | | XTAL_3_579545MHz should actually be 3579545.454545...Hz (39375000/11). |
| 37 | | This is no problem though: see above note about tolerance. |
| 35 | MAME doesn't yet support fractions in crystal frequencies. For example, |
| 36 | XTAL_3_579545MHz should actually be 3579545.454545...Hz (39375000/11). |
| 37 | This is no problem though: see above note about tolerance. |
| 38 | 38 | |
| 39 | | (Thanks to Guru for starting this documentation.) |
| 39 | (Thanks to Guru for starting this documentation.) |
| 40 | 40 | |
| 41 | 41 | **************************************************************************/ |
| 42 | 42 | |
| 43 | 43 | enum |
| 44 | 44 | { |
| 45 | 45 | /* |
| 46 | | Name = Frequency Examples |
| 47 | | ------------------ ------------ ------------------------------------------------------------ */ |
| 46 | Name = Frequency Examples |
| 47 | ------------------ ------------ ------------------------------------------------------------ */ |
| 48 | 48 | XTAL_32_768kHz = 32768, /* 32.768kHz, used to drive RTC chips */ |
| 49 | 49 | XTAL_1MHz = 1000000, /* Used to drive OKI M6295 chips */ |
| 50 | 50 | XTAL_1_75MHz = 1750000, /* RCA CDP1861 */ |
| r26159 | r26160 | |
| 173 | 173 | XTAL_28_37516MHz = 28375160, /* Amiga PAL systems */ |
| 174 | 174 | XTAL_28_48MHz = 28480000, /* Chromatics CGC-7900 */ |
| 175 | 175 | XTAL_28_63636MHz = 28636363, /* Later Leland games and Atari GT, Amiga NTSC, Raiden2 h/w (8x NTSC subcarrier)*/ |
| 176 | XTAL_29_4912MHz = 29491200, /* Xerox Alto-II system clock (tagged 29.4MHz in the schematics) */ |
| 176 | 177 | XTAL_30MHz = 30000000, /* Impera Magic Card */ |
| 177 | 178 | XTAL_30_4761MHz = 30476100, /* Taito JC */ |
| 178 | 179 | XTAL_30_8MHz = 30800000, /* 15IE-00-013 */ |
branches/alto2/src/emu/machine/diablo_hd.c
| r26159 | r26160 | |
| 96 | 96 | m_wrlast(-1), |
| 97 | 97 | m_sector_callback_cookie(0), |
| 98 | 98 | m_sector_callback(0), |
| 99 | | m_sector_timer(0), |
| 99 | m_timer(0), |
| 100 | 100 | m_image(0), |
| 101 | 101 | m_handle(0), |
| 102 | 102 | m_disk(0) |
| r26159 | r26160 | |
| 153 | 153 | #define DIABLO31_SECTOR_MARK_PULSE_POST DIABLO31_BIT_TIME(16) //!< pulse width of sector mark after the next sector began |
| 154 | 154 | |
| 155 | 155 | #define DIABLO44_ROTATION_TIME attotime::from_msec(25) //!< DIABLO 44 rotation time is approx. 25ms |
| 156 | | #define DIABLO44_SECTOR_TIME attotime::from_msec(25/12) //!< DIABLO 44 sector time |
| 157 | | |
| 156 | #define DIABLO44_SECTOR_TIME attotime::from_msec(25/12) //!< DIABLO 44 sector time |
| 158 | 157 | /** |
| 159 | 158 | * @brief DIABLO 44 bit clock is 5000kHz ~= 200ns per bit |
| 160 | 159 | * ~= 125184 bits/track (?) |
| r26159 | r26160 | |
| 1199 | 1198 | } |
| 1200 | 1199 | |
| 1201 | 1200 | /** |
| 1202 | | * @brief timer callback that is called thrice per sector in the rotation |
| 1203 | | * |
| 1204 | | * The timer is called three times at the events: |
| 1205 | | * 0: sector mark goes inactive |
| 1206 | | * 1: sector mark goes active |
| 1207 | | * 2: in the middle of the active phase |
| 1208 | | * |
| 1209 | | * @param id timer id |
| 1210 | | * @param arg argument supplied to timer_insert (unused) |
| 1211 | | */ |
| 1212 | | void diablo_hd_device::next_sector(void* ptr, int arg) |
| 1213 | | { |
| 1214 | | (void)ptr; |
| 1215 | | |
| 1216 | | switch (arg) { |
| 1217 | | case 0: |
| 1218 | | m_sector_timer->adjust(m_sector_mark_0_time, 1); |
| 1219 | | /* deassert sector mark */ |
| 1220 | | sector_mark_1(); |
| 1221 | | break; |
| 1222 | | case 1: |
| 1223 | | m_sector_timer->adjust(m_sector_mark_1_time, 2); |
| 1224 | | /* assert sector mark */ |
| 1225 | | sector_mark_0(); |
| 1226 | | break; |
| 1227 | | case 2: |
| 1228 | | /* next sector starting soon now */ |
| 1229 | | m_sector_timer->adjust(m_sector_time - m_sector_mark_0_time, 0); |
| 1230 | | /* call the sector_callback, if any */ |
| 1231 | | if (m_sector_callback) |
| 1232 | | (void)(*m_sector_callback)(m_sector_callback_cookie, m_unit); |
| 1233 | | } |
| 1234 | | } |
| 1235 | | |
| 1236 | | /** |
| 1237 | 1201 | * @brief deassert the sector mark |
| 1238 | 1202 | * |
| 1239 | 1203 | */ |
| r26159 | r26160 | |
| 1275 | 1239 | void diablo_hd_device::device_start() |
| 1276 | 1240 | { |
| 1277 | 1241 | m_image = static_cast<diablo_image_device *>(subdevice("drive")); |
| 1278 | | LOG_DRIVE((0," m_image=%p\n", m_image)); |
| 1279 | 1242 | |
| 1280 | 1243 | m_diablo31 = true; // FIXME: get from m_handle meta data? |
| 1281 | 1244 | m_packs = 1; // FIXME: get from configuration? |
| 1282 | 1245 | |
| 1246 | m_cache = global_alloc_array(UINT8*, DIABLO_PAGES); |
| 1247 | m_bits = global_alloc_array(UINT32*, DIABLO_PAGES); |
| 1248 | |
| 1249 | m_timer = timer_alloc(1, 0); |
| 1250 | } |
| 1251 | |
| 1252 | void diablo_hd_device::device_reset() |
| 1253 | { |
| 1254 | m_handle = m_image->get_chd_file(); |
| 1255 | m_disk = m_image->get_hard_disk_file(); |
| 1256 | LOG_DRIVE((0,"[DIABLO] m_image=%p m_handle=%p m_disk=%p\n", m_image, m_handle, m_disk)); |
| 1257 | |
| 1283 | 1258 | if (m_diablo31) { |
| 1284 | 1259 | snprintf(m_description, sizeof(m_description), "DIABLO31"); |
| 1285 | 1260 | m_rotation_time = DIABLO31_ROTATION_TIME; |
| r26159 | r26160 | |
| 1295 | 1270 | m_sector_mark_1_time = DIABLO44_SECTOR_MARK_PULSE_PRE; |
| 1296 | 1271 | m_bit_time = DIABLO44_BIT_TIME(1); |
| 1297 | 1272 | } |
| 1273 | LOG_DRIVE((0,"[DIABLO] rotation time : %.0fns\n", 1e9 * m_rotation_time.as_double())); |
| 1274 | LOG_DRIVE((0,"[DIABLO] sector time : %.0fns\n", 1e9 * m_sector_time.as_double())); |
| 1275 | LOG_DRIVE((0,"[DIABLO] sector mark 0 time : %.0fns\n", 1e9 * m_sector_mark_0_time.as_double())); |
| 1276 | LOG_DRIVE((0,"[DIABLO] sector mark 1 time : %.0fns\n", 1e9 * m_sector_mark_1_time.as_double())); |
| 1277 | LOG_DRIVE((0,"[DIABLO] bit time : %.0fns\n", 1e9 * m_bit_time.as_double())); |
| 1298 | 1278 | |
| 1299 | | m_cache = global_alloc_array(UINT8*, DIABLO_PAGES); |
| 1300 | | m_bits = global_alloc_array(UINT32*, DIABLO_PAGES); |
| 1301 | | |
| 1302 | | m_sector_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(diablo_hd_device::next_sector),this)); |
| 1303 | | m_sector_timer->adjust(m_sector_time - m_sector_mark_0_time, 0); |
| 1304 | | } |
| 1305 | | |
| 1306 | | void diablo_hd_device::device_reset() |
| 1307 | | { |
| 1308 | | m_handle = m_image->get_chd_file(); |
| 1309 | | m_disk = m_image->get_hard_disk_file(); |
| 1310 | | LOG_DRIVE((0," m_handle=%p m_disk=%p\n", m_image, m_handle, m_disk)); |
| 1311 | | |
| 1312 | 1279 | m_s_r_w_0 = 1; /* seek/read/write not ready */ |
| 1313 | 1280 | m_ready_0 = 1; /* drive is not ready */ |
| 1314 | 1281 | m_sector_mark_0 = 1; /* sector mark clear */ |
| r26159 | r26160 | |
| 1332 | 1299 | m_wrlast = -1; |
| 1333 | 1300 | m_rdfirst = -1; |
| 1334 | 1301 | m_rdlast = -1; |
| 1302 | |
| 1303 | timer_set(m_sector_time - m_sector_mark_0_time, 1, 0); |
| 1335 | 1304 | } |
| 1336 | 1305 | |
| 1306 | /** |
| 1307 | * @brief timer callback that is called thrice per sector in the rotation |
| 1308 | * |
| 1309 | * The timer is called three times at the events: |
| 1310 | * 0: sector mark goes inactive |
| 1311 | * 1: sector mark goes active |
| 1312 | * 2: in the middle of the active phase |
| 1313 | * |
| 1314 | * @param id timer id |
| 1315 | * @param arg argument supplied to timer_insert (unused) |
| 1316 | */ |
| 1317 | void diablo_hd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 1318 | { |
| 1319 | LOG_DRIVE((0,"[DIABLO] id=%d param=%d ptr=%p timer expires in %lldns\n", id, param, ptr)); |
| 1320 | |
| 1321 | switch (param) { |
| 1322 | case 0: |
| 1323 | timer.adjust(m_sector_mark_0_time, 1); |
| 1324 | /* deassert sector mark */ |
| 1325 | sector_mark_1(); |
| 1326 | break; |
| 1327 | case 1: |
| 1328 | timer.adjust(m_sector_mark_1_time, 2); |
| 1329 | /* assert sector mark */ |
| 1330 | sector_mark_0(); |
| 1331 | break; |
| 1332 | case 2: |
| 1333 | /* next sector starting soon now */ |
| 1334 | timer.adjust(m_sector_time - m_sector_mark_0_time, 0); |
| 1335 | /* call the sector_callback, if any */ |
| 1336 | if (m_sector_callback) |
| 1337 | (void)(*m_sector_callback)(m_sector_callback_cookie, m_unit); |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1337 | 1341 | MACHINE_CONFIG_FRAGMENT( diablo_drive ) |
| 1338 | 1342 | MCFG_DIABLO_ADD("drive") |
| 1339 | 1343 | MACHINE_CONFIG_END |
branches/alto2/src/emu/machine/diablo_hd.h
| r26159 | r26160 | |
| 67 | 67 | int rd_clock(int index); |
| 68 | 68 | |
| 69 | 69 | protected: |
| 70 | | virtual void device_start(); |
| 71 | | virtual void device_reset(); |
| 70 | virtual void device_start(); |
| 71 | virtual void device_reset(); |
| 72 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 72 | 73 | virtual machine_config_constructor device_mconfig_additions() const; |
| 73 | 74 | |
| 74 | 75 | private: |
| r26159 | r26160 | |
| 111 | 112 | int m_wrlast; //!< set to last bit of a sector that was written to |
| 112 | 113 | void *m_sector_callback_cookie; //!< cookie to pass to callback |
| 113 | 114 | void (*m_sector_callback)(void*,int); //!< callback to call at the start of each sector |
| 114 | | emu_timer* m_sector_timer; //!< sector timer |
| 115 | emu_timer* m_timer; //!< sector timer |
| 115 | 116 | diablo_image_device* m_image; //!< diablo_image_device interfacing the CHD |
| 116 | 117 | chd_file* m_handle; //!< underlying CHD handle |
| 117 | 118 | hard_disk_file* m_disk; //!< underlying hard disk file |
| r26159 | r26160 | |
| 160 | 161 | //! squeeze a array of clock and data bits into a sector's data |
| 161 | 162 | void squeeze_sector(); |
| 162 | 163 | |
| 163 | | //! timer callback that is called thrice per sector in the rotation |
| 164 | | TIMER_CALLBACK_MEMBER( next_sector ); |
| 165 | | |
| 166 | 164 | //! deassert the sector mark |
| 167 | 165 | void sector_mark_1(); |
| 168 | 166 | |
| r26159 | r26160 | |
| 171 | 169 | }; |
| 172 | 170 | |
| 173 | 171 | #define MCFG_DIABLO_DRIVES_ADD() \ |
| 174 | | MCFG_DEVICE_ADD(DIABLO_HD_0, DIABLO_HD, 0) \ |
| 175 | | MCFG_DEVICE_ADD(DIABLO_HD_1, DIABLO_HD, 0) \ |
| 172 | MCFG_DEVICE_ADD(DIABLO_HD_0, DIABLO_HD, ATTOSECONDS_TO_HZ(attotime::from_nsec(300).as_double())) \ |
| 173 | MCFG_DEVICE_ADD(DIABLO_HD_1, DIABLO_HD, ATTOSECONDS_TO_HZ(attotime::from_nsec(300).as_double())) \ |
| 176 | 174 | |
| 177 | 175 | #endif // !defined(_DIABLO_HD_DEVICE_) |