Revision 5fa9a0ae
b/hw/eepro100.c | ||
---|---|---|
626 | 626 |
//~ missing("CU dump statistical counters"); |
627 | 627 |
} |
628 | 628 |
|
629 |
static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
|
|
629 |
static void action_command(EEPRO100State *s)
|
|
630 | 630 |
{ |
631 |
eepro100_tx_t tx; |
|
632 |
uint32_t cb_address; |
|
633 |
switch (val) { |
|
634 |
case CU_NOP: |
|
635 |
/* No operation. */ |
|
636 |
break; |
|
637 |
case CU_START: |
|
638 |
if (get_cu_state(s) != cu_idle) { |
|
639 |
/* Intel documentation says that CU must be idle for the CU |
|
640 |
* start command. Intel driver for Linux also starts the CU |
|
641 |
* from suspended state. */ |
|
642 |
logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); |
|
643 |
//~ assert(!"wrong CU state"); |
|
644 |
} |
|
645 |
set_cu_state(s, cu_active); |
|
646 |
s->cu_offset = s->pointer; |
|
647 |
next_command: |
|
648 |
cb_address = s->cu_base + s->cu_offset; |
|
631 |
for (;;) { |
|
632 |
uint32_t cb_address = s->cu_base + s->cu_offset; |
|
633 |
eepro100_tx_t tx; |
|
649 | 634 |
cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx)); |
650 | 635 |
uint16_t status = le16_to_cpu(tx.status); |
651 | 636 |
uint16_t command = le16_to_cpu(tx.command); |
... | ... | |
787 | 772 |
/* CU becomes idle. Terminate command loop. */ |
788 | 773 |
set_cu_state(s, cu_idle); |
789 | 774 |
eepro100_cna_interrupt(s); |
775 |
break; |
|
790 | 776 |
} else if (bit_s) { |
791 |
/* CU becomes suspended. */ |
|
777 |
/* CU becomes suspended. Terminate command loop. */
|
|
792 | 778 |
set_cu_state(s, cu_suspended); |
793 | 779 |
eepro100_cna_interrupt(s); |
780 |
break; |
|
794 | 781 |
} else { |
795 | 782 |
/* More entries in list. */ |
796 | 783 |
TRACE(OTHER, logout("CU list with at least one more entry\n")); |
797 |
goto next_command; |
|
798 | 784 |
} |
799 |
TRACE(OTHER, logout("CU list empty\n")); |
|
800 |
/* List is empty. Now CU is idle or suspended. */ |
|
785 |
} |
|
786 |
TRACE(OTHER, logout("CU list empty\n")); |
|
787 |
/* List is empty. Now CU is idle or suspended. */ |
|
788 |
} |
|
789 |
|
|
790 |
static void eepro100_cu_command(EEPRO100State * s, uint8_t val) |
|
791 |
{ |
|
792 |
switch (val) { |
|
793 |
case CU_NOP: |
|
794 |
/* No operation. */ |
|
795 |
break; |
|
796 |
case CU_START: |
|
797 |
if (get_cu_state(s) != cu_idle) { |
|
798 |
/* Intel documentation says that CU must be idle for the CU |
|
799 |
* start command. Intel driver for Linux also starts the CU |
|
800 |
* from suspended state. */ |
|
801 |
logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); |
|
802 |
//~ assert(!"wrong CU state"); |
|
803 |
} |
|
804 |
set_cu_state(s, cu_active); |
|
805 |
s->cu_offset = s->pointer; |
|
806 |
action_command(s); |
|
801 | 807 |
break; |
802 | 808 |
case CU_RESUME: |
803 | 809 |
if (get_cu_state(s) != cu_suspended) { |
... | ... | |
810 | 816 |
if (get_cu_state(s) == cu_suspended) { |
811 | 817 |
TRACE(OTHER, logout("CU resuming\n")); |
812 | 818 |
set_cu_state(s, cu_active); |
813 |
goto next_command;
|
|
819 |
action_command(s);
|
|
814 | 820 |
} |
815 | 821 |
break; |
816 | 822 |
case CU_STATSADDR: |
Also available in: Unified diff