资源简介

SOEM最新源码。支持多种操作系统(包含Linux,win32,以及各种实时系统等),可供下载

资源截图

代码片段和文件信息

/*
 * Licensed under the GNU General Public License version 2 with exceptions. See
 * LICENSE file in the project root for full license information
 */

#include 
#include 
#include 

static int64_t sysfrequency;
static double qpc2usec;

#define USECS_PER_SEC     1000000

int osal_gettimeofday (struct timeval *tv struct timezone *tz)
{
   return gettimeofday (tv tz);
}

ec_timet osal_current_time (void)
{
   struct timeval current_time;
   ec_timet return_value;

   osal_gettimeofday (¤t_time 0);
   return_value.sec = current_time.tv_sec;
   return_value.usec = current_time.tv_usec;
   return return_value;
}

void osal_timer_start (osal_timert * self uint32 timeout_usec)
{
   struct timeval start_time;
   struct timeval timeout;
   struct timeval stop_time;

   osal_gettimeofday (&start_time 0);
   timeout.tv_sec = timeout_usec / USECS_PER_SEC;
   timeout.tv_usec = timeout_usec % USECS_PER_SEC;
   timeradd (&start_time &timeout &stop_time);

   self->stop_time.sec = stop_time.tv_sec;
   self->stop_time.usec = stop_time.tv_usec;
}

boolean osal_timer_is_expired (osal_timert * self)
{
   struct timeval current_time;
   struct timeval stop_time;
   int is_not_yet_expired;

   osal_gettimeofday (¤t_time 0);
   stop_time.tv_sec = self->stop_time.sec;
   stop_time.tv_usec = self->stop_time.usec;
   is_not_yet_expired = timercmp (¤t_time &stop_time <);

   return is_not_yet_expired == FALSE;
}

int osal_usleep(uint32 usec)
{
   RtSleepEx (usec / 1000);
   return 1;
}

/* Mutex is not needed when running single threaded */

void osal_mtx_lock(osal_mutex_t * mtx)
{
        /* RtWaitForSingleobject((HANDLE)mtx INFINITE); */
}

void osal_mtx_unlock(osal_mutex_t * mtx)
{
        /* RtReleaseMutex((HANDLE)mtx); */
}

int osal_mtx_lock_timeout(osal_mutex_t * mtx uint32_t time_ms)
{
        /* return RtWaitForSingleobject((HANDLE)mtx time_ms); */
        return 0;
}

osal_mutex_t * osal_mtx_create(void)
{
        /* return (void*)RtCreateMutex(NULL FALSE NULL); */
        return (void *)0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-08-07 09:00  SOEM-master\
     文件         430  2018-08-07 09:00  SOEM-master\.gitattributes
     目录           0  2018-08-13 11:20  __MACOSX\
     目录           0  2018-08-13 11:20  __MACOSX\SOEM-master\
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\._.gitattributes
     文件          39  2018-08-07 09:00  SOEM-master\.gitignore
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\._.gitignore
     文件         119  2018-08-07 09:00  SOEM-master\.travis.yml
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\._.travis.yml
     文件         250  2018-08-07 09:00  SOEM-master\appveyor.yml
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\._appveyor.yml
     文件        3954  2018-08-07 09:00  SOEM-master\ChangeLog
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\._ChangeLog
     目录           0  2018-08-07 09:00  SOEM-master\cmake\
     目录           0  2018-08-07 09:00  SOEM-master\cmake\Modules\
     目录           0  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\
     文件         329  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rt-kernel-C.cmake
     目录           0  2018-08-13 11:20  __MACOSX\SOEM-master\cmake\
     目录           0  2018-08-13 11:20  __MACOSX\SOEM-master\cmake\Modules\
     目录           0  2018-08-13 11:20  __MACOSX\SOEM-master\cmake\Modules\Platform\
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rt-kernel-C.cmake
     文件          84  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rt-kernel-gcc-bfin.cmake
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rt-kernel-gcc-bfin.cmake
     文件         177  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rt-kernel-gcc-kinetis.cmake
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rt-kernel-gcc-kinetis.cmake
     文件         556  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rt-kernel-gcc.cmake
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rt-kernel-gcc.cmake
     文件         460  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rt-kernel.cmake
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rt-kernel.cmake
     文件         583  2018-08-07 09:00  SOEM-master\cmake\Modules\Platform\rtems.cmake
     文件         212  2018-08-07 09:00  __MACOSX\SOEM-master\cmake\Modules\Platform\._rtems.cmake
............此处省略361个文件信息

评论

共有 条评论