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