Category : HD Utilities
Archive   : MAXTEST.ZIP
Filename : MAXVARS.H

 
Output of file : MAXVARS.H contained in archive : MAXTEST.ZIP

/* filename: maxvars.inc */
/* programmer: Nancy Schulenburg */
/* date: April 20, 1990 */

/* all variables are defined in maxtest.c and defined as external here for other files */

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

#include
#include
#include
#include
#include
#include

#define mailbox_pairs 20 /* 20 mailboxes in and out */
#define last_mailbox_in 39 /* array position, not count [count would be 40] */

#define monochrome 0x30

#define left_arrow 75 /* scan codes */
#define right_arrow 77
#define up_arrow 72
#define down_arrow 80
#define page_up 73
#define page_down 81
#define home 71
#define end 79
#define delete 83

#define F1 59 /* function keys */
#define F2 60
#define F3 61
#define F4 62
#define F5 63
#define F6 64
#define F7 65
#define F8 66
#define F9 67
#define F10 68

#define control_a 0x01 /* control keys */
#define control_b 0x02
#define control_h 0x08
#define control_m 0x0D
#define control_p 0x10
#define control_s 0x13
#define control_t 0x14
#define control_u 0x15
#define control_w 0x17

#define ret 0x0D /* editing and printing */
#define blank 0x20
#define space 0x20
#define backspace 0x08
#define escape 0x1B
#define formfeed 0x0C
#define tab 0x09

#define interrupt_found 0 /* returned from do_timing and do_no_timing */
#define timed_out 1
#define key_hit 2

#define maxbytes_1540 0x10000L /* 1 64K buffer */
#define maxbytes_1540_d 0x20000L /* 2 64K buffers [A + B] */
#define maxbytes_1540A 0x100000L /* 16 64K buffers [wrapped] */
#define maxbytes_double 0x200000L /* 16 128K buffers [both buffers wrapped] */

#define left_edit_limit 5 /* columns that can be edited */
#define right_edit_limit 61
#define left_buf_limit 6
#define right_buf_limit 55

#define targ_id_col 44 /* display columns for commands */
#define lun_col 46
#define buf_name_col 49

#define buf_start_col 51
#define link_ccb_col 57
#define cmd_length_col 60

#define host_status_col 64
#define targ_status_col 67

#define sensekey_col 71
#define sensecode_col 74
#define add_sense_col 77

#define titlescreen 0 /* screens to swap in and out: maximum of 4 */
#define mainscreen 0 /* leave screen 1 for Codeview [for debugging] */

#define cont_on_err 0
#define stop_on_err 1
#define log_stop 2
#define log_cont 3

#define stop_any_host_err 0x1F /* masks */
#define exclude_linked_err 0x10
#define stop_any_targ_err 0xFF
#define check 0x02
#define interm_good 0x10
#define reserv_conflict 0x18

/* beep frequencies converted to count for beep routine [1193280 / desired frequency]

#define c4 4561 /* freq. = 261.63 hertz */
#define d4 4063 /* freq. = 293.66 */
#define e4 3620 /* freq. = 329.63 */
#define f4 3417 /* freq. = 349.23 */
#define g4 3044 /* freq. = 392.00 */
#define a4 2712 /* freq. = 440.00 */
#define b4 2416 /* freq. = 493.88 */
#define c5 2281 /* freq. = 523.25 */
#define e5 1810 /* freq. = 659.26 */
#define f5 1708 /* freq. = 698.46 */
#define b5 1208 /* freq. = 987.77 */
#define c6 1140 /* freq. = 1046.50 */

#define max_recordlength 350
#define max_headerlength 80
#define max_linelength 80
#define num_col 6

/* ports and interrupts used by serial chip */

#define com1_data 03F8H /* com1 data port */
#define com1_int_enable 03F9H /* Interrupt Enable Register */
#define com1_line_control 03FBH /* Line Control Register */
#define com1_modem_control 03FCH /* Modem Control Register */
#define com1_line_status 03FDH /* Line Status Register */
#define com1_int_number 0CH /* com1 interrupt number */
#define com1_int_mask 10H /* IRQ4 mask for 8259 */

#define com2_data 02F8H /* com2 data port */
#define com2_int_enable 02F9H /* Interrupt Enable Register */
#define com2_line_control 02FBH /* Line Control Register */
#define com2_modem_control 02FCH /* Modem Control Register */
#define com2_line_status 02FDH /* Line Status Register */
#define com2_int_number 0BH /* com2 interrupt number */
#define com2_int_mask 08H /* IRQ3 mask for 8259 */

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

/* unions to swap ends of digits: make LSB first (for IBM), last (for SCSI) */

typedef union longhex_char
{
unsigned long hex_long;
unsigned int hex_int [2];
unsigned char hex_bytes [4];
}
longhex_char;

typedef union inthex_char
{
unsigned int hex_int;
unsigned char hex_bytes [2];
}
inthex_char;

extern longhex_char data_length, data_pointer, link_pointer, mailbox_addr;
extern longhex_char LBA; /* used exclusively for incrementing commands */
extern longhex_char prev_LBA;
extern longhex_char random_seed; /* for setting random number generator seed */
extern longhex_char rand_LBA;

extern inthex_char data_blocks;

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

/* variables */

/* Ports used by serial chip [8250] */

extern unsigned int com_data; /* com1:3F8h, com2:2F8h */
extern unsigned int com_int_enable; /* com1:3F9h, com2:2F9h */
extern unsigned int com_line_control; /* com1:3FBh, com2:2FBh */
extern unsigned int com_modem_control; /* com1:3FCh, com2:2FCh */
extern unsigned int com_line_status; /* com1:3FDh, com2:2FDh */

/* Interrupt mask and com interrupt number */

extern unsigned char com_int_mask; /* com1:010h, com2:08h */
extern unsigned char com_int_number; /* com1:0Ch, com2:0Bh */

FILE *cmdfile, *logfile;
extern char *filename, *fileptr, *cmdptr, *logfileptr, *logbufptr;
extern int filehandle, logfilehandle;

extern char analyzer_timing; /* 1 = do analyzer timing, 0 = don't */
extern char timing_startphase;
extern char timing_endphase;
extern char timing_startdata;
extern char timing_enddata;
extern char sampletime;

extern char display_type_settled;
extern char bufferscreen, helpscreen, specialscreen, comscreen;
extern char currentscreen, displaytype;
extern char asciicol, asciicount, row, col;
extern char ha_type; /* host adapter type: for auto configuration */
extern char hostID; /* set by jumpers and read in read_configuration() */
extern char cmd_line_file; /* so we don't initialize the wrong thing */
extern char opcode, page;
extern char cmd_count, cmds_out, linked_cmd_count;
extern char incrementing, looping, randoming, timing;
extern char wrap, *buf_wrap_ptr;
extern char optionstring[80];
extern char LBA_num_bits, length_num_bits;
extern char errorfile[80]; /* log file for execution errors */
extern char linecount; /* used for log file only */
extern char *timingname;
extern char num_baseports;
extern char comport; /* com1 or com 2 are only options */
extern char comport_enabled; /* 0 = not enabled, non-0 = enabled */

extern unsigned int baseport;
extern unsigned int commandport0; /* write */
extern unsigned int statusport; /* read */
extern unsigned int commandport1; /* write */
extern unsigned int dataport_out; /* write */
extern unsigned int dataport_in; /* read */
extern unsigned int interruptport; /* read */

extern unsigned int baseports[6]; /* to store any baseport addresses found; for self_configure */
extern unsigned int pagenum; /* used for log file only */
extern unsigned int startaddress, file_length, returncode, num_bytes;
extern unsigned int compare_length;
extern unsigned int i, count, inword, offset, *wordptr;
extern unsigned int asciibyte, LBAsize, blocksize;
extern unsigned int stepcount, loopcount, loopcnt;
extern unsigned int total_passes; /* used for execution timing */
extern unsigned int total_time_overflow, total_passes_overflow; /* execution timing */
extern unsigned int result;
extern unsigned int error_num; /* used for log file */
extern unsigned int records_read; /* used for displaying logfile */
extern unsigned int startnum; /* log number to start display from, entered by user */
extern unsigned int firstnum; /* first log number found after read */
extern unsigned int comoffset_in, comoffset_out; /* com ring buffer offsets */
extern unsigned int beep1, beep2; /* user defined beep frequencies */
extern unsigned int fulltimercount, lasttimercount; /* used by asmstuff */
extern unsigned int totaltickcount; /* used by asmstuff...available to user */

extern float average_time; /* used for execution timing */
extern float totaltime_float;
extern float longest_time;
extern float shortest_time;

extern unsigned long maxblocks_1540, maxblocks_1540_d;
extern unsigned long maxblocks_1540A, maxblocks_double;
extern unsigned long lowest_LBA, highest_LBA, start_LBA, LBA_diff;
extern unsigned long buflength;
extern unsigned long totaltime; /* used for execution timing */
extern unsigned long maxtime, mintime, thistime; /* for execution timing */
extern unsigned long optionstring_passcount;
extern unsigned long myseed;

extern unsigned char intmask; /* interrupt mask used to mask and unmask board interrupts to computer */
extern unsigned char hibyte, lowbyte;
extern unsigned char keyin;
extern unsigned char cmd_num, inbyte, instring[81], buffer, *charptr;
extern unsigned char far bufa [0x10000], bufb [0x10000]; /* 2 data buffers */
extern unsigned char far *buf_ptr, *bufa_ptr, *bufb_ptr; /* buffer pointers */
extern unsigned char far *cmd_ptr, *data_ptr;
extern unsigned char int_num; /* save interrupt number so it can be restored at exit */
extern unsigned char no_screen_update; /* for faster command execution */
extern unsigned char tempstring[10], cmd_list[20], setup_data[16];
extern unsigned char last_mb_in; /* gets incremented before use */
extern unsigned char last_mb_out; /* gets incremented before use */
extern unsigned char *mb_out, *mb_in, mb;
extern unsigned char bytes; /* to count data bytes in for data pattern */
extern unsigned char databytes[20];
extern unsigned char shortest_length;
extern unsigned char longest_length, length, length_diff;
extern unsigned char highlight_attribute, normal_attribute;
extern unsigned char rand_string; /* non-zero = randomize by command string; 0 = by each command */
extern unsigned char rand_length; /* used only for randoming */
extern unsigned char status_check;
extern unsigned char status_interm_good;
extern unsigned char status_reserv_conf;

unsigned char stop_or_log;
unsigned char stop_on_host_status;
unsigned char stop_on_targ_status;
unsigned char beep_on_error;

extern unsigned char tickcount; /* counts timer ticks */
extern unsigned int timercount, timeout; /* count in seconds */
extern unsigned int ha_timeout;

extern char read_cmd_list_length; /* commands that will have transfer length checked */
extern char write_cmd_list_length; /* and transfer direction set */
extern unsigned char read_command [];
extern unsigned char write_command[];

extern unsigned char mailbox [40][4];
extern unsigned char ccb_addr [20][3]; /* absolute address for each ccb [converted to 3 bytes] */

extern union REGS inregs, outregs;

extern unsigned char commands[20][80];

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

/* variables from display logfile functions */

extern char *bufptr, *lineptr;
extern char first_read;
extern char lastrecord_found;
extern char logfile_found;

int limit;

extern int bytes_read;
extern int bytesleft; /* bytes left to process in buffer */
extern int nomorebytes; /* 1 means no more bytes in file to read */
extern int recordcount;
extern int loglinecount;

extern unsigned int records_processed; /* count of total records processed */
extern unsigned int thisrecord, lastrecord, firstrecord;

extern long fileposition;

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

/* DOS structures */

/* structures used for DOS get date and get time functions */
/* these structures are defined in dos.h */

struct dostime_t curtime;
struct dosdate_t date;

/* structure used for DOS find_first and find_next functions */
/* these are defined in dos.h, and are used for directory display */

struct find_t dir_entry;

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

char logbuf[3500]; /* to read in a chunk of logfile */

struct /* to store 1 printable page: 9 records */
{
char line0 [80];
char line1 [80];
char line2 [80];
char line3 [80];
char line4 [80];
}
record [9];

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

/* structure for error handling */

struct
{
char number; /* actually array position; here for human understanding */
char item; /* # of option as displayed on screen */
char row; /* row,col to mark/unmark as active item */
char col;
char active; /* non-zero = active; zero = inactive */
char name[44]; /* text description of error */
/* which numbers to make inactive when this one is chosen */
char make_inactive[9]; /* 'X' means there are no more valid entries */
}
error_options[14];

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

/* ccb structure; to interface with board */

extern struct
{
unsigned char opcode;
unsigned char byte1; /* targ. id, data out, data in, LUN */
unsigned char cmd_length;
unsigned char sense_length; /* maximum size */
unsigned char data_length [3];
unsigned char data_pointer [3]; /* where in data buffer */
unsigned char link_pointer [3]; /* next CDB in linked command */
unsigned char link_id; /* position in linked command chain */
unsigned char host_status; /* returned by host adapter */
unsigned char targ_status; /* drive status */
unsigned char byte16; /* reserved */
unsigned char byte17; /* reserved */
unsigned char command[12]; /* SCSI command, 6, 10, or 12 bytes */
unsigned char sense_data[256]; /* maximum sense data size */

struct /* segment tables for buffer wrapping [scatter/gather] */
{
unsigned char seg_length [3];
unsigned char seg_addr [3];
}
seg_list [16];
char letter_rand; /* 1 = yes, 0 = no */
} ccb[20];

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

/* variables loaded by asmstuff */

extern unsigned char inkey_hi, inkey_low; /* used for page and arrow key input */
extern unsigned char screenchar, attribute; /* used for reading screen at cursor */

extern unsigned int seeds[32]; /* low word random number seeds, for 1, 2, 4 byte random number */
extern unsigned int hiseeds[32]; /* hi word seeds for 4 byte random number */

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