NetServices Stack source
Dependents: HelloWorld ServoInterfaceBoardExample1 4180_Lab4
sys_arch.cpp
00001 #include "sys_arch.h" 00002 #include "mbed.h" 00003 //DG 2010 00004 00005 #ifdef __cplusplus 00006 extern "C" { 00007 #endif 00008 00009 #ifdef __COMPLEX_AND_BUGGUY_HANDLING__ 00010 static Timer* pTmr = NULL; 00011 00012 void sys_init(void) 00013 { 00014 //Start Timer 00015 pTmr = new Timer(); 00016 pTmr->start(); 00017 } 00018 00019 u32_t sys_jiffies(void) /* since power up. */ 00020 { 00021 return (u32_t) (pTmr->read_ms()/10); //In /10ms units 00022 } 00023 00024 u32_t sys_now(void) 00025 { 00026 return (u32_t) pTmr->read_ms(); //In /ms units 00027 } 00028 #elif0 00029 void sys_init(void) 00030 { 00031 00032 } 00033 00034 u32_t sys_jiffies(void) /* since power up. */ 00035 { 00036 static int count = 0; 00037 return ++count; 00038 } 00039 00040 u32_t sys_now(void) 00041 { 00042 return (u32_t) time(NULL); 00043 } 00044 #else 00045 static Timer* pTmr = NULL; 00046 00047 void sys_init(void) 00048 { 00049 //Start Timer 00050 pTmr = new Timer(); 00051 pTmr->start(); 00052 } 00053 00054 u32_t sys_jiffies(void) /* since power up. */ 00055 { 00056 static int count = 0; 00057 return ++count; 00058 //return (u32_t) (pTmr->read_us()); 00059 } 00060 00061 u32_t sys_now(void) 00062 { 00063 return (u32_t) (pTmr->read_ms()); //In /ms units 00064 } 00065 #endif 00066 00067 00068 #ifdef __cplusplus 00069 } 00070 #endif
Generated on Tue Jul 12 2022 11:52:58 by 1.7.2