Stripped down version of Segundos NetService library (http://mbed.org/users/segundo/libraries/NetServices ). I have removed all NetServices, and all functions which had been disabled. Use this version when you need only pure TCP or UDP functions - this library compiles faster.

Dependencies:   lwip lwip-sys

Dependents:   christmasLights device_server pop3demo device_server_udp ... more

Committer:
hlipka
Date:
Mon Jan 10 21:03:11 2011 +0000
Revision:
0:8b387bed54c2
initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hlipka 0:8b387bed54c2 1 #include "sys_arch.h"
hlipka 0:8b387bed54c2 2 #include "mbed.h"
hlipka 0:8b387bed54c2 3 //DG 2010
hlipka 0:8b387bed54c2 4
hlipka 0:8b387bed54c2 5 #ifdef __cplusplus
hlipka 0:8b387bed54c2 6 extern "C" {
hlipka 0:8b387bed54c2 7 #endif
hlipka 0:8b387bed54c2 8
hlipka 0:8b387bed54c2 9 #ifdef __COMPLEX_AND_BUGGUY_HANDLING__
hlipka 0:8b387bed54c2 10 static Timer* pTmr = NULL;
hlipka 0:8b387bed54c2 11
hlipka 0:8b387bed54c2 12 void sys_init(void)
hlipka 0:8b387bed54c2 13 {
hlipka 0:8b387bed54c2 14 //Start Timer
hlipka 0:8b387bed54c2 15 pTmr = new Timer();
hlipka 0:8b387bed54c2 16 pTmr->start();
hlipka 0:8b387bed54c2 17 }
hlipka 0:8b387bed54c2 18
hlipka 0:8b387bed54c2 19 u32_t sys_jiffies(void) /* since power up. */
hlipka 0:8b387bed54c2 20 {
hlipka 0:8b387bed54c2 21 return (u32_t) (pTmr->read_ms()/10); //In /10ms units
hlipka 0:8b387bed54c2 22 }
hlipka 0:8b387bed54c2 23
hlipka 0:8b387bed54c2 24 u32_t sys_now(void)
hlipka 0:8b387bed54c2 25 {
hlipka 0:8b387bed54c2 26 return (u32_t) pTmr->read_ms(); //In /ms units
hlipka 0:8b387bed54c2 27 }
hlipka 0:8b387bed54c2 28 #elif0
hlipka 0:8b387bed54c2 29 void sys_init(void)
hlipka 0:8b387bed54c2 30 {
hlipka 0:8b387bed54c2 31
hlipka 0:8b387bed54c2 32 }
hlipka 0:8b387bed54c2 33
hlipka 0:8b387bed54c2 34 u32_t sys_jiffies(void) /* since power up. */
hlipka 0:8b387bed54c2 35 {
hlipka 0:8b387bed54c2 36 static int count = 0;
hlipka 0:8b387bed54c2 37 return ++count;
hlipka 0:8b387bed54c2 38 }
hlipka 0:8b387bed54c2 39
hlipka 0:8b387bed54c2 40 u32_t sys_now(void)
hlipka 0:8b387bed54c2 41 {
hlipka 0:8b387bed54c2 42 return (u32_t) time(NULL);
hlipka 0:8b387bed54c2 43 }
hlipka 0:8b387bed54c2 44 #else
hlipka 0:8b387bed54c2 45 static Timer* pTmr = NULL;
hlipka 0:8b387bed54c2 46
hlipka 0:8b387bed54c2 47 void sys_init(void)
hlipka 0:8b387bed54c2 48 {
hlipka 0:8b387bed54c2 49 //Start Timer
hlipka 0:8b387bed54c2 50 pTmr = new Timer();
hlipka 0:8b387bed54c2 51 pTmr->start();
hlipka 0:8b387bed54c2 52 }
hlipka 0:8b387bed54c2 53
hlipka 0:8b387bed54c2 54 u32_t sys_jiffies(void) /* since power up. */
hlipka 0:8b387bed54c2 55 {
hlipka 0:8b387bed54c2 56 static int count = 0;
hlipka 0:8b387bed54c2 57 return ++count;
hlipka 0:8b387bed54c2 58 //return (u32_t) (pTmr->read_us());
hlipka 0:8b387bed54c2 59 }
hlipka 0:8b387bed54c2 60
hlipka 0:8b387bed54c2 61 u32_t sys_now(void)
hlipka 0:8b387bed54c2 62 {
hlipka 0:8b387bed54c2 63 return (u32_t) (pTmr->read_ms()); //In /ms units
hlipka 0:8b387bed54c2 64 }
hlipka 0:8b387bed54c2 65 #endif
hlipka 0:8b387bed54c2 66
hlipka 0:8b387bed54c2 67
hlipka 0:8b387bed54c2 68 #ifdef __cplusplus
hlipka 0:8b387bed54c2 69 }
hlipka 0:8b387bed54c2 70 #endif