[Feature][T8TSK-289]merge old platform branch, add meta to public rep
Only Configure: No
Affected branch: MR3.0-Merge-v2.0
Affected module: all lynq
Is it affected on both ZXIC and MTK: only MTK
Self-test: No
Doc Update: No
diff --git a/common_src/lib/liblynq-qser-adc/LICENSE b/common_src/lib/liblynq-qser-adc/LICENSE
new file mode 100755
index 0000000..605b7ea
--- /dev/null
+++ b/common_src/lib/liblynq-qser-adc/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/common_src/lib/liblynq-qser-adc/include/liblynq-qser-adc.h b/common_src/lib/liblynq-qser-adc/include/liblynq-qser-adc.h
new file mode 100755
index 0000000..55fb090
--- /dev/null
+++ b/common_src/lib/liblynq-qser-adc/include/liblynq-qser-adc.h
@@ -0,0 +1,29 @@
+/*=============================================================================
+# FileName: lynq_qser_adc_show.h
+# Desc: about adc show for user
+# Author: cz.li
+# Version: V1.0
+# LastChange: 2023-05-31
+# History:
+ copyright:Mobiletek
+=============================================================================*/
+#ifndef LYNQLIB_QSER_ADC_SHOW_H
+#define LYNQLIB_QSER_ADC_SHOW__H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef enum ADC_CHANNEL_ENUM
+{
+ QADC_NONE = 0,
+ ADC0 =1,
+ ADC1 =2,
+ ADC2 =3,
+ QADC_END
+}ADC_CHANNEL_E;
+
+int qser_adc_show(ADC_CHANNEL_E qadc);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/common_src/lib/liblynq-qser-adc/liblynq_qser_adc.cpp b/common_src/lib/liblynq-qser-adc/liblynq_qser_adc.cpp
new file mode 100755
index 0000000..98f037f
--- /dev/null
+++ b/common_src/lib/liblynq-qser-adc/liblynq_qser_adc.cpp
@@ -0,0 +1,66 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <liblog/lynq_deflog.h>
+#include "include/liblynq-qser-adc.h"
+#define USER_LOG_TAG "LIBLYNQ_QSER_ADC"
+#undef LOG_TAG
+#define LOG_TAG "LIBLYNQ_QSER_ADC"
+int qser_adc_show(ADC_CHANNEL_E qadc)
+{
+ int adc_value;
+ char cmd[1024];
+ char cmd_ret[1024];
+ FILE *fp;
+ switch(qadc)
+ {
+ case QADC_NONE:
+ {
+ LYERRLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ return 0;
+ }
+ case ADC0:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd,"cat /sys/bus/iio/devices/iio:device1/in_voltage0_input");
+ break;
+ }
+ case ADC1:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd,"cat /sys/bus/iio/devices/iio:device1/in_voltage1_input");
+ break;
+ }
+ case ADC2:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd,"cat /sys/bus/iio/devices/iio:device1/in_voltage2_input");
+ break;
+ }
+ default:
+ {
+ LYERRLOG("input error\n");
+ return -1;
+ }
+ }
+ if((fp = popen(cmd,"r")) == NULL)
+ {
+ LYERRLOG("popen error!");
+ return -1;
+ }
+ if((fread(cmd_ret,sizeof(cmd_ret),1,fp))<0)
+ {
+ LYERRLOG("fread fail!");
+ fclose(fp);
+ return -1;
+ }
+ fclose(fp);
+
+ adc_value = atoi(cmd_ret);
+ if (adc_value < 0 || adc_value > 12000)
+ {
+ LYERRLOG("bad adc value %s!", cmd_ret);
+ return -1;
+ }
+
+ return adc_value;
+}
diff --git a/common_src/lib/liblynq-qser-adc/makefile b/common_src/lib/liblynq-qser-adc/makefile
new file mode 100755
index 0000000..0ef16a1
--- /dev/null
+++ b/common_src/lib/liblynq-qser-adc/makefile
@@ -0,0 +1,70 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -DRIL_SHLIB \
+ -DATCI_PARSE \
+ -fPIC \
+ -DKEEP_ALIVE \
+ -DECALL_SUPPORT \
+ -fpermissive \
+
+
+
+$(warning ################# lynq data demo ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/libcall \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+ -I$(ROOT)$(includedir)/vendor-ril \
+ -I$(ROOT)$(includedir)/lynq_shm \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llog \
+ -lcutils \
+ -lutils \
+ -lbinder \
+ -lpthread \
+ -llynq-log \
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-qser-adc.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete