summaryrefslogblamecommitdiffstatshomepage
path: root/src/devices/machine/fdc_pll.h
blob: f99be2000a9c1c357c30891c9f4eccc457b7e183 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                                     



                              




                                                            




                                                                                         
 



                                  
 

                                               
                                              
                                                                                           
                                                                                      



                                                                                                        
 
                                     

  
                                
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_MACHINE_FDC_PLL_H
#define MAME_MACHINE_FDC_PLL_H

#pragma once

/*
 * Generic pll class for floppy controllers with analog plls
 */

#include "imagedev/floppy.h"

class fdc_pll_t {
public:
	attotime ctime, period, min_period, max_period, period_adjust_base, phase_adjust;

	attotime write_start_time;
	attotime write_buffer[32];
	int write_position;
	int freq_hist;

	void set_clock(const attotime &period);
	void reset(const attotime &when);
	void read_reset(const attotime &when);
	int get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit);
	int feed_read_data(attotime &tm, const attotime& edge, const attotime &limit);
	bool write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
	void start_writing(const attotime &tm);
	void commit(floppy_image_device *floppy, const attotime &tm);
	void stop_writing(floppy_image_device *floppy, const attotime &tm);

	std::string tts(attotime tm);
};

#endif // MAME_MACHINE_FDC_PLL_H