1 #ifndef UAE_CATWEASEL_H 2 #define UAE_CATWEASEL_H 3 4 #ifdef CATWEASEL 5 6 extern struct catweasel_contr cwc; 7 extern int catweasel_read_keyboard (uae_u8 *keycode); 8 extern int catweasel_init (void); 9 extern void catweasel_free (void); 10 extern int catweasel_detect (void); 11 extern uae_u32 catweasel_do_bget (uaecptr addr); 12 extern void catweasel_do_bput (uaecptr addr, uae_u32 b); 13 extern int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons); 14 extern void catweasel_hsync (void); 15 extern int catweasel_isjoystick(void); 16 extern int catweasel_ismouse(void); 17 extern int catweasel_read_mouse(int port, int *dx, int *dy, int *buttons); 18 19 typedef struct catweasel_drive { 20 struct catweasel_contr *contr; /* The controller this drive belongs to */ 21 int number; /* Drive number: 0 or 1 */ 22 int type; /* 0 = not present, 1 = 3.5" */ 23 int track; /* current r/w head position (0..79) */ 24 int diskindrive; /* 0 = no disk, 1 = disk in drive */ 25 int wprot; /* 0 = not, 1 = write protected */ 26 unsigned char sel; 27 unsigned char mot; 28 } catweasel_drive; 29 30 typedef struct catweasel_contr { 31 int type; /* see CATWEASEL_TYPE_* defines below */ 32 int direct_access; 33 int direct_type; 34 int iobase; /* 0 = not present (factory default is 0x320) */ 35 void (*msdelay)(int ms); /* microseconds delay routine, provided by host program */ 36 catweasel_drive drives[2]; /* at most two drives on each controller */ 37 int control_register; /* contents of control register */ 38 unsigned char crm_sel0; /* bit masks for the control / status register */ 39 unsigned char crm_sel1; 40 unsigned char crm_mot0; 41 unsigned char crm_mot1; 42 unsigned char crm_dir; 43 unsigned char crm_step; 44 unsigned char srm_trk0; 45 unsigned char srm_dchg; 46 unsigned char srm_writ; 47 unsigned char srm_dskready; 48 int io_sr; /* IO port of control / status register */ 49 int io_mem; /* IO port of memory register */ 50 int sid[2]; 51 int can_sid, can_mouse, can_joy, can_kb; 52 } catweasel_contr; 53 54 #define CATWEASEL_TYPE_NONE -1 55 #define CATWEASEL_TYPE_MK1 1 56 #define CATWEASEL_TYPE_MK3 3 57 #define CATWEASEL_TYPE_MK4 4 58 59 /* Initialize a Catweasel controller; c->iobase and c->msdelay must have 60 been initialized -- msdelay might be used */ 61 void catweasel_init_controller(catweasel_contr *c); 62 63 /* Reset the controller */ 64 void catweasel_free_controller(catweasel_contr *c); 65 66 /* Set current drive select mask */ 67 void catweasel_select(catweasel_contr *c, int dr0, int dr1); 68 69 /* Start/stop the drive's motor */ 70 void catweasel_set_motor(catweasel_drive *d, int on); 71 72 /* Move the r/w head */ 73 int catweasel_step(catweasel_drive *d, int dir); 74 75 /* Check for a disk change and update d->diskindrive 76 -- msdelay might be used. Returns 1 == disk has been changed */ 77 int catweasel_disk_changed(catweasel_drive *d); 78 79 /* Check if disk in selected drive is write protected. */ 80 int catweasel_write_protected(catweasel_drive *d); 81 82 /* Read data -- msdelay will be used */ 83 int catweasel_read(catweasel_drive *d, int side, int clock, int time); 84 85 /* Write data -- msdelay will be used. If time == -1, the write will 86 be started at the index pulse and stopped at the next index pulse, 87 or earlier if the Catweasel RAM contains a 128 end byte. The 88 function returns after the write has finished. */ 89 int catweasel_write(catweasel_drive *d, int side, int clock, int time); 90 91 int catweasel_fillmfm (catweasel_drive *d, uae_u16 *mfm, int side, int clock, int rawmode); 92 93 int catweasel_diskready(catweasel_drive *d); 94 int catweasel_track0(catweasel_drive *d); 95 96 97 #endif /* CATWEASEL */ 98 99 #endif /* UAE_CATWEASEL_H */ 100