I have noticed that my transmit routine works only once. I pass the data that I want to send, set TSD and TSAD (i use only first descriptor) and then just clear the OWN bit, which will start the loading netcard's FIFO with data from TSAD. Then I just keep checking OWN bit until is set, which means that DMA transfer has been finished. Then I get interrupt (TOK), reset it and everything is fine.
But when I try to do it again, that OWN flag will never go high as well as the TOK interrupt is ofcouse always low. And above all, when I checked that TSD register, all bites are read zero.
There is the code that does transmit:
Code: Select all
sendp: ; edi packet begins, esi packet ends
mov ds, dx
cmp dword [BASE], 0
jnz sendp_goon
pushad
push dx
mov eax, 0x29
mov ebx, 0x802910ec
int 0x80
pop dx
mov ax, dx
mov ds, ax
mov dword [BASE], ebx
popad
sendp_goon:
mov esi, ebx
mov edx, dword [BASE]
add dx, TSAD0
mov eax, edi
out dx, eax ; packet start
sub esi, edi ; packet count
mov edx, dword [BASE]
add dx, TSD0
in eax, dx ; get TSD (transmit descriptor)
and eax, 0xffffc000 ; clear lenght and own
add eax, esi ; adding len to TSD
out dx, eax
;mov ecx, 1000
checkownclear: ; means DMA operation finished
in eax, dx
and eax, 0x2000
cmp eax, 0x2000
jne checkownclear
;loopnz checkownclear
ret