-/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r
- º TITLE: Keil C51 v7.00 port of Adam Dunkels' uIP v0.9 º\r
- º REVISION: VER 0.1 º\r
- º REV.DATE: 30-01-05 º\r
- º ARCHIVE: º\r
- º AUTHOR: Murray R. Van Luyn, 2005. º\r
- ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */\r
-\r
-/* ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
- ³ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS ³ \r
- ³ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ³ \r
- ³ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ³ \r
- ³ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ³ \r
- ³ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ³ \r
- ³ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ³ \r
- ³ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ³ \r
- ³ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ³ \r
- ³ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ³ \r
- ³ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ³ \r
- ³ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ³ \r
- ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */\r
-\r
-#include "main.h"\r
-\r
-static xdata leds1 _at_ 0x0080;\r
-static xdata leds2 _at_ 0x00c0;\r
-\r
-void sleep(unsigned char times)\r
-{\r
- unsigned int i;\r
- unsigned char j;\r
- for (i = 0; i < 0xffff; ++i)\r
- for (j = 0; j < times; ++j);\r
-}\r
-\r
-/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r
- º º\r
- º main() º\r
- º º\r
- º Simple Web Server test application. º\r
- º º\r
- º º\r
- ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */\r
-void main(void)\r
-{\r
- unsigned int len;\r
- leds1 = ~0x00;\r
- leds2 = ~0x00;\r
- sleep(3);\r
- /* Initialise the device driver. */ \r
- if (!etherdev_init())\r
- while(1); // Si falla init nos quedamos bobos\r
-\r
- etherdev_send();\r
- leds1 = ~0xaa;\r
- leds2 = ~0xaa;\r
-\r
-\r
- // leemos\r
-do\r
-{\r
- len = etherdev_read();\r
- if (len)\r
- {\r
- leds1 = ~0x55;\r
- leds2 = len;\r
- sleep(2);\r
- for (len = 0; len < uip_len; ++len)\r
- {\r
- leds1 = ~(1 << (len % 8));\r
- leds2 = ~uip_buf[len];\r
- sleep(5);\r
- }\r
- leds1 = ~0x55;\r
- leds2 = ~0x55;\r
- }\r
- else\r
- {\r
- leds1 = ~0xff;\r
- leds2 = ~0xff;\r
- }\r
-}\r
-while (1); // Quedamos paveando forever\r
-}\r
-\r
+// vim: set et sw=4 sts=4 :
+
+#include "types.h"
+#include "main.h"
+
+#ifdef SDCC
+static byte xdata at 0x0080 leds1;
+static byte xdata at 0x00c0 leds2;
+#else
+static byte xdata leds1 _at_ 0x0080;
+static byte xdata leds2 _at_ 0x00c0;
+#endif
+
+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;
+ }
+ }
+}
+