EthernetNetIf Compatibility.
Dependents: XBeeWiFi_SPI_example
Fork of NetServicesSource by
lwip/arch/sys_arch.cpp@0:632c9925f013, 2010-06-11 (annotated)
- Committer:
- donatien
- Date:
- Fri Jun 11 16:05:15 2010 +0000
- Revision:
- 0:632c9925f013
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:632c9925f013 | 1 | #include "sys_arch.h" |
donatien | 0:632c9925f013 | 2 | #include "mbed.h" |
donatien | 0:632c9925f013 | 3 | //DG 2010 |
donatien | 0:632c9925f013 | 4 | |
donatien | 0:632c9925f013 | 5 | #ifdef __cplusplus |
donatien | 0:632c9925f013 | 6 | extern "C" { |
donatien | 0:632c9925f013 | 7 | #endif |
donatien | 0:632c9925f013 | 8 | |
donatien | 0:632c9925f013 | 9 | #ifdef __COMPLEX_AND_BUGGUY_HANDLING__ |
donatien | 0:632c9925f013 | 10 | static Timer* pTmr = NULL; |
donatien | 0:632c9925f013 | 11 | |
donatien | 0:632c9925f013 | 12 | void sys_init(void) |
donatien | 0:632c9925f013 | 13 | { |
donatien | 0:632c9925f013 | 14 | //Start Timer |
donatien | 0:632c9925f013 | 15 | pTmr = new Timer(); |
donatien | 0:632c9925f013 | 16 | pTmr->start(); |
donatien | 0:632c9925f013 | 17 | } |
donatien | 0:632c9925f013 | 18 | |
donatien | 0:632c9925f013 | 19 | u32_t sys_jiffies(void) /* since power up. */ |
donatien | 0:632c9925f013 | 20 | { |
donatien | 0:632c9925f013 | 21 | return (u32_t) (pTmr->read_ms()/10); //In /10ms units |
donatien | 0:632c9925f013 | 22 | } |
donatien | 0:632c9925f013 | 23 | |
donatien | 0:632c9925f013 | 24 | u32_t sys_now(void) |
donatien | 0:632c9925f013 | 25 | { |
donatien | 0:632c9925f013 | 26 | return (u32_t) pTmr->read_ms(); //In /ms units |
donatien | 0:632c9925f013 | 27 | } |
donatien | 0:632c9925f013 | 28 | #elif0 |
donatien | 0:632c9925f013 | 29 | void sys_init(void) |
donatien | 0:632c9925f013 | 30 | { |
donatien | 0:632c9925f013 | 31 | |
donatien | 0:632c9925f013 | 32 | } |
donatien | 0:632c9925f013 | 33 | |
donatien | 0:632c9925f013 | 34 | u32_t sys_jiffies(void) /* since power up. */ |
donatien | 0:632c9925f013 | 35 | { |
donatien | 0:632c9925f013 | 36 | static int count = 0; |
donatien | 0:632c9925f013 | 37 | return ++count; |
donatien | 0:632c9925f013 | 38 | } |
donatien | 0:632c9925f013 | 39 | |
donatien | 0:632c9925f013 | 40 | u32_t sys_now(void) |
donatien | 0:632c9925f013 | 41 | { |
donatien | 0:632c9925f013 | 42 | return (u32_t) time(NULL); |
donatien | 0:632c9925f013 | 43 | } |
donatien | 0:632c9925f013 | 44 | #else |
donatien | 0:632c9925f013 | 45 | static Timer* pTmr = NULL; |
donatien | 0:632c9925f013 | 46 | |
donatien | 0:632c9925f013 | 47 | void sys_init(void) |
donatien | 0:632c9925f013 | 48 | { |
donatien | 0:632c9925f013 | 49 | //Start Timer |
donatien | 0:632c9925f013 | 50 | pTmr = new Timer(); |
donatien | 0:632c9925f013 | 51 | pTmr->start(); |
donatien | 0:632c9925f013 | 52 | } |
donatien | 0:632c9925f013 | 53 | |
donatien | 0:632c9925f013 | 54 | u32_t sys_jiffies(void) /* since power up. */ |
donatien | 0:632c9925f013 | 55 | { |
donatien | 0:632c9925f013 | 56 | static int count = 0; |
donatien | 0:632c9925f013 | 57 | return ++count; |
donatien | 0:632c9925f013 | 58 | //return (u32_t) (pTmr->read_us()); |
donatien | 0:632c9925f013 | 59 | } |
donatien | 0:632c9925f013 | 60 | |
donatien | 0:632c9925f013 | 61 | u32_t sys_now(void) |
donatien | 0:632c9925f013 | 62 | { |
donatien | 0:632c9925f013 | 63 | return (u32_t) (pTmr->read_ms()); //In /ms units |
donatien | 0:632c9925f013 | 64 | } |
donatien | 0:632c9925f013 | 65 | #endif |
donatien | 0:632c9925f013 | 66 | |
donatien | 0:632c9925f013 | 67 | |
donatien | 0:632c9925f013 | 68 | #ifdef __cplusplus |
donatien | 0:632c9925f013 | 69 | } |
donatien | 0:632c9925f013 | 70 | #endif |