mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[mpp_time_test]: Add timer test case
Change-Id: I65d4da1431fb68d0e8482aafb30dbeb651156d28 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -249,8 +249,6 @@ static void *mpp_timer_thread(void *ctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mpp_log("timer %p start looping\n", impl);
|
||||
|
||||
while (1) {
|
||||
if (MPP_THREAD_RUNNING != thd->get_status())
|
||||
break;
|
||||
|
@@ -19,11 +19,22 @@
|
||||
#include "mpp_log.h"
|
||||
#include "mpp_time.h"
|
||||
|
||||
void *timer_test(void *param)
|
||||
{
|
||||
static RK_S32 count = 0;
|
||||
(void) param;
|
||||
|
||||
mpp_log("mpp timer trigger %d\n", count++);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
RK_S64 time_0;
|
||||
RK_S64 time_1;
|
||||
MppClock clock;
|
||||
MppTimer timer;
|
||||
RK_S32 i;
|
||||
|
||||
mpp_log("mpp time test start\n");
|
||||
@@ -40,6 +51,20 @@ int main()
|
||||
|
||||
mpp_log("mpp time test done\n");
|
||||
|
||||
mpp_log("mpp timer test start\n");
|
||||
|
||||
timer = mpp_timer_get("test");
|
||||
|
||||
mpp_timer_set_callback(timer, timer_test, NULL);
|
||||
mpp_timer_set_timing(timer, 1000, 1000);
|
||||
mpp_timer_set_enable(timer, 1);
|
||||
|
||||
sleep(2);
|
||||
|
||||
mpp_timer_put(timer);
|
||||
|
||||
mpp_log("mpp timer test done\n");
|
||||
|
||||
mpp_log("mpp clock test start\n");
|
||||
|
||||
clock = mpp_clock_get("clock loop test");
|
||||
|
Reference in New Issue
Block a user