home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / pktsend.zip / DEFS.ASM < prev    next >
Assembly Source File  |  1991-03-25  |  5KB  |  153 lines

  1. majver        equ    9        ;version number of the infrastructure.
  2.  
  3. MAX_ADDR_LEN    equ    16        ;maximum number of bytes in our address.
  4.  
  5. MAX_HANDLE    equ    10        ;maximum number of handles.
  6.  
  7. MAX_P_LEN    equ    8        ;maximum type length
  8.  
  9. MAX_MULTICAST    equ    8        ;maximum number of multicast addresses.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. HT    equ    09h
  27. CR    equ    0dh
  28. LF    equ    0ah
  29.  
  30. ;
  31. ;  Packet Driver Error numbers
  32. NO_ERROR    equ    0        ;no error at all.
  33. BAD_HANDLE    equ    1        ;invalid handle number
  34. NO_CLASS    equ    2        ;no interfaces of specified class found
  35. NO_TYPE        equ    3        ;no interfaces of specified type found
  36. NO_NUMBER    equ    4        ;no interfaces of specified number found
  37. BAD_TYPE    equ    5        ;bad packet type specified
  38. NO_MULTICAST    equ    6        ;this interface does not support
  39.                     ;multicast
  40. CANT_TERMINATE    equ    7        ;this packet driver cannot terminate
  41. BAD_MODE    equ    8        ;an invalid receiver mode was specified
  42. NO_SPACE    equ    9        ;operation failed because of
  43.                     ;insufficient space
  44. TYPE_INUSE    equ    10        ;the type had previously been accessed,
  45.                     ;and not released.
  46. BAD_COMMAND    equ    11        ;the command was out of range, or not
  47.                     ;implemented
  48. CANT_SEND    equ    12        ;the packet couldn't be sent (usually
  49.                     ;hardware error)
  50. CANT_SET    equ    13        ;hardware address couldn't be changed
  51.                     ;(more than 1 handle open)
  52. BAD_ADDRESS    equ    14        ;hardware address has bad length or
  53.                     ;format
  54. CANT_RESET    equ    15        ;Couldn't reset interface (more than
  55.                     ;1 handle open).
  56. BAD_IOCB    equ    16        ;an invalid iocb was specified
  57.  
  58. ;a few useful Ethernet definitions.
  59. RUNT        equ    60        ;smallest legal size packet, no fcs
  60. GIANT        equ    1514        ;largest legal size packet, no fcs
  61. EADDR_LEN    equ    6        ;Ethernet address length.
  62. ARCADDR_LEN    equ    1
  63.  
  64. BLUEBOOK    equ    1
  65. IEEE8023    equ    11
  66.  
  67. ;The following two macros are used to manipulate port addresses.
  68. ;Use loadport to initialize dx.  Use setport to set a specific port on
  69. ;the board.  setport remembers what the current port number is, but beware!
  70. ;setport assumes that code is being executed in the same order as the
  71. ;code is presented in the source file.  Whenever this assumption is violated,
  72. ;you need to enter another loadport.  Some, but not all examples are:
  73. ;in a loop with multiple setports, or a backward jump over a setport, or
  74. ;a forward jump over a setport.  If you have any doubt, consult the
  75. ;individual driver sources for examples of usage.  If you suspect that
  76. ;you have too few loadports, define the symbol "no_confidence" to a
  77. ;one.  This will force a loadport before every setport.  If you wish to turn
  78. ;it off for some of your code, redefine it to a zero.
  79.  
  80. loadport    macro
  81.     mov    dx,io_addr
  82. port_no    =    0
  83.     endm
  84.  
  85. ;change the port number from the current value to the new value.
  86. setport    macro    new_port_no
  87.     ifdef    no_confidence        ;define if you suspect that you don't
  88.       if    no_confidence
  89.         loadport        ;  have enough loadports, i.e. dx is
  90.       endif
  91.     endif                ;  set to the wrong port.
  92.     if    new_port_no - port_no EQ 1
  93.         inc    dx
  94.     else
  95.         if    new_port_no - port_no EQ -1
  96.             dec    dx
  97.         else
  98.             if    new_port_no - port_no NE 0
  99.                 add    dx,new_port_no - port_no
  100.             endif
  101.         endif
  102.     endif
  103. port_no    =    new_port_no
  104.     endm
  105.  
  106. segmoffs    struc            ; defines offs as 0, segm as 2
  107. offs        dw    ?
  108. segm        dw    ?
  109. segmoffs    ends
  110.  
  111. CY    equ    0001h
  112. EI    equ    0200h
  113.  
  114. iocb        struc            ; as_send_pkt structure
  115. buffer        dd    ?        ; Pointer to the buffer
  116. len        dw    ?        ; Its length
  117. flags        db    ?        ; Some flags
  118. ret_code    db    ?        ; Completion code
  119. upcall        dd    ?        ; I/O completion upcall
  120. next        dd    ?        ; Private next pointer (queue)
  121. resv        db    4 dup (?)    ; Unused private data
  122. iocb        ends
  123.  
  124. DONE    equ    1        ; I/O complete flag
  125. CALLME    equ    2        ; Please upcall me flag
  126.  
  127.  
  128. send_queueempty    macro
  129. ; Check if send queue is empty.
  130. ; Enter with interrupts disabled.
  131. ; Exit with zr (zero) if empty, nz (not zero) if not.
  132. ; Destroys ax.
  133.     mov ax,    word ptr send_head    ; Queue empty?
  134.     or ax,    word ptr send_head+2
  135.     endm
  136.  
  137. send_peekqueue    macro
  138. ; Peek into the queue and get the next entry.
  139. ; Enter with interrupts disabled.
  140. ; Exit with es:di -> iocb.
  141.     les di, send_head    ; Get head segment:offset
  142.     endm
  143.  
  144. ; Bits in sys_features
  145. MICROCHANNEL    equ    02        ; a micro channel computer
  146. TWO_8259    equ    40h        ; 2nd 8259 exists
  147.  
  148. ; Bits in flagbyte
  149. CALLED_ETOPEN    equ    1        ; have called etopen
  150. D_OPTION    equ    2        ; delayed initialization
  151. N_OPTION    equ    4        ; Novell protocol conversion
  152. W_OPTION    equ    8        ; Windows upcall checking.
  153.