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

cbmcopy.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 2001 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
00008 */
00009 
00010 /* $Id: cbmcopy.h,v 1.7 2006/04/10 15:46:58 trikalio Exp $ */
00011 
00012 #ifndef CBMCOPY_H
00013 #define CBMCOPY_H
00014 
00015 // #define CBMCOPY_DEBUG
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020     
00021 typedef struct
00022 {
00023     int transfer_mode;
00024     enum cbm_device_type_e drive_type;
00025 } cbmcopy_settings;
00026 
00027 typedef enum
00028 {
00029     sev_fatal,
00030     sev_warning,
00031     sev_info,
00032     sev_debug
00033 } cbmcopy_severity_e;
00034 
00035 typedef void (*cbmcopy_message_cb)(cbmcopy_severity_e sev, const char *format, ...);
00036 
00037 typedef int (*cbmcopy_status_cb)(int blocks_processed);
00038 
00039 #ifdef CBMCOPY_DEBUG
00040 /*
00041  * print out the state of internal counters that are used on read
00042  * and write transfers for debugging rare protocol races and hangups
00043  */
00044 extern void printDebugCounters(cbmcopy_message_cb msg_cb);
00045 #endif
00046 
00047 /*
00048  * Build '\0'-terminated list of '\0'-terminated transfer mode names.
00049  * Memory should be free()'d after use.
00050  */
00051 extern char *cbmcopy_get_transfer_modes();
00052 
00053 /*
00054  * parse transfer mode name ("serial1", "s2", "parallel"...) abbreviations
00055  * are possible
00056  */
00057 extern int cbmcopy_get_transfer_mode_index(const char *name);
00058 
00059 /*
00060  * find out if "auto" transfer mode was specified. If yet, determine
00061  * the best transfer mode we can use.
00062  */
00063 extern int cbmcopy_check_auto_transfer_mode(CBM_FILE cbm_fd,
00064                                             int auto_transfermode,
00065                                             int drive);
00066 
00067 /*
00068  * returns malloc()'d pointer to default settings.
00069  * must be free()'d after use.
00070  */
00071 extern cbmcopy_settings *cbmcopy_get_default_settings(void);
00072 
00073 extern int cbmcopy_write_file(CBM_FILE cbm_fd,
00074                               cbmcopy_settings *settings,
00075                               int drive,
00076                               const char *cbmname,
00077                               int cbmname_size,
00078                               const unsigned char *filedata,
00079                               int filedata_size,
00080                               cbmcopy_message_cb msg_cb,
00081                               cbmcopy_status_cb status_cb);
00082 
00083 extern int cbmcopy_read_file(CBM_FILE cbm_fd,
00084                              cbmcopy_settings *settings,
00085                              int drive,
00086                              const char *cbmname,
00087                              int cbmname_size,
00088                              unsigned char **filedata,
00089                              size_t *filedata_size,
00090                              cbmcopy_message_cb msg_cb,
00091                              cbmcopy_status_cb status_cb);
00092 
00093 extern int cbmcopy_read_file_ts(CBM_FILE cbm_fd,
00094                                 cbmcopy_settings *settings,
00095                                 int drive,
00096                                 int track, int sector,
00097                                 unsigned char **filedata,
00098                                 size_t *filedata_size,
00099                                 cbmcopy_message_cb msg_cb,
00100                                 cbmcopy_status_cb status_cb);
00101 
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105     
00106 #endif  /* CBMCOPY_H */

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