blob: 7b24ef207803ca3c05a074fe6ffd66157254f194 [file] [log] [blame]
b.liuae2dce52024-08-15 11:09:58 +08001#include <stdio.h>
2#include <sys/types.h>
3#include <sys/stat.h>
4#include <fcntl.h>
5
6#include "mbtk_utils.h"
7#include "mbtk_log.h"
8
9#define KMSG "/dev/kmsg"
10
11static int fd = -1;
12
13void timer_alrm_cb(int signo)
14{
15 char *str = "----------------------Timeout---------------------------\n";
16 if(fd > 0) {
17 write(fd, str, strlen(str));
18 }
19
20 printf("%s", str);
21 LOGI("%s", str);
22}
23
24
25int main(int argc, char *argv[])
26{
27 if(argc != 2) {
28 printf("mbtk_timer_test <time>\n");
29 return -1;
30 }
31 mbtk_log_init("radio", "MBTK");
32
33 int time = atoi(argv[1]);
34 if(time > 0) {
35 mbtk_timer_set(timer_alrm_cb, time * 1000);
36 }
37
38 fd = open(KMSG, O_WRONLY);
39 if(fd > 0) {
40 printf("Open kmsg success.");
41 }
42
43 while(1) {
44 sleep(24 * 60 * 60);
45 }
46
47 return 0;
48}
49