1 // license:BSD-3-Clause 2 // copyright-holders:Nathan Woods 3 /**************************************************************************** 4 5 imghd.h 6 7 Bridge between Imgtool and CHD hard disk images 8 9 ****************************************************************************/ 10 11 #ifndef IMGHD_H 12 #define IMGHD_H 13 14 #include "harddisk.h" 15 16 struct mess_hard_disk_file 17 { 18 imgtool::stream *stream; 19 hard_disk_file *hard_disk; 20 chd_file chd; 21 }; 22 23 24 /* create a new hard disk */ 25 imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t blocksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen); 26 27 /* opens a hard disk given an Imgtool stream */ 28 imgtoolerr_t imghd_open(imgtool::stream &stream, mess_hard_disk_file *hard_disk); 29 30 /* close a hard disk */ 31 void imghd_close(struct mess_hard_disk_file *disk); 32 33 /* reads data from a hard disk */ 34 imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, uint32_t lbasector, void *buffer); 35 36 /* writes data to a hard disk */ 37 imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, uint32_t lbasector, const void *buffer); 38 39 /* gets the header from a hard disk */ 40 const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk); 41 42 #endif /* IMGHD_H */ 43