From: Leandro Lucarella Date: Mon, 5 Dec 2005 06:43:23 +0000 (+0000) Subject: Cambio el hack feo del retardo por un hack algo menos feo. Además de chequear X-Git-Tag: 0.1-recibe-matriz-raw-por-udp~33 X-Git-Url: https://git.llucax.com/z.facultad/66.09/etherled.git/commitdiff_plain/c1d6a43781d91a07fccde6c4f9dbbfc78fce2025 Cambio el hack feo del retardo por un hack algo menos feo. Además de chequear por el flag OVW me fijo si BNRY == CURR antes de resetear la placa. Con esto anda como piña, la floodeo con todas las ganas y no se resetea nunca. --- diff --git a/pruebas/keil/red_test_anda/etherdev.c b/pruebas/keil/red_test_anda/etherdev.c index 4675026..aa8f35f 100644 --- a/pruebas/keil/red_test_anda/etherdev.c +++ b/pruebas/keil/red_test_anda/etherdev.c @@ -408,26 +408,36 @@ static void etherdev_reset() static unsigned int etherdev_poll(void) { unsigned int len = 0; - // Retardo mega-bizarro, si no lo pongo a veces leo basura del ISR - unsigned char j; - for (j = 0; j < 0xFF; ++j); // Check if the rx buffer has overflowed. if (etherdev_reg_read(ISR) & OVW) { - leds1 = ~0x01; - leds2 = ~etherdev_reg_read(ISR); - sleep(5); - leds1 = ~0x02; - leds2 = ~etherdev_reg_read(BNRY); - sleep(5); - leds1 = ~0x04; + unsigned char current; + + // Select RTL8019AS register page 1. ETHERDEV_SELECT_REG_PAGE(1); - leds2 = ~etherdev_reg_read(CURR); + + // Retrieve current receive buffer page + current = etherdev_reg_read(CURR); + + // Select RTL8019AS register page 1. ETHERDEV_SELECT_REG_PAGE(0); - sleep(5); - etherdev_reset(); - len = 0; + + if (etherdev_reg_read(BNRY) == current) + { + + leds1 = ~0x01; + leds2 = ~etherdev_reg_read(ISR); + sleep(5); + leds1 = ~0x02; + leds2 = ~etherdev_reg_read(BNRY); + sleep(5); + leds1 = ~0x04; + leds2 = ~current; + sleep(5); + + etherdev_reset(); + } } // Check if there is a packet in the rx buffer. else if (etherdev_reg_read(ISR) & PRX)