blob: a144c9331b3068e1afcda55e7d7277c3a903c195 [file] [log] [blame]
b.liu047a21c2024-06-07 17:54:41 +08001/*
2* mbtk_version.c
3*
4* mbtk_source compilation informations.
5*
6*/
7/******************************************************************************
8
9 EDIT HISTORY FOR FILE
10
11 WHEN WHO WHAT,WHERE,WHY
12-------- -------- -------------------------------------------------------
132024/6/7 LiuBin Initial version
14
15******************************************************************************/
16#include "mbtk_version.h"
b.liubcf86c92024-08-19 19:48:28 +080017#include "mbtk_log.h"
b.liu047a21c2024-06-07 17:54:41 +080018
19#define STR_GET(str) (#str)
20
21static mbtk_build_def_info_t def_infos[MBTK_BUILD_DEF_NUM];
22static bool inited = FALSE;
23
24static void def_item_set(mbtk_build_define_enum def_id, char *name, char *value)
25{
26 switch(def_id)
27 {
28 case MBTK_BUILD_DEF_AF_SUPPORT:
29 {
30 strcpy(name, STR_GET(MBTK_BUILD_DEF_AF_SUPPORT));
31#ifdef MBTK_AF_SUPPORT
32 strcpy(value, "Y");
33#else
34 strcpy(value, "N");
35#endif
36 break;
37 }
38 case MBTK_BUILD_DEF_YX_SUPPORT:
39 {
40 strcpy(name, STR_GET(MBTK_BUILD_DEF_YX_SUPPORT));
41#ifdef MBTK_YX_SUPPORT
42 strcpy(value, "Y");
43#else
44 strcpy(value, "N");
45#endif
46 break;
47 }
48 case MBTK_BUILD_DEF_SG_SUPPORT:
49 {
50 strcpy(name, STR_GET(MBTK_BUILD_DEF_SG_SUPPORT));
51#ifdef MBTK_SG_SUPPORT
52 strcpy(value, "Y");
53#else
54 strcpy(value, "N");
55#endif
56 break;
57 }
58 case MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT:
59 {
60 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT));
61#ifdef MBTK_ALL_CID_SUPPORT
62 strcpy(value, "Y");
63#else
64 strcpy(value, "N");
65#endif
66 break;
67 }
68 case MBTK_BUILD_DEF_MBTK_GNSS_MODE:
69 {
70 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_GNSS_MODE));
71#if defined(MBTK_GNSS_6228)
72 strcpy(value, "6228");
73#elif defined(MBTK_GNSS_5311)
74 strcpy(value, "5311");
75#else
76 strcpy(value, "Unknown");
77#endif
78 break;
79 }
b.liubb590492024-06-13 16:42:08 +080080 case MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT:
81 {
82 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT));
83#ifdef MBTK_DUMP_SUPPORT
84 strcpy(value, "Y");
85#else
86 strcpy(value, "N");
87#endif
b.liu9b18cb02024-06-13 20:23:22 +080088 break;
b.liubb590492024-06-13 16:42:08 +080089 }
b.liu047a21c2024-06-07 17:54:41 +080090 default:
91 {
92 strcpy(name, "Unknown");
93 strcpy(value, "Unknown");
94 break;
95 }
96 }
97}
98
99static void def_info_reset()
100{
101 if(!inited) {
102 int index = 0;
103 while(index < MBTK_BUILD_DEF_NUM) {
104 memset(&(def_infos[index]), 0, sizeof(mbtk_build_def_info_t));
105 def_item_set(index, def_infos[index].name, def_infos[index].value);
106 index++;
107 }
108 inited = TRUE;
109 }
110}
111
112void mbtk_build_def_get(char *buff, int buff_len)
113{
114 if(buff && buff_len > 0) {
115 def_info_reset();
116
117 int len = 0;
118 int index = 0;
119 while(index < MBTK_BUILD_DEF_NUM) {
120 len += snprintf(buff + len, buff_len - len, "%s:%s\n", def_infos[index].name, def_infos[index].value);
121 index++;
122 }
123 }
124}
125
b.liubcf86c92024-08-19 19:48:28 +0800126void mbtk_lib_info_print()
127{
128 MBTK_SOURCE_INFO_PRINT("mbtk_lib");
129}
130