blob: 393c7c39a31053f885adf01ee4022606c1ba9e9b [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"
17
18#define STR_GET(str) (#str)
19
20static mbtk_build_def_info_t def_infos[MBTK_BUILD_DEF_NUM];
21static bool inited = FALSE;
22
23static void def_item_set(mbtk_build_define_enum def_id, char *name, char *value)
24{
25 switch(def_id)
26 {
27 case MBTK_BUILD_DEF_AF_SUPPORT:
28 {
29 strcpy(name, STR_GET(MBTK_BUILD_DEF_AF_SUPPORT));
30#ifdef MBTK_AF_SUPPORT
31 strcpy(value, "Y");
32#else
33 strcpy(value, "N");
34#endif
35 break;
36 }
37 case MBTK_BUILD_DEF_YX_SUPPORT:
38 {
39 strcpy(name, STR_GET(MBTK_BUILD_DEF_YX_SUPPORT));
40#ifdef MBTK_YX_SUPPORT
41 strcpy(value, "Y");
42#else
43 strcpy(value, "N");
44#endif
45 break;
46 }
47 case MBTK_BUILD_DEF_SG_SUPPORT:
48 {
49 strcpy(name, STR_GET(MBTK_BUILD_DEF_SG_SUPPORT));
50#ifdef MBTK_SG_SUPPORT
51 strcpy(value, "Y");
52#else
53 strcpy(value, "N");
54#endif
55 break;
56 }
57 case MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT:
58 {
59 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT));
60#ifdef MBTK_ALL_CID_SUPPORT
61 strcpy(value, "Y");
62#else
63 strcpy(value, "N");
64#endif
65 break;
66 }
67 case MBTK_BUILD_DEF_MBTK_GNSS_MODE:
68 {
69 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_GNSS_MODE));
70#if defined(MBTK_GNSS_6228)
71 strcpy(value, "6228");
72#elif defined(MBTK_GNSS_5311)
73 strcpy(value, "5311");
74#else
75 strcpy(value, "Unknown");
76#endif
77 break;
78 }
b.liubb590492024-06-13 16:42:08 +080079 case MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT:
80 {
81 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT));
82#ifdef MBTK_DUMP_SUPPORT
83 strcpy(value, "Y");
84#else
85 strcpy(value, "N");
86#endif
b.liu9b18cb02024-06-13 20:23:22 +080087 break;
b.liubb590492024-06-13 16:42:08 +080088 }
b.liu047a21c2024-06-07 17:54:41 +080089 default:
90 {
91 strcpy(name, "Unknown");
92 strcpy(value, "Unknown");
93 break;
94 }
95 }
96}
97
98static void def_info_reset()
99{
100 if(!inited) {
101 int index = 0;
102 while(index < MBTK_BUILD_DEF_NUM) {
103 memset(&(def_infos[index]), 0, sizeof(mbtk_build_def_info_t));
104 def_item_set(index, def_infos[index].name, def_infos[index].value);
105 index++;
106 }
107 inited = TRUE;
108 }
109}
110
111void mbtk_build_def_get(char *buff, int buff_len)
112{
113 if(buff && buff_len > 0) {
114 def_info_reset();
115
116 int len = 0;
117 int index = 0;
118 while(index < MBTK_BUILD_DEF_NUM) {
119 len += snprintf(buff + len, buff_len - len, "%s:%s\n", def_infos[index].name, def_infos[index].value);
120 index++;
121 }
122 }
123}
124