Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

d64copy.h

00001 /*
00002  *      This program is free software; you can redistribute it and/or
00003  *      modify it under the terms of the GNU General Public License
00004  *      as published by the Free Software Foundation; either version
00005  *      2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 1999-2001 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
00008 */
00009 
00010 /* $Id: d64copy.h,v 1.6 2006/02/24 12:01:08 trikalio Exp $ */
00011 
00012 #ifndef D64COPY_H
00013 #define D64COPY_H
00014 
00015 #define MAX_TRACKS   70   /* for .d71 */
00016 #define MAX_SECTORS  21
00017     
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 /*
00023  *  known BAM modes
00024  */
00025 typedef enum
00026 {
00027     bm_ignore = 0,      /* all sectors                    */
00028     bm_allocated = 1,   /* allocated sectors              */
00029     bm_save = 2         /* allocated sectors + BAM track  */
00030 } d64copy_bam_mode;
00031 
00032 typedef enum
00033 {
00034     em_always,
00035     em_on_error,
00036     em_never
00037 } d64copy_error_mode;
00038 
00039 typedef enum
00040 {
00041     bs_invalid = 0,
00042     bs_dont_copy = 1,
00043     bs_must_copy = 2,
00044     bs_error = 3,
00045     bs_copied = 4
00046 } d64copy_bam_status;
00047 
00048 typedef struct
00049 {
00050     int warp;
00051     int retries;
00052     int interleave;
00053     int start_track;
00054     int end_track;
00055     int two_sided;
00056     int transfer_mode;
00057     enum cbm_device_type_e drive_type;
00058     d64copy_bam_mode bam_mode;
00059     d64copy_error_mode error_mode;
00060 } d64copy_settings;
00061 
00062 typedef struct
00063 {
00064     int track;
00065     int sector;
00066     int read_result;
00067     int write_result;
00068     int sectors_processed;
00069     int total_sectors;
00070     d64copy_settings *settings;
00071     char bam[MAX_TRACKS][MAX_SECTORS+1];
00072 } d64copy_status;
00073 
00074 typedef void (*d64copy_message_cb)(int sev, const char *format, ...);
00075 typedef int (*d64copy_status_cb)(d64copy_status status);
00076 
00077 /*
00078  * Build '\0'-terminated list of '\0'-terminated transfer mode names.
00079  * Memory should be free()'d after use.
00080  */
00081 extern char *d64copy_get_transfer_modes();
00082 
00083 /*
00084  * parse transfer mode name ("serial1", "s2", "parallel"...) abbreviations
00085  * are possible
00086  */
00087 extern int d64copy_get_transfer_mode_index(const char *name);
00088 
00089 /*
00090  * find out if "auto" transfer mode was specified. If yet, determine
00091  * the best transfer mode we can use.
00092  */
00093 extern int d64copy_check_auto_transfer_mode(CBM_FILE cbm_fd,
00094                                             int auto_transfermode,
00095                                             int drive);
00096 
00097 /*
00098  * returns malloc()'d pointer to default settings.
00099  * must be free()'d after use.
00100  */
00101 extern d64copy_settings *d64copy_get_default_settings(void);
00102 
00103 /*
00104  * return number of sectors on a given track, -1 if invalid
00105  */
00106 extern int d64copy_sector_count(int two_sided, int track);
00107 
00108 extern int d64copy_read_image(CBM_FILE cbm_fd,
00109                               d64copy_settings *settings,
00110                               int src_drive,
00111                               const char *dst_image,
00112                               d64copy_message_cb msg_cb,
00113                               d64copy_status_cb status_cb);
00114 
00115 extern int d64copy_write_image(CBM_FILE cbm_fd,
00116                                d64copy_settings *settings,
00117                                const char *src_image,
00118                                int dst_drive,
00119                                d64copy_message_cb msg_cb,
00120                                d64copy_status_cb status_cb);
00121 
00122 extern void d64copy_cleanup(void);
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127 
00128 #endif  /* D64COPY_H */

Generated on Sun Apr 30 18:45:46 2006 for opencbm by  doxygen 1.4.2