fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/drivers/pfi/decode-bits.h *
7 * Created: 2013-12-25 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2013-2017 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PFI_DECODE_BITS_H
24#define PFI_DECODE_BITS_H 1
25
26
27#include <drivers/pfi/track.h>
28
29
30typedef struct {
31 unsigned long cnt;
32 unsigned long max;
33
34 unsigned long index;
35
36 unsigned char *buf;
37 unsigned char *weak;
38 unsigned long *clk;
39} pfi_dec_t;
40
41
42int pfi_dec_init (pfi_dec_t *buf, unsigned long max);
43void pfi_dec_free (pfi_dec_t *buf);
44int pfi_dec_alloc_bits (pfi_dec_t *buf, unsigned long cnt);
45int pfi_dec_add_bit (pfi_dec_t *buf, int val, int weak, unsigned long clk);
46
47void pfi_dec_clock_average (pfi_dec_t *bit);
48void pfi_dec_clock_median (pfi_dec_t *bit);
49
50int pfi_trk_decode_bits (pfi_trk_t *trk, pfi_dec_t *dst, unsigned long rate, unsigned rev);
51
52
53#endif