dc.h
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:8k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. /***
  2. * $Workfile:   dc.h  $
  3. * $Revision:   1.8  $
  4. *   $Author:   Dave Sewell  $
  5. *     $Date:   22 Oct 1990 14:59:36  $
  6. ***/
  7. /*  ebox.h : Alan Butt : December 19, 1988 : Expansion Box Project
  8.  
  9.     This file contains macros/constants/definitions for the slave program.
  10. */
  11. #include "osdep.h"                      // Include Paragon Library files
  12. #include "umfunc.h"
  13. #include "drivers.h"                    // Include ebox files
  14. #include "packets.h"
  15. #include "boxfunc.h"
  16. #include "cwuser.h"                     // Include C-Worthy Library files
  17. #include "userform.h"
  18. #include "str.h"
  19. /*  DOS_VERSION() takes two arguments.  The first is placed into the high byte
  20.     of an integer and the second into the low byte.  It is used to build
  21.     numbers to be compared with master_dos_version and slave_dos_version.
  22. */
  23. #define DOS_VERSION(x, y) (((x) << 8) | (y))
  24. #define MAX_SLAVE_DEVICES   26          // Max number of logical block devices
  25.                                         // on the slave system
  26. #define SCROLL_COLOR    (color(WHITE,BLACK) | MONO_NORMAL)
  27. #define WARNING_COLOR (color(WHITE, MAGENTA) | INTENSE | MONO_REVERSE)
  28. #define ERROR_COLOR    (color(WHITE, RED) | INTENSE | MONO_REVERSE)
  29. typedef void (pascal *PVF)(void);       // Pointer to Void Function type.
  30. typedef int  (*PIF)(void);              // Pointer to Integer Function type.
  31. typedef int  (*PIFW)(word);             // Pointer to Int Function/word argument
  32. struct device {
  33.     struct device_header far *header;   // Pointer to device driver header
  34.     void far *dpb;                      // Pointer to units DPB
  35.     word attribute;                     // Device driver attribute word
  36.     word bytes_per_sector;              // Bytes per sector on device
  37.     byte drive;                         // Drive # (0 = A, 1 = B, ...)
  38.     byte unit;                          // Unit number within driver
  39.     byte invalid;                       // Media invalid flag
  40.     byte media_descriptor;              // Media descriptor byte (0 if unknown)
  41.     unsigned long data_size;            // Size of data area in bytes.
  42.     byte number_of_fats;                // Number of FAT table copies.
  43.     byte sectors_per_cluster;           // Number of sectors per cluster.
  44.     byte non_removable;                 // TRUE if known to be non-removable
  45.     char volume_label[12];              // Volume label.
  46.     unsigned long serial_number;        // Volume serial number (0 if unknown)
  47.     byte is_floppy;                     // TRUE if A: or B: floppy disk
  48. };
  49. struct char_device {                    // Auxiliary device driver names
  50.     char master_name[DEVICE_NAME_SIZE]; // Name of device on master system
  51.     char slave_name[DEVICE_NAME_SIZE];  // Name of device on slave system
  52. };                                      // *master_name[] <= ' ' means invalid
  53. /*** The following bit is OR'ed into the baud rate if 7-wire mode is OK ***/
  54. #define PORT_LIST_SIZE  30
  55. struct config {
  56.     enum    baud baud;                  // Baud rate for serial communication
  57.     char    port_list[PORT_LIST_SIZE];  // Serial/Parallel ports to use
  58.     // Block driver init inforation
  59.     word    master_dos_version;         // DOS version of master (WORD format)
  60.     word    master_code;                // ID code of master driver
  61.     byte    master_max_devices;         // Max number of ebox devices on master
  62.     byte    master_first_unit;          // First drive number in master driver
  63. };
  64. enum connection_state { No_connection, Serial_connection, Parallel_connection,
  65.                         No_connection_repaint };
  66. extern char cdecl version[];            // Version number string
  67. /*  If EXTERN is not defined, the following declarations will be defined
  68.     as external.  If EXTERN is defined, they will be the real declarations.
  69.     EXTERN should only be defined in one module that includes this file.
  70. */
  71. #ifdef EXTERN
  72.     #undef EXTERN
  73.     #define EXTERN                      /* Insure EXTERN is "" */
  74.     #define __INITIALIZERS
  75. #else
  76.     #define EXTERN extern
  77. #endif
  78. #ifdef __INITIALIZERS
  79.     byte actual_prn_map[3] = { UNASSIGNED, UNASSIGNED, UNASSIGNED };
  80. #else
  81.     EXTERN byte actual_prn_map[3];
  82. #endif
  83. EXTERN int num_server_floppies;         // Number of floppy drives on server.
  84. EXTERN int slave_block_devices;         // Count of block devices on slave
  85. EXTERN struct device devices[MAX_SLAVE_DEVICES];
  86. EXTERN struct device_header far *lpt_drivers[3];   // Points to LPT1, LPT2, LPT3
  87. EXTERN word slave_dos_version;          // DOS version of slave (WORD format)
  88.                                         // The bytes in _osversion are backwords
  89. EXTERN byte drive_priority[26];
  90. EXTERN int num_drives;
  91. /* Buffer for packet information */
  92. EXTERN union {
  93.     byte                    packet_type;
  94.     struct init_packet_r    init_packet_r;
  95.     struct init_packet_a    init_packet_a;
  96.     struct media_check_r    media_check_r;
  97.     struct media_check_a    media_check_a;
  98.     struct build_bpb_r      build_bpb_r;
  99.     struct build_bpb_a      build_bpb_a;
  100.     struct io_r             io_r;
  101.     struct io_a             io_a;
  102.     struct error_r          error_r;
  103.     struct ocrm_r           ocrm_r;
  104.     struct ocrm_a           ocrm_a;
  105.     struct bios_r           bios_r;
  106.     struct bios_a           bios_a;
  107.     struct drive_info_r     drive_info_r;
  108.     struct gen_ioctl_r      gen_ioctl_r;
  109.     struct gen_ioctl_a      gen_ioctl_a;
  110.     struct lpt_o_r          lpt_o_r;
  111.     struct lpt_o_a          lpt_o_a;
  112.     struct lpt_cmd_r        lpt_cmd_r;
  113.     struct lpt_cmd_a        lpt_cmd_a;
  114.     // Note: drive_info_a packet might be too big to put in here.
  115. } packet;
  116. /* Device driver request header packets */
  117. EXTERN union {
  118.     struct static_rhp       s;
  119.     struct init_req         init_req;
  120.     struct init_ans         init_ans;
  121.     struct media_check_req  media_check_req;
  122.     struct media_check_ans  media_check_ans;
  123.     struct build_bpb_req    build_bpb_req;
  124.     struct build_bpb_ans    build_bpb_ans;
  125.     struct io_req           io_req;
  126.     struct io_ans           io_ans;
  127.     struct nd_read_ans      nd_read_ans;
  128.     struct gen_ioctl_req    gen_ioctl_req;
  129. } rhp;
  130. /* Configuration Structure */
  131. #ifdef __INITIALIZERS
  132.     struct config config = {
  133.         BAUD_38400,                         // Default starting baud rate
  134.         "LPT*,COM*bcdefghijklmnopqrst",
  135.         // Below is block device configuration information
  136.         DOS_VERSION(1, 0),                  // master DOS version
  137.         0,                                  // Master ID code
  138.         MAX_DEVICES,                        // Masters Max # of block devices
  139.         3                                   // First drive #
  140.     };
  141. #else
  142.     EXTERN struct config config;
  143. #endif
  144. #ifdef __INITIALIZERS
  145.     byte max_baud_server = 0xFF;
  146. #else
  147.     EXTERN byte max_baud_server;
  148. #endif
  149. /* Global Strings */
  150. #ifdef __INITIALIZERS
  151. char block_fingerprint[] = "INTERLNK";
  152. #else
  153. extern char block_fingerprint[];
  154. #endif
  155. EXTERN char far buffer[65536];          // A large buffer for I/O
  156. struct printer {
  157.     word address;
  158.     byte exported;
  159.     byte enabled;
  160. };
  161. EXTERN struct printer printers[3];
  162. EXTERN int num_lpt;
  163. #ifdef __INITIALIZERS
  164.     #undef __INITIALIZERS
  165. #endif
  166. #define S_SCANNING   0
  167. #define S_WAITING    1
  168. #define S_SENDING    2
  169. #define S_RECEIVING  3
  170. #define SDP_INACTIVE    0
  171. #define SDP_READING     1
  172. #define SDP_WRITING     2
  173. #define SDP_PRINTING    3
  174. #define TITLE_COLOR    ( color(WHITE,BLACK)| INTENSE | MONO_BOLD)
  175. #define STATUS_COLOR   ( color(WHITE,CYAN) | INTENSE | MONO_REVERSE)
  176. #define ALT_F4      0x16b