summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/fdc_pll.h
blob: 87244f405dc1862d30d7b004bf3878485ab3feda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef __FDC_PLL_H__
#define __FDC_PLL_H__

/*
 * 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