Rev 3557 | Rev 4470 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3557 | Rev 3855 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | 18 | ||
Line 19... | Line 19... | ||
19 | API_VERSION = 0x01000100 |
19 | API_VERSION = 0x01000100 |
20 | 20 | ||
21 | DEBUG = 1 |
21 | DEBUG = 1 |
Line 22... | Line 22... | ||
22 | __DEBUG__ = 1 |
22 | __DEBUG__ = 1 |
23 | __DEBUG_LEVEL__ = 2 |
23 | __DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only |
Line 24... | Line 24... | ||
24 | 24 | ||
Line 369... | Line 369... | ||
369 | cmp [state], 1 |
369 | cmp [state], 1 |
370 | jne .exit |
370 | jne .exit |
Line 371... | Line 371... | ||
371 | 371 | ||
Line 372... | Line 372... | ||
372 | .entry: |
372 | .entry: |
373 | 373 | ||
374 | DEBUGF 2,"Loading %s driver\n", my_service |
374 | DEBUGF 1,"Loading driver\n" |
Line 375... | Line 375... | ||
375 | stdcall RegService, my_service, service_proc |
375 | stdcall RegService, my_service, service_proc |
376 | ret |
376 | ret |
Line 506... | Line 506... | ||
506 | .destroy: |
506 | .destroy: |
507 | ; todo: reset device into virgin state |
507 | ; todo: reset device into virgin state |
Line 508... | Line 508... | ||
508 | 508 | ||
509 | dec [devices] |
509 | dec [devices] |
510 | .err: |
510 | .err: |
511 | DEBUGF 1,"Error, removing all data !\n" |
511 | DEBUGF 2,"Error, removing all data !\n" |
Line 512... | Line 512... | ||
512 | stdcall KernelFree, ebx |
512 | stdcall KernelFree, ebx |
513 | 513 | ||
514 | .fail: |
514 | .fail: |
Line 596... | Line 596... | ||
596 | call switch_to_dwio |
596 | call switch_to_dwio |
Line 597... | Line 597... | ||
597 | 597 | ||
Line 598... | Line 598... | ||
598 | jmp .L1 |
598 | jmp .L1 |
599 | 599 | ||
600 | .no_dev: |
600 | .no_dev: |
601 | DEBUGF 1,"PCnet device not found!\n" |
601 | DEBUGF 1,"device not found!\n" |
Line 602... | Line 602... | ||
602 | mov eax, 1 |
602 | mov eax, 1 |
603 | ret |
603 | ret |
Line 721... | Line 721... | ||
721 | movzx eax, [device.irq_line] |
721 | movzx eax, [device.irq_line] |
722 | DEBUGF 1,"Attaching int handler to irq %x\n", eax:1 |
722 | DEBUGF 1,"Attaching int handler to irq %x\n", eax:1 |
723 | stdcall AttachIntHandler, eax, int_handler, dword 0 |
723 | stdcall AttachIntHandler, eax, int_handler, dword 0 |
724 | test eax, eax |
724 | test eax, eax |
725 | jnz @f |
725 | jnz @f |
726 | DEBUGF 1,"\nCould not attach int handler!\n" |
726 | DEBUGF 2,"Could not attach int handler!\n" |
727 | ; or eax, -1 |
727 | ; or eax, -1 |
728 | ; ret |
728 | ; ret |
729 | @@: |
729 | @@: |
Line 730... | Line 730... | ||
730 | 730 | ||
Line 859... | Line 859... | ||
859 | .next: |
859 | .next: |
860 | inc [device.phy] |
860 | inc [device.phy] |
861 | cmp [device.phy], MAX_PHYS |
861 | cmp [device.phy], MAX_PHYS |
862 | jb .mii_loop |
862 | jb .mii_loop |
Line 863... | Line 863... | ||
863 | 863 | ||
Line 864... | Line 864... | ||
864 | DEBUGF 1, "No PHY found!\n" |
864 | DEBUGF 2, "No PHY found!\n" |
865 | 865 | ||
Line 866... | Line 866... | ||
866 | or eax, -1 |
866 | or eax, -1 |
Line 916... | Line 916... | ||
916 | test ax, CSR_IDONE |
916 | test ax, CSR_IDONE |
917 | jnz @f |
917 | jnz @f |
Line 918... | Line 918... | ||
918 | 918 | ||
919 | dec esi |
919 | dec esi |
920 | jnz @r |
920 | jnz @r |
921 | DEBUGF 1,"Initialize timeout!\n" |
921 | DEBUGF 2,"Initialize timeout!\n" |
Line 922... | Line 922... | ||
922 | @@: |
922 | @@: |
923 | 923 | ||
924 | ; Start the device and enable interrupts |
924 | ; Start the device and enable interrupts |
Line 1037... | Line 1037... | ||
1037 | call [device.write_csr] |
1037 | call [device.write_csr] |
Line 1038... | Line 1038... | ||
1038 | 1038 | ||
1039 | ; get next descriptor 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ... |
1039 | ; get next descriptor 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ... |
1040 | inc [device.cur_tx] |
1040 | inc [device.cur_tx] |
1041 | and [device.cur_tx], TX_RING_SIZE - 1 |
- | |
Line 1042... | Line 1041... | ||
1042 | DEBUGF 1," - Packet Sent! " |
1041 | and [device.cur_tx], TX_RING_SIZE - 1 |
1043 | 1042 | ||
1044 | ; Update stats |
1043 | ; Update stats |
1045 | inc [device.packets_tx] |
1044 | inc [device.packets_tx] |
Line 1051... | Line 1050... | ||
1051 | DEBUGF 1," - Done!\n" |
1050 | DEBUGF 1," - Done!\n" |
1052 | xor eax, eax |
1051 | xor eax, eax |
1053 | ret 8 |
1052 | ret 8 |
Line 1054... | Line 1053... | ||
1054 | 1053 | ||
1055 | .nospace: |
1054 | .nospace: |
1056 | DEBUGF 1, 'ERROR: no free transmit descriptors\n' |
1055 | DEBUGF 2, "ERROR: no free transmit descriptors\n" |
1057 | stdcall KernelFree, [esp+4] |
1056 | stdcall KernelFree, [esp+4] |
1058 | or eax, -1 |
1057 | or eax, -1 |
Line 1069... | Line 1068... | ||
1069 | align 4 |
1068 | align 4 |
1070 | int_handler: |
1069 | int_handler: |
Line 1071... | Line 1070... | ||
1071 | 1070 | ||
Line 1072... | Line 1071... | ||
1072 | push ebx esi edi |
1071 | push ebx esi edi |
Line 1073... | Line 1072... | ||
1073 | 1072 | ||
Line 1074... | Line 1073... | ||
1074 | DEBUGF 1,"\n%s int\n", my_service |
1073 | DEBUGF 1,"INT\n" |
1075 | 1074 | ||
Line 1228... | Line 1227... | ||
1228 | ;; Read MAC address ;; |
1227 | ;; Read MAC address ;; |
1229 | ;; ;; |
1228 | ;; ;; |
1230 | ;;;;;;;;;;;;;;;;;;;;;; |
1229 | ;;;;;;;;;;;;;;;;;;;;;; |
1231 | align 4 |
1230 | align 4 |
1232 | read_mac: |
1231 | read_mac: |
1233 | DEBUGF 1,"Reading MAC" |
1232 | DEBUGF 1,"Reading MAC:\n" |
Line 1234... | Line 1233... | ||
1234 | 1233 | ||
1235 | mov edx, [device.io_addr] |
1234 | mov edx, [device.io_addr] |
1236 | add dx, 6 |
1235 | add dx, 6 |
1237 | @@: |
1236 | @@: |
1238 | dec dx |
1237 | dec dx |
1239 | dec dx |
1238 | dec dx |
1240 | in ax, dx |
1239 | in ax, dx |
1241 | push ax |
- | |
1242 | DEBUGF 1,"." |
1240 | push ax |
1243 | cmp edx, [device.io_addr] |
1241 | cmp edx, [device.io_addr] |
Line 1244... | Line 1242... | ||
1244 | ja @r |
1242 | ja @r |