Subversion Repositories Kolibri OS

Rev

Rev 593 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 593 Rev 735
Line 23... Line 23...
23
;;  Updates:                                                          ;;
23
;;  Updates:                                                          ;;
24
;;    Revision Look up table and SIS635 Mac Address by Jarek Pelczar  ;;
24
;;    Revision Look up table and SIS635 Mac Address by Jarek Pelczar  ;;
25
;;                                                                    ;;
25
;;                                                                    ;;
26
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 27... Line 27...
27
 
27
 
Line 28... Line 28...
28
$Revision: 593 $
28
$Revision: 735 $
29
 
29
 
30
 
30
 
Line 452... Line 452...
452
;***************************************************************************
452
;***************************************************************************
453
SIS900_init_txd:
453
SIS900_init_txd:
454
   ;********** initialize TX descriptor **************
454
   ;********** initialize TX descriptor **************
455
   mov     [txd], dword 0       ;put link to next descriptor in link field
455
   mov     [txd], dword 0       ;put link to next descriptor in link field
456
   mov     [txd+4],dword 0      ;clear status field
456
   mov     [txd+4],dword 0      ;clear status field
457
   mov     [txd+8], dword txb   ;save address to buffer ptr field
457
   mov     [txd+8], dword txb - OS_BASE   ;save address to buffer ptr field
458
   ;*************** load Transmit Descriptor Register ***************
458
   ;*************** load Transmit Descriptor Register ***************
459
   mov     dx, [io_addr]            ; base address
459
   mov     dx, [io_addr]            ; base address
460
   add     dx, SIS900_txdp      ; TX Descriptor Pointer
460
   add     dx, SIS900_txdp      ; TX Descriptor Pointer
461
   mov     eax, txd                         ; First Descriptor
461
   mov     eax, txd - OS_BASE               ; First Descriptor
462
   out     dx, eax                              ; move the pointer
462
   out     dx, eax                              ; move the pointer
463
   ret
463
   ret
Line 464... Line 464...
464
 
464
 
465
;***************************************************************************
465
;***************************************************************************
Line 484... Line 484...
484
    cmp     ebx, NUM_RX_DESC                ;
484
    cmp     ebx, NUM_RX_DESC                ;
485
    jne     SIS900_init_rxd_Loop_0          ;
485
    jne     SIS900_init_rxd_Loop_0          ;
486
    xor     ebx, ebx                        ;
486
    xor     ebx, ebx                        ;
487
SIS900_init_rxd_Loop_0:                    ;
487
SIS900_init_rxd_Loop_0:                    ;
488
    imul    ebx, 12                         ;
488
    imul    ebx, 12                         ;
489
    add     ebx, rxd                        ;
489
    add     ebx, rxd - OS_BASE              ;
490
    mov     [rxd+eax], ebx                                      ;save link to next descriptor
490
    mov     [rxd+eax], ebx                                      ;save link to next descriptor
491
    mov     [rxd+eax+4],dword RX_BUFF_SZ        ;status bits init to buf size
491
    mov     [rxd+eax+4],dword RX_BUFF_SZ        ;status bits init to buf size
492
    mov     ebx, ecx                                            ;find where the buf is located
492
    mov     ebx, ecx                                            ;find where the buf is located
493
    imul    ebx,RX_BUFF_SZ                  ;
493
    imul    ebx,RX_BUFF_SZ                  ;
494
    add     ebx, rxb                        ;
494
    add     ebx, rxb - OS_BASE              ;
495
    mov     [rxd+eax+8], ebx                            ;save buffer pointer
495
    mov     [rxd+eax+8], ebx                            ;save buffer pointer
496
    inc     ecx                                                     ;next descriptor
496
    inc     ecx                                                     ;next descriptor
497
    cmp     ecx, NUM_RX_DESC                ;
497
    cmp     ecx, NUM_RX_DESC                ;
498
    jne     SIS900_init_rxd_Loop            ;
498
    jne     SIS900_init_rxd_Loop            ;
499
    ;********* load Receive Descriptor Register with address of first
499
    ;********* load Receive Descriptor Register with address of first
500
    ; descriptor*********
500
    ; descriptor*********
501
    mov     dx, [io_addr]
501
    mov     dx, [io_addr]
502
    add     dx, SIS900_rxdp
502
    add     dx, SIS900_rxdp
503
    mov     eax, rxd
503
    mov     eax, rxd - OS_BASE
504
    out     dx, eax
504
    out     dx, eax
505
    ret
505
    ret
Line 506... Line 506...
506
 
506
 
507
;***************************************************************************
507
;***************************************************************************
Line 574... Line 574...
574
   mov      ebx, 0xffff
574
   mov      ebx, 0xffff
575
   xor      cl, cl
575
   xor      cl, cl
576
SIS900_set_rx_mode_Loop:
576
SIS900_set_rx_mode_Loop:
577
   mov      eax, ecx
577
   mov      eax, ecx
578
   shl      eax, 1
578
   shl      eax, 1
579
   mov      [SIS900_mc_filter+eax], ebx
579
   mov      [SIS900_mc_filter+eax], bx
580
   lea      edx,[ebp+SIS900_rfcr]           ; Receive Filter Control Reg offset
580
   lea      edx,[ebp+SIS900_rfcr]           ; Receive Filter Control Reg offset
581
   mov      eax, 4                                          ;determine table entry
581
   mov      eax, 4                                          ;determine table entry
582
   add      al, cl
582
   add      al, cl
583
   shl      eax, 16
583
   shl      eax, 16
584
   out      dx, eax                                         ;tell card which entry to modify
584
   out      dx, eax                                         ;tell card which entry to modify
Line 929... Line 929...
929
   ;**********Continue copying packet****************
929
   ;**********Continue copying packet****************
930
   push     ecx
930
   push     ecx
931
   ; first copy dword-wise, divide size by 4
931
   ; first copy dword-wise, divide size by 4
932
   shr      ecx, 2
932
   shr      ecx, 2
933
   mov      esi, [rxd+eax+8]                            ; set source
933
   mov      esi, [rxd+eax+8]                            ; set source
-
 
934
   add      esi, OS_BASE                        ; get linear address
934
   mov      edi, Ether_buffer               ; set destination
935
   mov      edi, Ether_buffer               ; set destination
935
   cld                                                                          ; clear direction
936
   cld                                                                          ; clear direction
936
   rep      movsd                                                       ; copy the dwords
937
   rep      movsd                                                       ; copy the dwords
937
   pop      ecx
938
   pop      ecx
938
   and      ecx, 3                                                  ;
939
   and      ecx, 3                                                  ;
Line 984... Line 985...
984
;***************************************************************************
985
;***************************************************************************
985
if defined SIS900_DEBUG
986
if defined SIS900_DEBUG
986
SIS900_Debug_Transmit_Packet db 'Transmitting Packet: ',13,10,0
987
SIS900_Debug_Transmit_Packet db 'Transmitting Packet: ',13,10,0
987
SIS900_Debug_Transmit_Packet_Err db 'Transmitting Packet Error: ',13,10,0
988
SIS900_Debug_Transmit_Packet_Err db 'Transmitting Packet Error: ',13,10,0
988
end if
989
end if
-
 
990
str1 db 'Transmitting packet:',13,10,0
-
 
991
str2 db ' ',0
989
SIS900_transmit:
992
SIS900_transmit:
990
   mov          ebp, [io_addr]      ; Base Address
993
   mov          ebp, [io_addr]      ; Base Address
991
   ;******** Stop the transmitter ********
994
   ;******** Stop the transmitter ********
992
   lea      edx,[ebp+SIS900_cr] ; Command Register offset
995
   lea      edx,[ebp+SIS900_cr] ; Command Register offset
993
   in       eax, dx                         ; Get current Command Register
996
   in       eax, dx                         ; Get current Command Register
994
   or       eax, SIS900_TxDIS   ; Disable Transmitter
997
   or       eax, SIS900_TxDIS   ; Disable Transmitter
995
   out      dx, eax
998
   out      dx, eax
996
   ;*******load Transmit Descriptor Register *******
999
   ;*******load Transmit Descriptor Register *******
997
   lea      edx,[ebp+SIS900_txdp]
1000
   lea      edx,[ebp+SIS900_txdp]
998
   mov      eax, txd
1001
   mov      eax, txd - OS_BASE
999
   out      dx, eax
1002
   out      dx, eax
1000
   ;******* copy packet to descriptor*******
1003
   ;******* copy packet to descriptor*******
1001
   push    esi
1004
   push    esi
1002
   mov     esi, edi                ;copy destination addess
1005
   mov     esi, edi                ;copy destination addess
1003
   mov     edi, txb
1006
   mov     edi, txb