fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/drivers/block/blkchd.h *
7 * Created: 2017-12-09 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2017-2019 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 PCE_DEVICES_BLOCK_BLKCHD_H
24#define PCE_DEVICES_BLOCK_BLKCHD_H 1
25
26
27#include <config.h>
28
29#include <drivers/block/block.h>
30
31#include <stdio.h>
32#include <stdint.h>
33
34
35#define CHD_CACHE_SIZE 16
36
37
38typedef struct {
39 disk_t dsk;
40
41 FILE *fp;
42
43 unsigned char header[128];
44
45 uint64_t map_offset;
46 uint64_t image_size;
47 uint32_t hunk_size;
48
49 uint32_t next_hunk;
50
51 unsigned char cache_valid[CHD_CACHE_SIZE];
52 uint32_t cache_src[CHD_CACHE_SIZE];
53 uint32_t cache_dst[CHD_CACHE_SIZE];
54
55 uint32_t hunks;
56 uint32_t *map;
57} disk_chd_t;
58
59
60disk_t *dsk_chd_open_fp (FILE *fp, int ro);
61disk_t *dsk_chd_open (const char *fname, int ro);
62
63int dsk_chd_create_fp (FILE *fp,
64 uint32_t n, uint32_t c, uint32_t h, uint32_t s
65);
66
67int dsk_chd_create (const char *fname,
68 uint32_t n, uint32_t c, uint32_t h, uint32_t s
69);
70
71int dsk_chd_probe_fp (FILE *fp);
72int dsk_chd_probe (const char *fname);
73
74
75#endif