Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NetServices/lwip/arch/sys_arch.cpp@1:41024576e6e2, 2011-05-30 (annotated)
- Committer:
- mbed714
- Date:
- Mon May 30 15:06:52 2011 +0000
- Revision:
- 1:41024576e6e2
- Parent:
- 0:55680e5cc478
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbed714 | 0:55680e5cc478 | 1 | #include "sys_arch.h" |
| mbed714 | 0:55680e5cc478 | 2 | #include "mbed.h" |
| mbed714 | 0:55680e5cc478 | 3 | //DG 2010 |
| mbed714 | 0:55680e5cc478 | 4 | |
| mbed714 | 0:55680e5cc478 | 5 | #ifdef __cplusplus |
| mbed714 | 0:55680e5cc478 | 6 | extern "C" { |
| mbed714 | 0:55680e5cc478 | 7 | #endif |
| mbed714 | 0:55680e5cc478 | 8 | |
| mbed714 | 0:55680e5cc478 | 9 | #ifdef __COMPLEX_AND_BUGGUY_HANDLING__ |
| mbed714 | 0:55680e5cc478 | 10 | static Timer* pTmr = NULL; |
| mbed714 | 0:55680e5cc478 | 11 | |
| mbed714 | 0:55680e5cc478 | 12 | void sys_init(void) |
| mbed714 | 0:55680e5cc478 | 13 | { |
| mbed714 | 0:55680e5cc478 | 14 | //Start Timer |
| mbed714 | 0:55680e5cc478 | 15 | pTmr = new Timer(); |
| mbed714 | 0:55680e5cc478 | 16 | pTmr->start(); |
| mbed714 | 0:55680e5cc478 | 17 | } |
| mbed714 | 0:55680e5cc478 | 18 | |
| mbed714 | 0:55680e5cc478 | 19 | u32_t sys_jiffies(void) /* since power up. */ |
| mbed714 | 0:55680e5cc478 | 20 | { |
| mbed714 | 0:55680e5cc478 | 21 | return (u32_t) (pTmr->read_ms()/10); //In /10ms units |
| mbed714 | 0:55680e5cc478 | 22 | } |
| mbed714 | 0:55680e5cc478 | 23 | |
| mbed714 | 0:55680e5cc478 | 24 | u32_t sys_now(void) |
| mbed714 | 0:55680e5cc478 | 25 | { |
| mbed714 | 0:55680e5cc478 | 26 | return (u32_t) pTmr->read_ms(); //In /ms units |
| mbed714 | 0:55680e5cc478 | 27 | } |
| mbed714 | 0:55680e5cc478 | 28 | #elif0 |
| mbed714 | 0:55680e5cc478 | 29 | void sys_init(void) |
| mbed714 | 0:55680e5cc478 | 30 | { |
| mbed714 | 0:55680e5cc478 | 31 | |
| mbed714 | 0:55680e5cc478 | 32 | } |
| mbed714 | 0:55680e5cc478 | 33 | |
| mbed714 | 0:55680e5cc478 | 34 | u32_t sys_jiffies(void) /* since power up. */ |
| mbed714 | 0:55680e5cc478 | 35 | { |
| mbed714 | 0:55680e5cc478 | 36 | static int count = 0; |
| mbed714 | 0:55680e5cc478 | 37 | return ++count; |
| mbed714 | 0:55680e5cc478 | 38 | } |
| mbed714 | 0:55680e5cc478 | 39 | |
| mbed714 | 0:55680e5cc478 | 40 | u32_t sys_now(void) |
| mbed714 | 0:55680e5cc478 | 41 | { |
| mbed714 | 0:55680e5cc478 | 42 | return (u32_t) time(NULL); |
| mbed714 | 0:55680e5cc478 | 43 | } |
| mbed714 | 0:55680e5cc478 | 44 | #else |
| mbed714 | 0:55680e5cc478 | 45 | static Timer* pTmr = NULL; |
| mbed714 | 0:55680e5cc478 | 46 | |
| mbed714 | 0:55680e5cc478 | 47 | void sys_init(void) |
| mbed714 | 0:55680e5cc478 | 48 | { |
| mbed714 | 0:55680e5cc478 | 49 | //Start Timer |
| mbed714 | 0:55680e5cc478 | 50 | pTmr = new Timer(); |
| mbed714 | 0:55680e5cc478 | 51 | pTmr->start(); |
| mbed714 | 0:55680e5cc478 | 52 | } |
| mbed714 | 0:55680e5cc478 | 53 | |
| mbed714 | 0:55680e5cc478 | 54 | u32_t sys_jiffies(void) /* since power up. */ |
| mbed714 | 0:55680e5cc478 | 55 | { |
| mbed714 | 0:55680e5cc478 | 56 | static int count = 0; |
| mbed714 | 0:55680e5cc478 | 57 | return ++count; |
| mbed714 | 0:55680e5cc478 | 58 | //return (u32_t) (pTmr->read_us()); |
| mbed714 | 0:55680e5cc478 | 59 | } |
| mbed714 | 0:55680e5cc478 | 60 | |
| mbed714 | 0:55680e5cc478 | 61 | u32_t sys_now(void) |
| mbed714 | 0:55680e5cc478 | 62 | { |
| mbed714 | 0:55680e5cc478 | 63 | return (u32_t) (pTmr->read_ms()); //In /ms units |
| mbed714 | 0:55680e5cc478 | 64 | } |
| mbed714 | 0:55680e5cc478 | 65 | #endif |
| mbed714 | 0:55680e5cc478 | 66 | |
| mbed714 | 0:55680e5cc478 | 67 | |
| mbed714 | 0:55680e5cc478 | 68 | #ifdef __cplusplus |
| mbed714 | 0:55680e5cc478 | 69 | } |
| mbed714 | 0:55680e5cc478 | 70 | #endif |