Subversion Repositories Kolibri OS

Rev

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

Rev 5522 Rev 5567
Line 165... Line 165...
165
        MT_100_Half             = 0x04
165
        MT_100_Half             = 0x04
166
        MT_100_Full             = 0x08
166
        MT_100_Full             = 0x08
167
        MT_1000_Full            = 0x10
167
        MT_1000_Full            = 0x10
Line 168... Line 168...
168
 
168
 
-
 
169
        ; _TBICSRBit
-
 
170
        TBI_RESET               = 0x80000000
-
 
171
        TBI_LOOPBACK            = 0x40000000
-
 
172
        TBI_NW_ENABLE           = 0x20000000
169
        ; _TBICSRBit
173
        TBI_NW_RESTART          = 0x10000000
-
 
174
        TBI_LINK_OK             = 0x02000000
Line 170... Line 175...
170
        TBI_LinkOK              = 0x02000000
175
        TBI_NW_COMPLETE         = 0x01000000
171
 
176
 
172
        ; _DescStatusBit
177
        ; _DescStatusBit
173
        DSB_OWNbit              = 0x80000000
178
        DSB_OWNbit              = 0x80000000
Line 557... Line 562...
557
 
562
 
558
        mov     eax, [esi+8]
563
        mov     eax, [esi+8]
559
        mov     [ebx + device.mac_version], eax
564
        mov     [ebx + device.mac_version], eax
560
        mov     eax, [esi+12]
565
        mov     eax, [esi+12]
-
 
566
        mov     [ebx + device.name], eax
Line 561... Line 567...
561
        mov     [ebx + device.name], eax
567
        DEBUGF  2, "Detected chip: %s\n", eax
562
 
568
 
Line 1145... Line 1151...
1145
        jz      .no_rx
1151
        jz      .no_rx
Line 1146... Line 1152...
1146
 
1152
 
1147
        push    ax
1153
        push    ax
Line 1148... Line 1154...
1148
        push    ebx
1154
        push    ebx
1149
 
1155
 
1150
  .check_more:
1156
  .rx_loop:
1151
        pop     ebx
1157
        pop     ebx
1152
        mov     eax, sizeof.rx_desc
1158
        mov     eax, sizeof.rx_desc
Line 1153... Line 1159...
1153
        mul     [ebx + device.cur_rx]
1159
        mul     [ebx + device.cur_rx]
1154
        lea     esi, [ebx + device.rx_ring + eax]
1160
        lea     esi, [ebx + device.rx_ring + eax]
1155
 
1161
 
1156
        DEBUGF  1,"RxDesc.status = 0x%x\n", [esi + rx_desc.status]
1162
        DEBUGF  1,"RxDesc.status = 0x%x\n", [esi + rx_desc.status]
Line 1157... Line 1163...
1157
        mov     ecx, [esi + rx_desc.status]
1163
        mov     ecx, [esi + rx_desc.status]
1158
        test    ecx, DSB_OWNbit ;;;
-
 
1159
        jnz     .rx_return
1164
        test    ecx, DSB_OWNbit
1160
 
1165
        jnz     .rx_return
Line 1161... Line 1166...
1161
        DEBUGF  1,"cur_rx = %u\n", [ebx + device.cur_rx]
1166
 
1162
 
1167
        DEBUGF  1,"cur_rx = %u\n", [ebx + device.cur_rx]
1163
        test    ecx, SD_RxRES
1168
        test    ecx, SD_RxRES
1164
        jnz     .rx_return      ;;;;; RX error!
1169
        jnz     .rx_reuse
1165
 
1170
 
1166
        push    ebx
1171
        push    ebx
1167
        push    .check_more
1172
        push    .rx_loop
Line 1182... Line 1187...
1182
        inc     [ebx + device.packets_rx]
1187
        inc     [ebx + device.packets_rx]
Line 1183... Line 1188...
1183
 
1188
 
1184
;----------------------
1189
;----------------------
Line -... Line 1190...
-
 
1190
; Allocate a new buffer
1185
; Allocate a new buffer
1191
 
-
 
1192
        mov     [esi + rx_desc.status], 0
-
 
1193
        invoke  NetAlloc, RX_BUF_SIZE+NET_BUFF.data
1186
 
1194
        test    eax, eax
1187
        invoke  NetAlloc, RX_BUF_SIZE+NET_BUFF.data
1195
        jz      .no_more_buffers
1188
        mov     [esi + rx_desc.buf_soft_addr], eax
1196
        mov     [esi + rx_desc.buf_soft_addr], eax
1189
        invoke  GetPhysAddr
1197
        invoke  GetPhysAddr
Line 1198... Line 1206...
1198
        jne     @f
1206
        jne     @f
1199
        or      eax, DSB_EORbit
1207
        or      eax, DSB_EORbit
1200
    @@:
1208
    @@:
1201
        mov     [esi + rx_desc.status], eax
1209
        mov     [esi + rx_desc.status], eax
Line -... Line 1210...
-
 
1210
 
1202
 
1211
  .no_more_buffers:
1203
;--------------
1212
;--------------
Line 1204... Line 1213...
1204
; Update rx ptr
1213
; Update rx ptr
1205
 
1214
 
Line 1206... Line 1215...
1206
        inc     [ebx + device.cur_rx]
1215
        inc     [ebx + device.cur_rx]
1207
        and     [ebx + device.cur_rx], NUM_RX_DESC - 1
-
 
Line -... Line 1216...
-
 
1216
        and     [ebx + device.cur_rx], NUM_RX_DESC - 1
-
 
1217
 
-
 
1218
        jmp     [EthInput]
-
 
1219
 
-
 
1220
  .rx_reuse:
-
 
1221
        mov     eax, DSB_OWNbit or RX_BUF_SIZE
-
 
1222
        cmp     [ebx + device.cur_rx], NUM_RX_DESC - 1
-
 
1223
        jne     @f
-
 
1224
        or      eax, DSB_EORbit
-
 
1225
    @@:
-
 
1226
        mov     [esi + rx_desc.status], eax
1208
 
1227
        push    ebx
1209
        jmp     [EthInput]
1228
        jmp     .rx_loop
Line 1210... Line 1229...
1210
  .rx_return:
1229
 
1211
 
1230
  .rx_return: