X-Git-Url: https://git.llucax.com/z.facultad/66.09/etherled.git/blobdiff_plain/9a65cd82189d89b3ad54b02b6ab5f3e3082a8bad..3be9796df73e200ae3778316a3ac696370731289:/pruebas/keil/red_test_anda/main.c diff --git a/pruebas/keil/red_test_anda/main.c b/pruebas/keil/red_test_anda/main.c index e7cc4e6..f2ef8f7 100644 --- a/pruebas/keil/red_test_anda/main.c +++ b/pruebas/keil/red_test_anda/main.c @@ -1,85 +1,63 @@ -/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» - º TITLE: Keil C51 v7.00 port of Adam Dunkels' uIP v0.9 º - º REVISION: VER 0.1 º - º REV.DATE: 30-01-05 º - º ARCHIVE: º - º AUTHOR: Murray R. Van Luyn, 2005. º - ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */ - -/* ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ³ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS ³ - ³ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ³ - ³ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ³ - ³ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ³ - ³ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ³ - ³ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ³ - ³ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ³ - ³ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ³ - ³ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ³ - ³ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ³ - ³ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ³ - ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */ - -#include "main.h" - -static xdata leds1 _at_ 0x0080; -static xdata leds2 _at_ 0x00c0; - -void sleep(unsigned char times) -{ - unsigned int i; - unsigned char j; - for (i = 0; i < 0xffff; ++i) - for (j = 0; j < times; ++j); -} - -/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» - º º - º main() º - º º - º Simple Web Server test application. º - º º - º º - ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */ -void main(void) -{ - unsigned int len; - leds1 = ~0x00; - leds2 = ~0x00; - sleep(3); - /* Initialise the device driver. */ - if (!etherdev_init()) - while(1); // Si falla init nos quedamos bobos - - etherdev_send(); - leds1 = ~0xaa; - leds2 = ~0xaa; - - - // leemos -do -{ - len = etherdev_read(); - if (len) - { - leds1 = ~0x55; - leds2 = len; - sleep(2); - for (len = 0; len < uip_len; ++len) - { - leds1 = ~(1 << (len % 8)); - leds2 = ~uip_buf[len]; - sleep(5); - } - leds1 = ~0x55; - leds2 = ~0x55; - } - else - { - leds1 = ~0xff; - leds2 = ~0xff; - } -} -while (1); // Quedamos paveando forever -} - +// vim: set et sw=4 sts=4 : + +#include "main.h" + +static xdata leds1 _at_ 0x0080; +static xdata leds2 _at_ 0x00c0; + +void sleep(unsigned char times) +{ + unsigned int i; + unsigned char j; + for (i = 0; i < 0xffff; ++i) + for (j = 0; j < times; ++j); +} + +void main(void) +{ + unsigned char count = 1; + unsigned int len; + leds1 = ~0xff; + leds2 = ~0xff; + sleep(3); + /* Initialise the device driver. */ + if (!etherdev_init()) + while(1); // Si falla init nos quedamos bobos + + etherdev_send(); + leds1 = ~0xaa; + leds2 = ~0xaa; + + + // leemos hasta el fin de nuestros días + while (1) + { + + len = etherdev_read(); + if (len) + { + //leds1 = ~0x55; + //leds2 = ~len; + //sleep(0); + /* + for (len = 0; len < uip_len; ++len) + { + leds1 = ~(1 << (len % 8)); + leds2 = ~uip_buf[len]; + sleep(5); + } + */ + //leds1 = ~0x33; + //leds2 = ~uip_buf[42]; + //sleep(5); + uip_buf[13] = count++; + etherdev_send(); + } + else + { + leds1 = ~0x00; + leds2 = ~0x00; + } + } +} +