00001 /****************************************************************************** 00002 * * *** *** 00003 * *** *** *** 00004 * *** **** ********** *** ***** *** **** ***** 00005 * ********* ********** *** ********* ************ ********* 00006 * **** *** *** *** *** **** *** 00007 * *** *** ****** *** *********** *** **** ***** 00008 * *** *** ****** *** ************* *** **** ***** 00009 * *** **** **** *** *** *** **** *** 00010 * *** ******* ***** ************** ************* ********* 00011 * *** ***** *** ******* ** ** ****** ***** 00012 * t h e r e a l t i m e t a r g e t e x p e r t s 00013 * 00014 * http://www.rt-labs.com 00015 * Copyright (C) 2009. rt-labs AB, Sweden. All rights reserved. 00016 *------------------------------------------------------------------------------ 00017 * $Id: osal.h 452 2013-02-26 21:02:58Z smf.arthur $ 00018 *------------------------------------------------------------------------------ 00019 */ 00020 00021 #ifndef _osal_ 00022 #define _osal_ 00023 00024 #include <stdint.h> 00025 00026 /* General types */ 00027 typedef uint8_t boolean; 00028 #define TRUE 1 00029 #define FALSE 0 00030 typedef int8_t int8; 00031 typedef int16_t int16; 00032 typedef int32_t int32; 00033 typedef uint8_t uint8; 00034 typedef uint16_t uint16; 00035 typedef uint32_t uint32; 00036 typedef int64_t int64; 00037 typedef uint64_t uint64; 00038 typedef float float32; 00039 typedef double float64; 00040 00041 #ifndef PACKED 00042 #ifdef _MSC_VER 00043 #define PACKED_BEGIN __pragma(pack(push, 1)) 00044 #define PACKED 00045 #define PACKED_END __pragma(pack(pop)) 00046 #elif defined(__GNUC__) 00047 #define PACKED_BEGIN 00048 #define PACKED __attribute__((__packed__)) 00049 #define PACKED_END 00050 #endif 00051 #endif 00052 00053 typedef struct 00054 { 00055 uint32 sec; /*< Seconds elapsed since the Epoch (Jan 1, 1970) */ 00056 uint32 usec; /*< Microseconds elapsed since last second boundary */ 00057 } ec_timet; 00058 00059 typedef struct osal_timer 00060 { 00061 ec_timet stop_time; 00062 } osal_timert; 00063 00064 void osal_timer_start (osal_timert * self, uint32 timeout_us); 00065 boolean osal_timer_is_expired (const osal_timert * self); 00066 int osal_usleep (uint32 usec); 00067 ec_timet osal_current_time (void); 00068 00069 #endif