summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/imgtool/imghd.h
blob: c49e87fe8db08eed233f75ff9488d8a83d776e8b (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************

    imghd.h

    Bridge between Imgtool and CHD hard disk images

****************************************************************************/

#ifndef IMGHD_H
#define IMGHD_H

#include "imgterrs.h"

#include "chd.h"
#include "harddisk.h"


namespace imgtool
{
	class stream;
}

struct mess_hard_disk_file
{
	imgtool::stream *stream;
	hard_disk_file *hard_disk;
	chd_file chd;
};


/* create a new hard disk */
imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t blocksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen);

/* opens a hard disk given an Imgtool stream */
imgtoolerr_t imghd_open(imgtool::stream &stream, mess_hard_disk_file *hard_disk);

/* close a hard disk */
void imghd_close(struct mess_hard_disk_file *disk);

/* reads data from a hard disk */
imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, uint32_t lbasector, void *buffer);

/* writes data to a hard disk */
imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, uint32_t lbasector, const void *buffer);

/* gets the header from a hard disk */
const hard_disk_file::info &imghd_get_header(struct mess_hard_disk_file *disk);

#endif /* IMGHD_H */