home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / packetdrivers.tar.gz / pd.tar / src / at1500.asm < prev    next >
Assembly Source File  |  1995-06-25  |  3KB  |  134 lines

  1. version    equ    1
  2.  
  3. ; Copyright, 1990-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.  
  19.     .286                ;the at1500 requires a 286.
  20.  
  21.     include    defs.asm
  22.  
  23. EBASE        equ    0
  24. DATA_REG    equ    10h
  25. ADDR_REG    equ    DATA_REG+2
  26. ISAC_REG    equ    DATA_REG+6
  27.  
  28. code    segment    para public
  29.     assume    cs:code, ds:code
  30.  
  31.     public    int_no
  32. int_no    db    ?,0,0,0            ;must be four bytes long for get_number.
  33. io_addr    dw    -1,-1
  34. dma_no    db    ?,0,0,0
  35.  
  36.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  37. driver_class    db    BLUEBOOK, IEEE8023, 0        ;from the packet spec
  38. driver_type    db    98        ;from the packet spec
  39. driver_name    db    'Allied Telesis 1500',0    ;name of the driver.
  40. driver_function    db    2        ;basic, extended
  41. parameter_list    label    byte
  42.     db    1    ;major rev of packet driver
  43.     db    9    ;minor rev of packet driver
  44.     db    14    ;length of parameter list
  45.     db    EADDR_LEN    ;length of MAC-layer address
  46.     dw    GIANT    ;MTU, including MAC headers
  47.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  48.     dw    RECEIVE_BUF_COUNT-1    ;(# of back-to-back MTU rcvs) - 1
  49.     dw    TRANSMIT_BUF_COUNT-1    ;(# of successive xmits) - 1
  50. int_num    dw    0    ;Interrupt # to hook for post-EOI
  51.             ;processing, 0 == none,
  52.  
  53. reset_lance    macro
  54.     mov    ax,CSR0_STOP
  55.     outport CSR0            ;should use hardware reset here
  56.     endm
  57.  
  58.     include    lance.asm
  59.  
  60.     public    usage_msg
  61. usage_msg    db    "usage: at1500 [options] <packet_int_no> <io_addr>",CR,LF,'$'
  62. no_board_msg    db    "No at1500 detected.",CR,LF,'$'
  63. bad_reset_msg    db    "Unable to reset the at1500.",CR,LF,'$'
  64. bad_init_msg    db    "Unable to initialize the at1500.",CR,LF,'$'
  65. no_memory_msg    db    "Unable to allocate enough memory, look at end_resident in at1500.ASM",CR,LF,'$'
  66.  
  67.     public    copyright_msg
  68. copyright_msg    db    "Packet driver for an at1500, version ",'0'+(majver / 10),'0'+(majver mod 10),".",'0'+lance_version,".",'0'+version,CR,LF
  69.         db    '$'
  70.  
  71.     public    parse_args
  72. parse_args:
  73. ;exit with nc if all went well, cy otherwise.
  74.     assume    ds:code
  75.     mov    di,offset io_addr
  76.     call    get_number
  77.     clc
  78.     ret
  79.  
  80. check_board:
  81.     assume    ds:code
  82.     cmp    io_addr,-1        ;Did they ask for auto-detect?
  83.     je    find_board
  84.  
  85.     mov    di,io_addr
  86.     call    verifyboard
  87.     jnc    find_board_found
  88.  
  89.     mov    dx,offset no_board_msg    ;Tell them that we can't find it.
  90.     stc
  91.     ret
  92.  
  93. find_board:
  94.     mov    io_addr,300h        ;Search for the Ethernet address.
  95.     mov    io_addr+2,0
  96. find_board_0:
  97.     mov    di,io_addr
  98.     call    verifyboard
  99.     jnc    find_board_found
  100. find_board_again:
  101.     add    io_addr,20h        ;not at this port, try another.
  102.     cmp    io_addr,360h
  103.     jbe    find_board_0
  104.  
  105.     mov    dx,offset no_board_msg    ;Tell them that we can't find it.
  106.     stc
  107.     ret
  108. find_board_found:
  109.     mov    int_no,bl
  110.     mov    dma_no,bh
  111.  
  112.     loadport            ;CX = value to be output to ISACR 2.
  113.     setport    ADDR_REG
  114.     mov    ax,2
  115.     out    dx,ax
  116.     in    ax,dx
  117.     setport    ISAC_REG
  118.     mov    ax,cx
  119.     out    dx,ax
  120.     in    ax,dx
  121.     clc
  122. check_board_1:
  123.     ret
  124.  
  125. code    ends
  126.  
  127. CODESEG        EQU    <code>
  128. DATASEG        EQU    <code>
  129. DATAGROUP    EQU    <code>
  130.     include    eep15.inc
  131.  
  132.     end
  133.  
  134.