!247 fix: tick 动态化计算优化,减小中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。
Merge pull request !247 from zhushengle/tick_sched
This commit is contained in:
@@ -66,7 +66,9 @@ static UINT32 Testcase(VOID)
|
||||
LOS_SwtmrStart(swTmrID);
|
||||
|
||||
LOS_TaskDelay(11); // 11, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); // 10, Here, assert that g_testCount is equal to 10.
|
||||
if (g_testCount < 10) { // 10, Here, assert that g_testCount is equal to 10.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); // 10, Here, assert that g_testCount is equal to 10.
|
||||
}
|
||||
EXIT:
|
||||
|
||||
LOS_SwtmrDelete(swTmrID);
|
||||
|
||||
@@ -44,9 +44,6 @@ static VOID HwiF01(void)
|
||||
UINT32 ret;
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_TRACK_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_SemPend(g_usSemID, LOS_WAIT_FOREVER);
|
||||
ICUNIT_TRACK_EQUAL(ret, LOS_ERRNO_SEM_PEND_INTERR, ret);
|
||||
|
||||
|
||||
@@ -67,9 +67,10 @@ static UINT32 Testcase(VOID)
|
||||
ret = LOS_TaskDelay(10); // 10, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
// 2, assert that g_testCount is equal to this.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2 * i, g_testCount, EXIT);
|
||||
|
||||
if (g_testCount < (2 * i)) { // 2, assert that g_testCount is equal to this.
|
||||
// 2, assert that g_testCount is equal to this.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2 * i, g_testCount, EXIT);
|
||||
}
|
||||
ret = LOS_SwtmrDelete(swTmrID);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
// 4, Timeout interval of a periodic software timer.
|
||||
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case1, &swtmrId1, 0xffff, OS_SWTMR_ROUSES_ALLOW,
|
||||
OS_SWTMR_ALIGN_SENSITIVE);
|
||||
OS_SWTMR_ALIGN_INSENSITIVE);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
// 4, Timeout interval of a periodic software timer.
|
||||
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case2, &swtmrId2, 0xffff, OS_SWTMR_ROUSES_ALLOW,
|
||||
OS_SWTMR_ALIGN_SENSITIVE);
|
||||
OS_SWTMR_ALIGN_INSENSITIVE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_SwtmrStart(swtmrId1);
|
||||
|
||||
@@ -74,8 +74,10 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
// 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_SwtmrDelete(swtmrId1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
@@ -85,8 +87,7 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
// 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to this .
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
|
||||
@@ -82,9 +82,11 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(15); // 15, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
// 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1 - g_swtmrCount2, 0, g_swtmrCount1 - g_swtmrCount2, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1 - g_swtmrCount2, 1, g_swtmrCount1 - g_swtmrCount2, EXIT);
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_SwtmrDelete(swtmrId1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
@@ -94,8 +96,7 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
// 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to this .
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
|
||||
@@ -99,10 +99,17 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2 - g_swtmrCount1, 0, g_swtmrCount2 - g_swtmrCount1, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3 - g_swtmrCount2, 0, g_swtmrCount3 - g_swtmrCount2, EXIT);
|
||||
// 3, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1, 1, g_swtmrCount1, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2, 0, g_swtmrCount2, EXIT); // 0, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3, 0, g_swtmrCount3, EXIT); // 0, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_TaskDelay(60); // 60, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1, 4, g_swtmrCount1, EXIT); // 4, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2, 2, g_swtmrCount2, EXIT); // 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3, 1, g_swtmrCount3, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_SwtmrDelete(swtmrId1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
@@ -113,11 +120,6 @@ static UINT32 Testcase(VOID)
|
||||
ret = LOS_SwtmrDelete(swtmrId3);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskDelay(20); // 20, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
// 3, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
|
||||
@@ -105,10 +105,16 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
ret = LOS_TaskDelay(10); // 10, set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2 - g_swtmrCount2, 0, g_swtmrCount2 - g_swtmrCount1, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3 - g_swtmrCount2, 0, g_swtmrCount3 - g_swtmrCount2, EXIT);
|
||||
// 3, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1, 1, g_swtmrCount1, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2, 0, g_swtmrCount2, EXIT); // 0, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3, 0, g_swtmrCount3, EXIT); // 0, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_TaskDelay(60); // 60, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount1, 4, g_swtmrCount1, EXIT); // 4, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount2, 2, g_swtmrCount2, EXIT); // 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_swtmrCount3, 1, g_swtmrCount3, EXIT); // 1, Here, assert that g_testCount is equal to this .
|
||||
|
||||
ret = LOS_SwtmrDelete(swtmrId1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
@@ -119,11 +125,6 @@ static UINT32 Testcase(VOID)
|
||||
ret = LOS_SwtmrDelete(swtmrId3);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
ret = LOS_TaskDelay(10); // 10, set delay time.
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
// 3, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
|
||||
@@ -46,7 +46,7 @@ static VOID TaskF01(VOID)
|
||||
tick2 = LOS_TickCountGet();
|
||||
tick2 = tick2 - tick1;
|
||||
|
||||
if ((tick2 != 10) && (tick2 != 11)) { // 10, 11 delay time
|
||||
if (tick2 < 10) { // 10, delay time
|
||||
ICUNIT_GOTO_EQUAL(tick2, 0, tick2, EXIT); // 0, Here, assert that result is equal to 0.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user