home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / devddemo.zip / STRUC.H < prev    next >
Text File  |  1991-01-31  |  8KB  |  265 lines

  1. /*****************************************************************************/
  2. /* This file contains all internal structures, unions, and typedefs used by  */
  3. /* the DD.                                                                   */
  4. /*****************************************************************************/
  5. /*****************************************************************************/
  6. /* Definition of a generic 32 bit value.  It can be a far pointer, 2 words   */
  7. /* A segmented address or a 32 bit unsigned integer (probably a phys addr)   */
  8. /*****************************************************************************/
  9. #ifndef NEWSCALARS
  10.    typedef unsigned      word;
  11.    typedef unsigned char byte;
  12.    typedef word          boolean;
  13.    #define NEWSCALARS 1
  14.    #endif
  15.  
  16. typedef unsigned long physaddr;  /* A physical address is 4 bytes */
  17. typedef void far * farptr;
  18.  
  19. typedef struct _2words_def {
  20.   unsigned low;
  21.   unsigned high;
  22.   } _2words_type;
  23.  
  24. typedef struct _segaddr_def {
  25.   unsigned offset;
  26.   unsigned segment;
  27.   } _segadr_type;
  28.  
  29. typedef union _32bits_def {
  30.    physaddr phys;
  31.    void far * fptr;
  32.    _2words_type _2words;
  33.    _segadr_type _segadr;
  34.    } _32bits;
  35.  
  36.  
  37. /*****************************************************************************/
  38. /* Definition of a the various request packets                               */
  39. /*****************************************************************************/
  40. struct reqhdr {
  41.    byte           rh_len;
  42.    byte           rh_unit;
  43.    byte           rh_cmd;
  44.    word           rh_stat;
  45.    byte          *rh_resrvd;
  46.    struct reqhdr *rh_next;
  47.    };
  48.  
  49. typedef struct reqhdr reqhdr_type;
  50.  
  51. struct init_hdr_in {
  52.    struct reqhdr  request_hdr;
  53.    byte           data1;
  54.    _32bits        pointer1;
  55.    byte          *pointer2;
  56.    byte           data2;
  57.    };
  58.  
  59. struct init_hdr_out {
  60.    struct reqhdr  request_hdr;
  61.    byte           data1;
  62.    word           code_end;
  63.    word           data_end;
  64.    byte          *pointer2;
  65.    byte           data2;
  66.    };
  67.  
  68. struct ioctl_hdr_in {
  69.    struct reqhdr  request_hdr;
  70.    byte           funct_cat;
  71.    byte           funct_cod;
  72.    _32bits        pbuffer;
  73.    _32bits        dbuffer;
  74.    word           file_number;
  75.    };
  76. typedef struct ioctl_hdr_in ioctl_hdr;
  77.  
  78. struct close_hdr_def {
  79.    byte           rh_len;
  80.    byte           rh_unit;
  81.    byte           rh_cmd;
  82.    word           rh_stat;
  83.    byte          *rh_resrvd;
  84.    struct reqhdr *rh_next;
  85.    word           file_number;
  86.    };
  87. typedef struct close_hdr_def close_hdr;
  88.  
  89. struct rw_hdr_def {
  90.    byte            rh_len;
  91.    byte            rh_unit;
  92.    byte            rh_cmd;
  93.    word            rh_stat;
  94.    byte           *rh_resrvd;
  95.    struct reqhdr  *rh_next;
  96.    byte            media;
  97.    byte           *xfer_address;
  98.    word            count;
  99.    unsigned long   start;
  100.    word            file_number;
  101.    };
  102. typedef struct rw_hdr_def rw_hdr;
  103.  
  104. /*****************************************************************************/
  105. /*                                                                           */
  106. /* Structures used by Global Info and Local Info calls                       */
  107. /*                                                                           */
  108. /*****************************************************************************/
  109. struct cur_time {
  110.    unsigned long sec_1970;
  111.    unsigned long msec_since_IPL;
  112.    unsigned char hours;
  113.    unsigned char minutes;
  114.    unsigned char seconds;
  115.    unsigned char hundredths;
  116.    unsigned timezone;
  117.    unsigned timer_interval;
  118.    };
  119.  
  120. struct cur_date {
  121.    unsigned char day;
  122.    unsigned char month;
  123.    unsigned year;
  124.    };
  125.  
  126. struct cur_vers {
  127.    unsigned char major;
  128.    unsigned char minor;
  129.    unsigned char revision;
  130.    };
  131.  
  132. struct cur_stat {
  133.    unsigned char max_sessions;
  134.    unsigned char huge_shift_cnt;
  135.    unsigned char prot_mode;
  136.    unsigned PID_of_last_charin;
  137.    };
  138.  
  139. struct cur_sched {
  140.    unsigned char dynamic_var;
  141.    unsigned char max_wait;
  142.    unsigned min_timeslice;
  143.    unsigned max_timeslice;
  144.    };
  145.  
  146. struct global_info_seg {
  147.    struct cur_time time_stuff;
  148.    struct cur_date date_stuff;
  149.    struct cur_vers vers_stuff;
  150.    unsigned char foreground;
  151.    struct cur_stat stat_stuff;
  152.    struct cur_sched sched_stuff;
  153.    unsigned char boot_drive;
  154.    unsigned char trace_flags[4];
  155.    };
  156.  
  157.  
  158. /*****************************************************************************/
  159. /*                                                                           */
  160. /* Structures used by dev_helper function interface                          */
  161. /*                                                                           */
  162. /*****************************************************************************/
  163. struct regs {
  164.    unsigned AX;
  165.    unsigned BX;
  166.    unsigned CX;
  167.    unsigned DX;
  168.    unsigned SI;
  169.    unsigned DI;
  170.    unsigned ES;
  171.    unsigned DS;
  172.    unsigned CS;
  173.    unsigned flags;
  174.    char  es_valid;
  175.    char  ds_valid;
  176.    };
  177.  
  178. struct regs_B {
  179.    unsigned char AL, AH;
  180.    unsigned char BL, BH;
  181.    unsigned char CL, CH;
  182.    unsigned char DL, DH;
  183.    unsigned SI;
  184.    unsigned DI;
  185.    unsigned ES;
  186.    unsigned DS;
  187.    unsigned CS;
  188.    unsigned flags;
  189.    char  es_valid;
  190.    char  ds_valid;
  191.    };
  192.  
  193. union cpu_regs {
  194.    struct regs W;
  195.    struct regs_B B;
  196.    };
  197.  
  198.  
  199. /*****************************************************************************/
  200. /*                                                                           */
  201. /* Structures used by ABIOS interface                                        */
  202. /*                                                                           */
  203. /*****************************************************************************/
  204. typedef struct function_parms_def {
  205.    unsigned req_blk_len;
  206.    unsigned LID;
  207.    unsigned unit;
  208.    unsigned function;
  209.    unsigned resvd1;
  210.    unsigned resvd2;
  211.    unsigned ret_code;
  212.    unsigned time_out;
  213.    } function_parms_type;
  214.  
  215. typedef struct service_parms_def {
  216.    byte slot_num;        /* 10h */
  217.    byte resvd3;          /* 11h */
  218.    word card_ID;         /* 12h */
  219.    word resvd4;          /* 14h */
  220.    byte *pos_buf;        /* 16h */
  221.    word resvd5;          /* 1Ah */
  222.    word resvd6;          /* 1Ch */
  223.    byte resvd7[40];      /* 1Eh */
  224.    } service_parms_type;
  225.  
  226. typedef struct lid_service_parms_def {
  227.    byte irpt_level;          /* 10h */
  228.    byte arb_level;           /* 11h */
  229.    unsigned device_id;       /* 12h */
  230.    unsigned unit_count;      /* 14h */
  231.    unsigned flags;           /* 16h */
  232.    unsigned blk_size;        /* 18h */
  233.    unsigned secnd_id;        /* 1Ah */
  234.    unsigned resvd6;          /* 1Ch */
  235.    unsigned resvd7;          /* 1Eh */
  236.    } lid_service_parms_type;
  237.  
  238. typedef struct req_block_def {
  239.    function_parms_type f_parms;
  240.    service_parms_type  s_parms;
  241.    } req_block_type;
  242.  
  243. typedef struct lid_block_def {
  244.    function_parms_type     f_parms;
  245.    lid_service_parms_type  s_parms;
  246.    } lid_block_type;
  247.  
  248.  
  249. /*****************************************************************************/
  250. /*                                                                           */
  251. /* Structure returned by DOSGetLocalInfo                                     */
  252. /*                                                                           */
  253. /*****************************************************************************/
  254. struct local_info_seg {
  255.    unsigned current_PID;
  256.    unsigned parent_PID;
  257.    unsigned priority;
  258.    unsigned thread_ID;
  259.    unsigned session;
  260.    unsigned unused;
  261.    unsigned keyboard_focus;
  262.    unsigned DOS_mode;
  263.    };
  264.  
  265.