home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / packetdrivers.tar.gz / pd.tar / src / generic.asm < prev    next >
Assembly Source File  |  1992-02-10  |  5KB  |  197 lines

  1. version    equ    0
  2.  
  3. ;  Copyright, 1988-1992, Russell Nelson, Crynwr Software
  4.  
  5. ;   This program is free software; you can redistribute it and/or modify
  6. ;   it under the terms of the GNU General Public License as published by
  7. ;   the Free Software Foundation, version 1.
  8. ;
  9. ;   This program is distributed in the hope that it will be useful,
  10. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ;   GNU General Public License for more details.
  13. ;
  14. ;   You should have received a copy of the GNU General Public License
  15. ;   along with this program; if not, write to the Free Software
  16. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.     include    defs.asm
  19.  
  20. code    segment    word public
  21.     assume    cs:code, ds:code
  22.  
  23.     public    int_no
  24. int_no    db    0,0,0,0            ;must be four bytes long for get_number.
  25.  
  26.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  27. driver_class    db    0,0        ;null terminated list of classes.
  28. driver_type    db    0        ;from the packet spec
  29. driver_name    db    'generic',0    ;name of the driver.
  30. driver_function    db    2
  31. parameter_list    label    byte
  32.     db    1    ;major rev of packet driver
  33.     db    9    ;minor rev of packet driver
  34.     db    14    ;length of parameter list
  35.     db    EADDR_LEN    ;length of MAC-layer address
  36.     dw    GIANT    ;MTU, including MAC headers
  37.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  38.     dw    0    ;(# of back-to-back MTU rcvs) - 1
  39.     dw    0    ;(# of successive xmits) - 1
  40. int_num    dw    0    ;Interrupt # to hook for post-EOI
  41.             ;processing, 0 == none,
  42.  
  43.     public    rcv_modes
  44. rcv_modes    dw    4        ;number of receive modes in our table.
  45.         dw    0,0,0,rcv_mode_3
  46.  
  47.     public    as_send_pkt
  48. ; The Asynchronous Transmit Packet routine.
  49. ; Enter with es:di -> i/o control block, ds:si -> packet, cx = packet length,
  50. ;   interrupts possibly enabled.
  51. ; Exit with nc if ok, or else cy if error, dh set to error number.
  52. ;   es:di and interrupt enable flag preserved on exit.
  53. as_send_pkt:
  54.     ret
  55.  
  56.     public    drop_pkt
  57. ; Drop a packet from the queue.
  58. ; Enter with es:di -> iocb.
  59. drop_pkt:
  60.     assume    ds:nothing
  61.     ret
  62.  
  63.     public    xmit
  64. ; Process a transmit interrupt with the least possible latency to achieve
  65. ;   back-to-back packet transmissions.
  66. ; May only use ax and dx.
  67. xmit:
  68.     assume    ds:nothing
  69.     ret
  70.  
  71.  
  72.     public    send_pkt
  73. send_pkt:
  74. ;enter with es:di->upcall routine, (0:0) if no upcall is desired.
  75. ;  (only if the high-performance bit is set in driver_function)
  76. ;enter with ds:si -> packet, cx = packet length.
  77. ;if we're a high-performance driver, es:di -> upcall.
  78. ;exit with nc if ok, or else cy if error, dh set to error number.
  79.     assume    ds:nothing
  80.     ret
  81.  
  82.  
  83.     public    get_address
  84. get_address:
  85. ;get the address of the interface.
  86. ;enter with es:di -> place to get the address, cx = size of address buffer.
  87. ;exit with nc, cx = actual size of address, or cy if buffer not big enough.
  88.     assume    ds:code
  89.     ret
  90.  
  91.  
  92.     public    set_address
  93. set_address:
  94. ;enter with ds:si -> Ethernet address, CX = length of address.
  95. ;exit with nc if okay, or cy, dh=error if any errors.
  96.     assume    ds:nothing
  97.     ret
  98.  
  99.  
  100. rcv_mode_3:
  101. ;receive mode 3 is the only one we support, so we don't have to do anything.
  102.     ret
  103.  
  104.  
  105.     public    set_multicast_list
  106. set_multicast_list:
  107. ;enter with ds:si ->list of multicast addresses, cx = number of addresses.
  108. ;return nc if we set all of them, or cy,dh=error if we didn't.
  109.     mov    dh,NO_MULTICAST
  110.     stc
  111.     ret
  112.  
  113.  
  114.     public    terminate
  115. terminate:
  116.     ret
  117.  
  118.     public    reset_interface
  119. reset_interface:
  120. ;reset the interface.
  121.     assume    ds:code
  122.     ret
  123.  
  124.  
  125. ;called when we want to determine what to do with a received packet.
  126. ;enter with cx = packet length, es:di -> packet type, dl = packet class.
  127.     extrn    recv_find: near
  128.  
  129. ;called after we have copied the packet into the buffer.
  130. ;enter with ds:si ->the packet, cx = length of the packet.
  131.     extrn    recv_copy: near
  132.  
  133.     extrn    count_in_err: near
  134.     extrn    count_out_err: near
  135.  
  136.     public    recv
  137. recv:
  138. ;called from the recv isr.  All registers have been saved, and ds=cs.
  139. ;Upon exit, the interrupt will be acknowledged.
  140.     assume    ds:code
  141.     ret
  142.  
  143.  
  144.     public    recv_exiting
  145. recv_exiting:
  146. ;called from the recv isr after interrupts have been acknowledged.
  147. ;Only ds and ax have been saved.
  148.     assume    ds:nothing
  149.     ret
  150.  
  151.  
  152. ;any code after this will not be kept after initialization.
  153. end_resident    label    byte
  154.  
  155.  
  156.     public    usage_msg
  157. usage_msg    db    "usage: generic [-n] [-d] [-w] <packet_int_no>",CR,LF,'$'
  158.  
  159.     public    copyright_msg
  160. copyright_msg    db    "Packet driver for a generic device, version ",'0'+(majver / 10),'0'+(majver mod 10),".",'0'+version,CR,LF
  161.         db    "Portions Copyright 19xx, J. Random Hacker",CR,LF,'$'
  162.  
  163.     extrn    set_recv_isr: near
  164.  
  165. ;enter with si -> argument string, di -> wword to store.
  166. ;if there is no number, don't change the number.
  167.     extrn    get_number: near
  168.  
  169. ;enter with dx -> argument string, di -> wword to print.
  170.     extrn    print_number: near
  171.  
  172.     public    parse_args
  173. parse_args:
  174. ;exit with nc if all went well, cy otherwise.
  175.     clc
  176.     ret
  177.  
  178.  
  179.     public    etopen
  180. etopen:
  181. ;if all is okay,
  182.     mov    dx,offset end_resident
  183.     clc
  184.     ret
  185. ;if we got an error,
  186.     stc
  187.     ret
  188.  
  189.     public    print_parameters
  190. print_parameters:
  191. ;echo our command-line parameters
  192.     ret
  193.  
  194. code    ends
  195.  
  196.     end
  197.