/* * Copyright (C) 2009-2016 Realtek Semiconductor Corp. * All Rights Reserved. * * This program is the proprietary software of Realtek Semiconductor * Corporation and/or its licensors, and only be used, duplicated, * modified or distributed under the authorized license from Realtek. * * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. * * $Revision: 71708 $ * $Date: 2016-09-19 11:31:17 +0800 (Mon, 19 Sep 2016) $ * * Purpose : Definition of OSAL test APIs in the SDK * * Feature : OSAL test APIs * */ /* * Include Files */ #include //#include /* * Symbol Definition */ #define OSAL_TIME_SEC_TOLERANT (2) /* 2 secs */ #define OSAL_TIME_USEC_TOLERANT (1*1000000) /* 1 secs */ #define OSAL_TIME_TICK_TOLERANT (5) /* 5 ticks */ #define TICK_TOLERANT_IN_USEC (OSAL_TIME_TICK_TOLERANT*TICK_USEC) /* * Data Declaration */ /* * Macro */ /* * Function Declaration */ /* Test Function: Thread:osal_time_udelay Time :osal_usec2Ticks, osal_seconds_get, osal_time_usecs_get */ int32 osal_time_test(uint32 caseNo, uint32 unit) { unsigned int usec, sec; unsigned int expected_ticks, pTicks; unsigned int sec_begin, usec_begin, current_sec, current_usec; unsigned int total_usec_delay = 0, expected_usec, expected_sec; unsigned int total_sec_delay = 0; int i; int retval = 0; RT_LOG(LOG_FUNC_ENTER, MOD_UNITTEST, "[%s] Running TIME test cases", __FUNCTION__); /* osal_usec2Ticks Test */ for(i=0;i