add Freescale MQX time functionality

This commit is contained in:
Chris Conlon
2013-09-24 20:12:48 -06:00
parent 27078bb89c
commit 17b220e9c7
2 changed files with 35 additions and 0 deletions

View File

@@ -100,6 +100,11 @@
#define XTIME(t1) pic32_time((t1)) #define XTIME(t1) pic32_time((t1))
#define XGMTIME(c) gmtime((c)) #define XGMTIME(c) gmtime((c))
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t)) #define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
#elif defined(FREESCALE_MQX)
#include <time.h>
#define XTIME(t1) mqx_time((t1))
#define XGMTIME(c) gmtime((c))
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
#elif defined(CYASSL_MDK_ARM) #elif defined(CYASSL_MDK_ARM)
#include <rtl.h> #include <rtl.h>
#undef RNG #undef RNG
@@ -289,6 +294,25 @@ time_t pic32_time(time_t* timer)
#endif /* MICROCHIP_TCPIP */ #endif /* MICROCHIP_TCPIP */
#ifdef FREESCALE_MQX
time_t mqx_time(time_t* timer)
{
time_t localTime;
TIME_STRUCT time_s;
if (timer == NULL)
timer = &localTime;
_time_get(&time_s);
*timer = (time_t) time_s.SECONDS;
return *timer;
}
#endif /* FREESCALE_MQX */
static INLINE word32 btoi(byte b) static INLINE word32 btoi(byte b)
{ {
return b - 0x30; return b - 0x30;

View File

@@ -2216,6 +2216,17 @@ ProtocolVersion MakeDTLSv1_2(void)
return (word32) SYS_TICK_Get(); return (word32) SYS_TICK_Get();
} }
#elif defined(FREESCALE_MQX)
word32 LowResTimer(void)
{
TIME_STRUCT mqxTime;
_time_get_elapsed(&mqxTime);
return (word32) mqxTime.SECONDS;
}
#elif defined(USER_TICKS) #elif defined(USER_TICKS)
#if 0 #if 0