From 17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Fri, 20 Nov 2020 23:36:23 +0900 Subject: Re-organized sub-directory by category Since all the sub-directories were placed in the first level, created sub-directories, "hal", "module", and "service" for classification and relocated each component. Signed-off-by: Tadao Tanikawa Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c --- vehicleservice/positioning_base_library/LICENSE | 177 -- .../positioning_base_library/Makefile.client | 20 - .../positioning_base_library/library/Makefile | 87 - .../library/include/DEV_TimerEntryDrv_if.h | 76 - .../library/include/TimerEntryDrv_If.h | 111 -- .../library/include/WPF_STD_private.h | 295 ---- .../library/include/_pbCommon.h | 36 - .../library/include/_pbEvent_Internal.h | 128 -- .../library/include/_pbInternalProc.h | 41 - .../library/include/_pbSerial.h | 32 - .../library/include/_pbWaitforsingleobject.h | 40 - .../library/include/sysup.h | 24 - .../library/include/sysup_addr.h | 227 --- .../library/include/tchar.h | 256 --- .../library/include/vehicle_service/WPF_STD.h | 1653 ------------------- .../include/vehicle_service/pos_message_header.h | 77 - .../vehicle_service/positioning_base_library.h | 46 - .../positioning_positioningbaselibrarylog.h | 91 -- .../library/include/vehicle_service/std_types.h | 55 - .../library/include/vehicle_service/sys_timerapi.h | 359 ----- .../library/libPOS_base_API.ver | 39 - .../library/src/MsgBapi.cpp | 347 ---- .../library/src/_CWORD64_api.cpp | 254 --- .../library/src/_pbCSection.cpp | 131 -- .../library/src/_pbCommon.cpp | 928 ----------- .../library/src/_pbDram.cpp | 284 ---- .../library/src/_pbEvent.cpp | 1695 -------------------- .../library/src/_pbFsys.cpp | 171 -- .../library/src/_pbMem.cpp | 989 ------------ .../library/src/_pbMisc.cpp | 226 --- .../library/src/_pbMsg.cpp | 1572 ------------------ .../library/src/_pbMutex.cpp | 1423 ---------------- .../library/src/_pbOSCtrl.cpp | 541 ------- .../library/src/_pbOther.cpp | 799 --------- .../library/src/_pbProcMng.cpp | 207 --- .../library/src/_pbSem.cpp | 780 --------- .../library/src/_pbSerial.cpp | 525 ------ .../library/src/_pbSram.cpp | 316 ---- .../library/src/_pbSum.cpp | 95 -- .../library/src/_pbTimer.cpp | 1115 ------------- .../library/src/_pbWaitforsingleobject.cpp | 358 ----- .../library/src/memcpy_64p_sync.cpp | 25 - .../library/src/memset_64p_sync.cpp | 25 - 43 files changed, 16676 deletions(-) delete mode 100755 vehicleservice/positioning_base_library/LICENSE delete mode 100755 vehicleservice/positioning_base_library/Makefile.client delete mode 100755 vehicleservice/positioning_base_library/library/Makefile delete mode 100755 vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h delete mode 100755 vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h delete mode 100755 vehicleservice/positioning_base_library/library/include/WPF_STD_private.h delete mode 100755 vehicleservice/positioning_base_library/library/include/_pbCommon.h delete mode 100755 vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h delete mode 100755 vehicleservice/positioning_base_library/library/include/_pbInternalProc.h delete mode 100755 vehicleservice/positioning_base_library/library/include/_pbSerial.h delete mode 100755 vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h delete mode 100755 vehicleservice/positioning_base_library/library/include/sysup.h delete mode 100755 vehicleservice/positioning_base_library/library/include/sysup_addr.h delete mode 100755 vehicleservice/positioning_base_library/library/include/tchar.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h delete mode 100755 vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h delete mode 100755 vehicleservice/positioning_base_library/library/libPOS_base_API.ver delete mode 100755 vehicleservice/positioning_base_library/library/src/MsgBapi.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbCSection.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbCommon.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbDram.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbEvent.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbFsys.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbMem.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbMisc.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbMsg.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbMutex.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbOther.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbSem.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbSerial.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbSram.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbSum.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbTimer.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp delete mode 100755 vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp (limited to 'vehicleservice/positioning_base_library') diff --git a/vehicleservice/positioning_base_library/LICENSE b/vehicleservice/positioning_base_library/LICENSE deleted file mode 100755 index f433b1a..0000000 --- a/vehicleservice/positioning_base_library/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/vehicleservice/positioning_base_library/Makefile.client b/vehicleservice/positioning_base_library/Makefile.client deleted file mode 100755 index c3aaab5..0000000 --- a/vehicleservice/positioning_base_library/Makefile.client +++ /dev/null @@ -1,20 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -######### subdirectories ######### -SUBDIRS += library - -include ../vehicle_service.mk diff --git a/vehicleservice/positioning_base_library/library/Makefile b/vehicleservice/positioning_base_library/library/Makefile deleted file mode 100755 index c0aec5b..0000000 --- a/vehicleservice/positioning_base_library/library/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -######### installed shared library(*.so) ############# -INST_SHLIBS = libPOS_base_API - -######### install headers(*.h) ############# -VPATH += ./include/$(COMPONENT_NAME) -INST_HEADERS += std_types.h -INST_HEADERS += sys_timerapi.h -INST_HEADERS += WPF_STD.h -INST_HEADERS += pos_message_header.h -INST_HEADERS += positioning_base_library.h -INST_HEADERS += positioning_positioningbaselibrarylog.h - -######### compiled sources ############# -VPATH += src -libPOS_base_API_SRCS += _pbTimer.cpp -libPOS_base_API_SRCS += _pbCSection.cpp -libPOS_base_API_SRCS += _pbMutex.cpp -libPOS_base_API_SRCS += _pbSem.cpp -libPOS_base_API_SRCS += _pbDram.cpp -libPOS_base_API_SRCS += _pbFsys.cpp -libPOS_base_API_SRCS += _pbMem.cpp -libPOS_base_API_SRCS += _pbSram.cpp -libPOS_base_API_SRCS += _pbOSCtrl.cpp -libPOS_base_API_SRCS += _pbSerial.cpp -libPOS_base_API_SRCS += _pbWaitforsingleobject.cpp -libPOS_base_API_SRCS += _pbOther.cpp -libPOS_base_API_SRCS += _pbProcMng.cpp -libPOS_base_API_SRCS += _pbCommon.cpp -libPOS_base_API_SRCS += _CWORD64_api.cpp -libPOS_base_API_SRCS += _pbMisc.cpp -libPOS_base_API_SRCS += _pbEvent.cpp -libPOS_base_API_SRCS += _pbMsg.cpp -libPOS_base_API_SRCS += _pbSum.cpp -libPOS_base_API_SRCS += MsgBapi.cpp -libPOS_base_API_SRCS += memcpy_64p_sync.cpp -libPOS_base_API_SRCS += memset_64p_sync.cpp - -######### add include path ############# -CPPFLAGS += -I./include -CPPFLAGS += -I./ - -######### add compile option ############# -CPPFLAGS += -DLINUX -fPIC -CPPFLAGS += -D_CWORD64_API_DOES_NOT_USE_UNICODE - -LDFLAGS += -Wl,--no-undefined -LDFLAGS += -Wl,--no-as-needed -CPPFLAGS += -Werror=implicit-function-declaration -CPPFLAGS += -Werror=format-security -CPPFLAGS += -Wconversion -CPPFLAGS += -Wint-to-pointer-cast -CPPFLAGS += -Wpointer-arith -CPPFLAGS += -Wformat - -######### linked library (dynamic) ############# -LDLIBS += -Wl,-Bdynamic -lvp -LDLIBS += -Wl,-Bdynamic -lrt -LDLIBS += -Wl,-Bdynamic -lcommon -LDLIBS += -Wl,-Bdynamic -lstdc++ -LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified -LDLIBS += -Wl,-Bdynamic -lev - -######### add library path ############# -LDFLAGS += -shared - -INSTALL = install -CREATE_DIR = $(DESTDIR)/nv/BS/vs/positioning_base_library/rwdata -install-data: - $(INSTALL) -d -m 775 $(CREATE_DIR) - -include ../../vehicle_service.mk diff --git a/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h b/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h deleted file mode 100755 index 141c8d8..0000000 --- a/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** - * File name : DEV_TimerEntryDrv_if.h - * System name : Integrated PF - * Subsystem name : Timer registry drivers - * Title : APIs for Timer registry drivers - ****************************************************************************/ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_ - -#include - -/*----------------------------------------------------------------------------- - * Constant definition - *----------------------------------------------------------------------------*/ -/* Return value */ -#define DEV_TED_INVALID (u_int32)0 /* Timer start failure */ -#define DEV_TED_STOP_NG (u_int32)0 /* Timer stop failure */ -#define DEV_TED_STOP_OK (u_int32)1 /* Timer stop success */ - -/* Definitions for event Handle names */ -#define DEV_TED_EVTNAME_MAX (u_int32)32 /* _CWORD64_ Events HANDLE Name */ - -/*----------------------------------------------------------------------------- - * Structure Definition - *----------------------------------------------------------------------------*/ -/* Structures for timer setting instructions (_CWORD64_ messages) */ -typedef struct { - int32 set_time; /* Count time */ - PNO pno; /* _CWORD64_ Messages Destination PNOs */ - u_int32 ext_data; /* Extended Info for _CWORD64_ Messages */ -} stTED_SetTime__CWORD64_msg; - -/* Structures for timer setting directives (Windows events) */ -typedef struct { - int32 set_time; /* Count time */ - char evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */ - int32 ext_data; /* _CWORD64_ Events Extended Info */ -} stTED_SetTime__CWORD64_evt; - -/* Structures for sending _CWORD64_ messages */ -typedef struct { - T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */ - u_int32 timer_id; /* Timer IDs for _CWORD64_ messages */ - u_int32 us_data; /* Extended Info for _CWORD64_ Messages */ -} stTimer_CWORD64_msg; - -/* Structures for timer setting directives (Windows events) */ -typedef struct { - int32 set_time; /* Count time */ - wchar_t evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */ -} stTED_SetTime_winevt; -/* - API Function Prototype -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -u_int32 DEVSetTimer_CWORD64_msg(stTED_SetTime__CWORD64_msg *p_set_data); -u_int32 DEVSetTimer_CWORD64_event(stTED_SetTime__CWORD64_evt *p_set_data); -u_int32 DEVStopTimer(u_int32 time_id); - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_ - diff --git a/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h b/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h deleted file mode 100755 index d20d6f0..0000000 --- a/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * File name : TimerDrv_If.h - * System name : Integrated PF - * Process name : Timer registry driversI/F - * Overview : Timer registry drivers I/F Header file - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_ - -#include -#include "DEV_TimerEntryDrv_if.h" - -/* - Constant definition -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#define TED_DRV_NAME "TED" /* Channel names of drivers registered in the Timer */ -/* The channel name cannot be a leading slash. Location is under /dev/name/local */ - -/*----------------------------------------------------------------------------- - * CTRL CODE definitions - *----------------------------------------------------------------------------*/ -/* IOCTRL internal-processing sort codes */ -#define TED_IOCTRL_TIMREQ __DIOTF(_DCMD_MISC, 1, stTedApidt) /* Timer start */ -#define TED_IOCTRL_STPREQ __DIOT(_DCMD_MISC, 2, stTedApidt) /* Timer stop */ - -#define TED_IF_SETTIME_MIN (int32)1 /* Minimum count time(1ms) */ - -#define TED_IF_SETPNO_NG (PNO)0 /* PNO invalid value for _CWORD64_ messages */ -#define TED_IF_MMEVENT_INVALID_ID 0 /* Invalid _CWORD64_ EventID */ - -#define TED_IF_RET__CWORD64_MSG (u_int16)1 /* How Users Are Notified on Timeouts: _CWORD64_ Messages */ -#define TED_IF_RET_WINEVT (u_int16)2 /* How Users Are Notified on Timeouts: Windows Events */ - -/* Timer type */ -#define TED_IF_TIMERTYPE_CYCLE 1 /* Fixed period Timer Specified in [10ms] */ -#define TED_IF_TIMERTYPE_SINGLE 2 /* Single occurrence Timer Specified in [10ms] */ - -/* API type(Distinguishing between API Functions Used at Timer Startup) */ -#define TED_IF_APITYPE_SYS 1 /* Timer start by _pb_ReqTimerStart() */ -#define TED_IF_APITYPE_DEV 2 /* Timer start by DEV_SetTimer_XXX() */ - -/* - Data type definition -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Timer registration data by user(Timer register driver IF -> timer register driver) */ -typedef struct { - int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */ - u_int32 timer_id; /* User's timer ID */ - u_int32 ret_data; /* User's extended information */ - PNO ret_pno; /* User's _CWORD64_ message-destination process number */ - u_int16 fin_mode; /* User Timeout Notification Method */ - char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */ - u_int32 timer_seq; /* Timer Sequence Number */ - u_int8 time_type; /* Timer type(Fixed period/single occurrence) */ - u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */ - u_int8 reserve[2]; -} stTedApidt; -typedef stTedApidt *PTED_IFDT; - -/* Timer Start/Stop Messages Structures, */ -typedef struct { - int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */ - u_int32 timer_id; /* User's timer ID */ - u_int32 ret_data; /* User's extended information */ - PNO ret_pno; /* User's _CWORD64_ message-destination process number */ - u_int16 fin_mode; /* User Timeout Notification Method */ - char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */ - u_int32 timer_seq; /* Timer Sequence Number */ - u_int8 time_type; /* Timer type(Fixed period/single occurrence) */ - u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */ - u_int8 reserve[2]; -} TIMERUSERDATA; - -/* Structures for sending _CWORD64_ message timer START */ -typedef struct { - T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */ - /* Extended Info for _CWORD64_ Messages */ - TIMERUSERDATA st_us_data; -} stTimerStart_CWORD64_msg; - -/* Structures for sending _CWORD64_ message timer STOP */ -typedef struct { - T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */ - /* Extended Info for _CWORD64_ Messages */ - TIMERUSERDATA st_us_data; -} stTimerStop_CWORD64_msg; - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_ -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : TimerEntryDrv_If.h -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - diff --git a/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h b/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h deleted file mode 100755 index 87f57cd..0000000 --- a/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file WPF_STD_private.h - * @brief Header file for system standard definitions - */ - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_ - -/*---------------------------------------------------------------------------------* - * Incluce * - *---------------------------------------------------------------------------------*/ -#include - -/* _CWORD64_ non-OS managed areas */ -#define SDRAM__CWORD64__NOTOS_AREA 0x00000000 -#define SDRAM__CWORD64__NOTOS_AREA_SIZE 0x0 - -#define BLVER_SIZE 0x00000008 /* BootLoader version information area size */ -#define FROM_FIX_VER_SIZE BLVER_SIZE /* Mask(BootLoder)Version size */ - -/* Start address of the _CWORD64_ non-OS management area */ -#define TOP_ADDR_NOTOS SDRAM__CWORD64__NOTOS_AREA -/* Size of the non-OS management area */ -#define NOTOS_SISE SDRAM__CWORD64__NOTOS_AREA_SIZE - -/* Reserved(32KB)Unavailable */ -#define SRAMDRAM_RESERVE2_SIZE 0x00008000 - -#define WINAPI - -#define STATUS_WAIT_0 ((DWORD)0x00000000L) -#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L) -#define STATUS_TIMEOUT ((DWORD)0x00000102L) -#define WAIT_TIMEOUT STATUS_TIMEOUT -#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) -#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0) -#define WAIT_FAILED ((DWORD)0xFFFFFFFF) - -#define SHARED_MEMORY_DIRECTORY ("/tmp/shm/navigation/") - -#define _pb_strcmp(pleft, pright)((strcmp(pleft, pright) == 0) ?(0) :(-1)) - -/* For heap allocation method control */ -#define HEAP_ZERO_MEMORY (0x00000008) - -#define EV_RXCHAR 0x0001 -#define EV_ERROR 0x0080 - -#define EV_DSR 0x0010 - -/* Systems API External Public Functions Prototype Definitions */ -#define VUP_DISC_PATHNAME _T("/Z01") /* VUP DISC paths */ -#define VUP_USB_PATHNAME _T("/U") /* VUP USB paths */ -#define VUP_PATHNAME_SYSTEM _T("/agl/system") /* Storage path name */ -#define VUP_FNAME_TOP _T("/NA_D0_") /* VUPFile name(front) */ -#define VUP_FNAME_BTM _T(".bin") /* VUPFile name(rear) */ -#define VUP_FNAME_FORCEVUP _T("/forcevup.dat") /* Forced VUP file name */ - -#define FROM_VARI_VER_SIZE 8 -#define WRITE_FLAG_ON 0x01 /* Write permission status for the file */ -#define FSNOACCESS 0x00 /* File system access disabled state */ -#define VUP_GETNAME_MEDIA_DISC 0x01 /* VUP media:disc */ - -/* Function Code(Normal completion) */ -#define RET_RCVMSG 1 /* Receive only message */ -#define RET_RCVSIG 2 /* Receive only signal */ -#define RET_RCVBOTH 3 /* Receive both messages and signals */ -#define RET_NOMSG 4 /* No received message */ -/* User-side signal handling return values */ -#define RET_QUE 5 /* Queue a signal */ -#define RET_NOTQUE 6 /* Do not queue signals */ -#define RET_PROCDOWN 7 /* Detect DOWN of children */ -#define RET_SLEEP 100 - -/* Error code system */ -#define RET_OSERROR (-127) /* OS System call error */ -/* Actual error in _sys_GetOSErrorCode() */ -/* Code can be retrieved */ -#define RET_ERRNOTRDY (-3) /* Specified port ID and semaphore ID are not created.*/ -#define RET_ERRPROC (-4) /* Error in API processing */ -#define RET_ERRTIMEOUT (-5) /* Timeout with Processing Not Complete */ -/* (D type API only) */ -#define RET_ERRMSGFULL (-6) /* Message table full */ -#define RET_ERROVERFLW (-7) /* Receive message is larger than the receive buffer size */ -#define RET_ERRINIT (-8) -#define RET_ERRREGQUE (-9) - -#define RET_EV_NONE (-20) /* No specified event */ -#define RET_EV_MAX (-21) /* Event value exceeds the specified maximum value */ -#define RET_EV_MIN (-22) /* The event value is less than the specified minimum value. */ - -#define SAPI_EVSET_RELATE 2 - - -/*---------------------------------------------------------------------------------* - * Typedef declaration * - *---------------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------------* - * Struct declaration * - *---------------------------------------------------------------------------------*/ -typedef struct FileTime { - DWORD dw_low_date_time; - DWORD dw_high_date_time; -} FILETIME; -typedef FILETIME *PFILETIME; -typedef FILETIME *LPFILETIME; - -typedef struct Overlapped { - ULONG_PTR internal; - ULONG_PTR internal_high; - union { - struct { - DWORD offset; - DWORD offset_high; - }; - - PVOID pointer; - }; - - HANDLE h_event; -} OVERLAPPED; -typedef OVERLAPPED *LPOVERLAPPED; - -typedef struct ComStat { - DWORD f_cts_hold : 1; - DWORD f_dsr_hold : 1; - DWORD f_rlsd_hold : 1; - DWORD f_x_off_hold : 1; - DWORD f_x_off_sent : 1; - DWORD f_eof : 1; - DWORD f_txim : 1; - DWORD f_reserved : 25; - DWORD cb_in_que; - DWORD cb_out_que; -} COMSTAT; -typedef COMSTAT *LPCOMSTAT; - -typedef struct Dcb { - DWORD dcb_length; /* sizeof(DCB) */ - DWORD baud_rate; /* Baudrate at which running */ - DWORD f_binary: 1; /* Binary Mode (skip EOF check) */ - DWORD f_parity: 1; /* Enable parity checking */ - DWORD f_out_x_cts_flow: 1; /* CTS handshaking on output */ - DWORD f_out_x_dsr_flow: 1; /* DSR handshaking on output */ - DWORD f_dtr_control: 2; /* DTR Flow control */ - DWORD f_dsr_sensitivity: 1; /* DSR Sensitivity */ - DWORD f_tx_continue_on_x_off: 1; /* Continue TX when Xoff sent */ - DWORD f_out_x: 1; /* Enable output X-ON/X-OFF */ - DWORD f_in_x: 1; /* Enable input X-ON/X-OFF */ - DWORD f_error_char: 1; /* Enable Err Replacement */ - DWORD f_null: 1; /* Enable Null stripping */ - DWORD f_rts_control: 2; /* Rts Flow control */ - DWORD f_abort_on_error: 1; /* Abort all reads and writes on Error */ - DWORD f_dummy2: 17; /* Reserved */ - WORD w_reserved; /* Not currently used */ - WORD x_on_lim; /* Transmit X-ON threshold */ - WORD x_off_lim; /* Transmit X-OFF threshold */ - BYTE byte_size; /* Number of bits/byte, 4-8 */ - BYTE parity; /* 0-4=None,Odd,Even,Mark,Space */ - BYTE stop_bits; /* 0,1,2 = 1, 1.5, 2 */ - char x_on_char; /* Tx and Rx X-ON character */ - char x_off_char; /* Tx and Rx X-OFF character */ - char error_char; /* Error replacement char */ - char eof_char; /* End of Input character */ - char evt_char; /* Received Event character */ - WORD w_reserved1; /* Fill for now. */ -} DCB; -typedef DCB *LPDCB; - -typedef struct CommTimeouts { - DWORD read_interval_timeout; /* Maximum time between read chars. */ - DWORD read_total_timeout_multiplier; /* Multiplier of characters. */ - DWORD read_total_timeout_constant; /* Constant in milliseconds. */ - DWORD write_total_timeout_multiplier; /* Multiplier of characters. */ - DWORD write_total_timeout_constant; /* Constant in milliseconds. */ -} COMMTIMEOUTS; -typedef COMMTIMEOUTS *LPCOMMTIMEOUTS; - -typedef struct { - DWORD size; /* Allocated shared memory size */ - DWORD phy_addr; /* Physical address */ - HANDLE h_map; /* +8: Handle of file mapping object. */ - void* p_memory; /* Shared Memory Mapped Address */ - DWORD owner; /* +16: Owner flag. */ - HANDLE h_heap; /* +20: Handle of heap for oneself. */ -} SHARED_MEMORY; - -typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)( - LPVOID lpThreadParameter -); -typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; - -/* Program version storage */ -typedef struct { - u_int8 mask_ver[ FROM_FIX_VER_SIZE ]; /* BootLoader programming versions */ - u_int8 flash_ver1[ FROM_VARI_VER_SIZE ]; /* NK1 programming versions */ - u_int8 flash_ver2[ FROM_VARI_VER_SIZE ]; /* NK2 programming versions */ - u_int8 flash_ver3[ FROM_VARI_VER_SIZE ]; /* NK3 programming versions */ -} T_SYS_PRGVER; - -/* Device information storage */ -typedef struct { - u_int8 _CWORD31__no[ _CWORD31__NO_SIZE ]; /* _CWORD31_ product number */ - u_int8 reserve1[ RESERVE1_SIZE ]; /* RESERVE1 */ - u_int8 helpnet_id[ HELPNET_ID_SIZE ]; /* HELPNET ID */ - u_int8 reserve2[ RESERVE2_SIZE ]; /* RESERVE2 */ - u_int8 date[ DATE_SIZE ]; /* Manufacturing date and time */ -} T_SYS_DEVINFO; - -/* Structure for storing display information */ -typedef struct { - int i_width_size; /* Width */ - int i_height_size; /* Height */ -} DISPLAY_INFO; - -/* System error notification message structure */ -typedef struct { - T_APIMSG_MSGBUF_HEADER bhead; /* Message buffer header */ - PNO pno; /* Process No. */ - u_int8 dummy[2]; /* Dummy */ - int32 errcode; /* Error code */ -} T_SYS_SYSTEMERROR; - - -/*---------------------------------------------------------------------------------* - * Prototype Declaration * - *---------------------------------------------------------------------------------*/ -/* Configuration Functions (_pbCommon.cpp) */ -void PbReset(void); /* Soft reset process */ - -/* Message Sending/Receiving Functions (_pbMsg.cpp) */ -RET_API PbDeleteMsg(PNO pno); - -/* SRAM Control Functions (_pbSram.cpp) */ -RET_API PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size); -RET_API PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size); -RET_API PbSramSz32(u_int8 id, u_int32 *psize); - -/* DRAM Control Functions (_pbDram.cpp) */ -RET_API PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size); - -/* Semaphore(_pbSem.cpp) */ -RET_API PbDeleteSemaphore(SemID sem_id); -DWORD PbDeleteMutex(HANDLE h_mutex); -DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout); -BOOL PbMutexUnlock(HANDLE h_mutex); - -/* Shared Memory Access Functions(_pbMem.cpp) */ -RET_API PbDeleteShareData(char* area_name); -/* Accessing Physical Memory Area Allocation Data */ -RET_API PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode); -/* Releases access to the physical memory area allocation data. */ -RET_API PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size); - -LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes); /* Allocating Memory from the Process Heap */ -BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem); /* Free Memory Allocated from Process Heap */ - -/* Functions Related to Analysis Support Functions(_pbOther.cpp) */ -uint32_t PbGetTid(void); -uint32_t PbGetLocalTid(void); - -/* Other Functions(_pbMisc.cpp) */ -RET_API PbMilliSecSleep(u_int32 ul_mill_time); /* Sleeping of the calling process */ - -/* TODO As defined in _pbCSection--> */ -VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section); -VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section); -VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section); -VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section); - -BOOL PbSystemTimeToFileTime(CONST SYSTEMTIME *lp_system_time, LPFILETIME lp_file_time); - - -/* Memory copy Bus release support */ -void* Memset64pSync(void* dest, int c, size_t count); - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_ - diff --git a/vehicleservice/positioning_base_library/library/include/_pbCommon.h b/vehicleservice/positioning_base_library/library/include/_pbCommon.h deleted file mode 100755 index 8cd1591..0000000 --- a/vehicleservice/positioning_base_library/library/include/_pbCommon.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** - * File name : _sysCommon.h - * System name : System API - * Subsystem name : Common system - * Title : Internal header for system API infrastructure management - ****************************************************************************/ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_ - -#define PBCOM_CONFIGFILE "config" /* Configuration file */ -#define PBCOM_CONFIGSIZE_MAX (1024) /* Configuration file maximum size */ -#define PBCOM_API_NORMAL (0) /* API processing result normal */ -#define PBCOM_API_ERROR (-1) /* API processing result error */ -#define PBCOM_UNICODE_NUL (0x00) /* NULL character codes */ -#define PBCOM_UNICODE_LF (0x0A) /* Line feed character code */ -#define PBCOM_UTOIMAX_NUM (8) /* Maximum font size */ -#define PBCOM_CONFIG_INDEX_SCRWIDTH "[ScreenWidth]" /* Data information "Screen width" */ -#define PBCOM_CONFIG_INDEX_SCRHEIGHT "[ScreenHeight]" /* Data information "Screen Height" */ - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_ diff --git a/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h b/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h deleted file mode 100755 index d0b6d44..0000000 --- a/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/******************************************************************************* -* $Header:: $ -* $Revision:: $ -*******************************************************************************/ - -/**************************************************************************** - * File name : _pbEvent_Internal.h - * System name : GPF - * Subsystem name : _CWORD64_API Events Feature - * Title : Internal definition file for event function - ****************************************************************************/ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_ - -#include - -/* - Constant definition -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define MAX_PB_EVENTS 16 -#define MAX_EVENT_NAME_LEN 32 -#define MIN_EVENT_VAL 0x80000000 /* Minimum event value(-2147483648) */ -#define MAX_EVENT_VAL 0x7FFFFFFF /* Maximum event value( 2147483647) */ -#define EVENT_BIT_ZERO 0x00000000 /* Event value All Bit Zero Definition */ -#define MAX_PB_EVENT_WAIT_THREADS 1 /* Values other than 1 are not designed while the EV library is being used. */ -#define EVSET_ABSOLUTE 1 /* Absolute setting */ -#define EVSET_RELATE 2 /* Relative value setting */ -#define EVSET_AND 3 /* AND value setting */ -#define EVSET_OR 4 /* OR setting */ -#define EVWAIT_VAL 1 /* Waiting mode for an event by specifying a range */ -#define EVWAIT_ALLCLR 2 /* Mode to wait for an event when the specified bit is cleared */ -#define EVWAIT_ANYSET 3 /* Mode to wait for an event with a specified set of bits */ - -#define _CWORD64_EVENT_MAXOPEN_IN_PROCESS 0x7FFFFFFF /* Maximum number of open events in the same process */ -#define _CWORD64_EVENT_MAXOPEN_IN_SYSTEM 0x7FFFFFFF /* Maximum number of the same event open in the system */ - -#define MAX_EVENT_PROC_NUM (32) /* EVENT Max Processes Used */ - -/* - Structure Definition -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/***************************************************************************** - * TAG : WAITING_CONDITION - * ABSTRACT : Event Status Settings -******************************************************************************/ -typedef struct { - u_int8 uc_use_flag; /* Table Usage Flags(TRUE:Use FALSE:Not used) */ - u_int8 uc_waiting; /* Event Waiting Flag */ - /* TRUE Waiting for event */ - /* FALSE Release Event Wait */ - u_int16 us_mode; /* Waiting mode */ - /* EVWAIT_VAL Wait for Value Range */ - /* EVWAIT_ALLCLR Wait for specified bit to be cleared */ - /* EVWAIT_ANYSET Waiting for setting the specified bit */ - u_int32 ul_mask; /* Mask value when waiting for specified bit */ - int32 l_min_val; /* Minimum value of condition when waiting for value range */ - int32 l_max_val; /* Maximum value of condition when waiting for value range */ - int32 l_last_val; /* Events at WaitEvent Return */ - EV_ID flag_id[MAX_EVENT_PROC_NUM]; /* Event flags(CLS event library) */ -} WAITING_CONDITION; /* Total 28 Bytes. */ - -/***************************************************************************** - * TAG : WAITING_CONDITION - * ABSTRACT : Event information storage area -******************************************************************************/ -typedef struct { - TCHAR event_name[MAX_EVENT_NAME_LEN]; /* Maximum number of characters + NULL area */ - int32 l_event_val; - WAITING_CONDITION st_condition[MAX_PB_EVENT_WAIT_THREADS]; - int32 l_process_ref; - int32 l_reset_data; - u_int8 uc_manual_reset; - u_int8 uc_reserve[3]; - char name_of_mutex[NAME_MAX]; - /* TODO: Members for the following EV library use:Structurely strange, but borrowed shared space.Correction is required. */ - u_int8 proc_cnt; -} PB_EVENT; - -/***************************************************************************** - * TAG : PB_EVENT_OPEN_HANDLE - * ABSTRACT : Generated event management information -******************************************************************************/ -typedef struct { - HANDLE h_heap; - PB_EVENT* p_sys_event; - DWORD index; - int32 l_thread_ref; -} PB_EVENT_OPEN_HANDLE; - -/***************************************************************************** - * TAG : PB_EVENT_INSTANCE - * ABSTRACT : Event management table -******************************************************************************/ -typedef struct { - PB_EVENT_OPEN_HANDLE* p_handle_table[MAX_PB_EVENTS]; - HANDLE h_shared_memory; - SemID id_event_table_sem; - PB_EVENT* p_event_table; -} PB_EVENT_INSTANCE; - -/* - Prototype declaration -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_ diff --git a/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h b/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h deleted file mode 100755 index 03bcd03..0000000 --- a/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_ - -#define POSITIONINGBASELIBRARY_NON_FD (-1) //!< \~english invalid fd -#define POSITIONINGBASELIBRARY_MAP_NON_INIT (0) //!< \~english init flag for mmap - -#ifdef __cplusplus -extern "C" { -#endif - - int32 InitMutexObject(pthread_mutex_t *p_st_mutex); - - HANDLE CreateSharedMemory(TCHAR* name, DWORD size); - HANDLE OpenSharedMemory(TCHAR* name, DWORD size); - void DeleteAllSharedMemory(void); - void* GetSharedMemoryPtr(HANDLE h_shm); - void CloseSharedMemory(HANDLE h_shm); - void DeleteSharedMemory(TCHAR* name); - HANDLE OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect); - -#ifdef __cplusplus -} -#endif - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_ diff --git a/vehicleservice/positioning_base_library/library/include/_pbSerial.h b/vehicleservice/positioning_base_library/library/include/_pbSerial.h deleted file mode 100755 index 1bedfe8..0000000 --- a/vehicleservice/positioning_base_library/library/include/_pbSerial.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_ - -#include - -/* Prototype */ -BOOL SerialTableInit(void); /* Initialization process for each process */ -BOOL SerialTableTerm(void); /* Termination process for each process */ -BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout); /* Timeout registration process */ -BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD*, DWORD*); /* Timeout acquisition processing */ -BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask); /* Mask registration process */ -BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD*); /* Mask acquisition processing */ -BOOL SerialObjectDel(HANDLE h_obj); /* Deletion process */ - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_ diff --git a/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h b/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h deleted file mode 100755 index e4f8eb1..0000000 --- a/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_ - -#include - -typedef enum { - PB_HANDLE_INVAL = 0, - PB_HANDLE_MUTEX, - PB_HANDLE_PROC_SEMAPHORE, - PB_HANDLE_EVENT, - PB_HANDLE_THREAD, - PB_HANDLE_PROCESS, - - PB_HANDLE_KIND_MAX /* Maximum value range check */ -} HANDLE_KIND; - -/* Prototype */ -BOOL WaitObjectInit(void); /* Initialization process for each process */ -BOOL WaitObjectTerm(void); /* Termination process for each process */ -BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind); /* Registration process */ -BOOL WaitObjectDel(HANDLE h_obj); /* Deletion process */ - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_ diff --git a/vehicleservice/positioning_base_library/library/include/sysup.h b/vehicleservice/positioning_base_library/library/include/sysup.h deleted file mode 100755 index eafca8e..0000000 --- a/vehicleservice/positioning_base_library/library/include/sysup.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_ - -#define SYS_RESET (int32)1 /* Make reset */ -#define SYS_ONLY_RESET (int)2 /* Reset only */ - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_ - diff --git a/vehicleservice/positioning_base_library/library/include/sysup_addr.h b/vehicleservice/positioning_base_library/library/include/sysup_addr.h deleted file mode 100755 index 9e73bf0..0000000 --- a/vehicleservice/positioning_base_library/library/include/sysup_addr.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/************************************************************************ -* File name : sysup_addr.h -* System name : Integrated PF -* Subsystem name : Common system -* Title : Boot-Related Address Definition Header Files -************************************************************************/ - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_ - -/***************************************************** - * - * Initial management area address space definition - * A: Address, S: Size - ****************************************************/ -/* Note : Don't forget to change sysup_addr.inc at the same time! */ - -/* SDRAM startup identification table (1) A Offset from the beginning 0x0 */ -#define ADDR_SYSUP_DRAM1 ((SDRAM_INITIAL_AREA & ADDR_MASK) | ADDR_P2) // NOLINT(runtime/references) -/* SDRAM startup identification table (1) S */ -#define SIZE_SYSUP_DRAM1 0x00000004 - -/* SDRAM Start Identification Table A Offset from the beginning 0x4 */ -#define ADDR_SYSUP_DRAM_FIX (ADDR_SYSUP_DRAM1 + SIZE_SYSUP_DRAM1) -/* SDRAM Start Identification Table S */ -#define SIZE_SYSUP_DRAM_FIX 0x00000004 - -/* Startup Status Table A Offset from the beginning 0x8 */ -#define ADDR_SYSUP_STS (ADDR_SYSUP_DRAM_FIX + SIZE_SYSUP_DRAM_FIX) -/* Startup Status Table S */ -#define SIZE_SYSUP_STS 0x00000002 - -#define ADDR_SYS_DUMMY1 (ADDR_SYSUP_STS + SIZE_SYSUP_STS) /* Dummy1 A Offset from the beginning 0xa */ -#define SIZE_SYS_DUMMY1 0x00000002 /* Dummy1 S */ - -#define ADDR_UPMODE (ADDR_SYS_DUMMY1 + SIZE_SYS_DUMMY1) /* Boot Mode Save Table A Offset from the beginning 0xc */ -#define SIZE_UPMODE 0x00000004 /* Boot Mode Save Table S */ - -#define ADDR_SYSUP_STS_GINI (ADDR_UPMODE + SIZE_UPMODE) /* System startup status table A Offset from the beginning 0x10 */ -#define SIZE_SYSUP_STS_GINI 0x00000002 /* System startup status table S */ - -/* Fork Failures Recording Table A Offset from the beginning 0x12 */ -#define ADDR_SYSUP_RST_CNT (ADDR_SYSUP_STS_GINI + SIZE_SYSUP_STS_GINI) -/* Fork Failures Recording Table S */ -#define SIZE_SYSUP_RST_CNT 0x00000002 - -/* System anomaly process No. table A Offset from the beginning 0x14 */ -#define ADDR_SYS_ERR_PNO (ADDR_SYSUP_RST_CNT + SIZE_SYSUP_RST_CNT) -/* System anomaly process No. table S */ -#define SIZE_SYS_ERR_PNO 0x00000004 - -/* System error reset cause table A Offset from the beginning 0x18 */ -#define ADDR_SYS_ERR_RST (ADDR_SYS_ERR_PNO + SIZE_SYS_ERR_PNO) -/* System error reset cause table S */ -#define SIZE_SYS_ERR_RST 0x00000004 - -/* System startup failure table A Offset from the beginning 0x1c */ -#define ADDR_SYSUP_ERR_STS (ADDR_SYS_ERR_RST + SIZE_SYS_ERR_RST) -/* System startup failure table S */ -#define SIZE_SYSUP_ERR_STS 0x00000004 - -/* Navigation activation state table A Offset from the beginning 0x20 */ -#define ADDR_NAVIUP_STS (ADDR_SYSUP_ERR_STS + SIZE_SYSUP_ERR_STS) -/* Navigation activation state table S */ -#define SIZE_NAVIUP_STS 0x00000002 - -/* Navigation fork Failed Count Recording Table A Offset from the beginning 0x22*/ -#define ADDR_NAVIUP_RST_CNT (ADDR_NAVIUP_STS + SIZE_NAVIUP_STS) -/* Navigation fork Failed Count Recording Table S */ -#define SIZE_NAVIUP_RST_CNT 0x00000002 - -/* Navigation error process No. table A Offset from the beginning 0x24 */ -#define ADDR_NAVI_ERR_PNO (ADDR_NAVIUP_RST_CNT + SIZE_NAVIUP_RST_CNT) -/* Navigation error process No. table S */ -#define SIZE_NAVI_ERR_PNO 0x00000004 - -/* Navigation Error Cause Table A Offset from the beginning 0x28 */ -#define ADDR_NAVI_ERR (ADDR_NAVI_ERR_PNO + SIZE_NAVI_ERR_PNO) -/* Navigation Error Cause Table S */ -#define SIZE_NAVI_ERR 0x00000004 - -#define ADDR_NAVIUP_ERR_STS (ADDR_NAVI_ERR + SIZE_NAVI_ERR) /* Navigation start failure table A Offset from the beginning 0x2c */ -#define SIZE_NAVIUP_ERR_STS 0x00000004 /* Navigation start failure table S */ - -/* SDRAM startup identification table (2) A Offset from the beginning 0x30 */ -#define ADDR_SYSUP_DRAM2 (ADDR_NAVIUP_ERR_STS + SIZE_NAVIUP_ERR_STS) -/* SDRAM startup identification table (2) S */ -#define SIZE_SYSUP_DRAM2 0x00000004 - -/* SDRAM Backup Status Table A Offset from the beginning 0x34 */ -#define ADDR_SYS_BUP_STS (ADDR_SYSUP_DRAM2 + SIZE_SYSUP_DRAM2) -/* SDRAM Backup Status Table S */ -#define SIZE_SYS_BUP_STS 0x00000004 - -/* NAVI-SYS communication error recording table A Offset from the beginning 0x38 */ -#define ADDR_SYSCOM_STS (ADDR_SYS_BUP_STS + SIZE_SYS_BUP_STS) -/* NAVI-SYS communication error recording table S */ -#define SIZE_SYSCOM_STS 0x00000004 - -/* SDRAM Power Supply Fault Detection Table A Offset from the beginning 0x3c */ -#define ADDR_SYS_PW_STS (ADDR_SYSCOM_STS + SIZE_SYSCOM_STS) -/* SDRAM Power Supply Fault Detection Table S */ -#define SIZE_SYS_PW_STS 0x00000004 - -/* Hard WDT generation table A Offset from the beginning 0x40 */ -#define ADDR_HWDT_STS (ADDR_SYS_PW_STS + SIZE_SYS_PW_STS) -/* Hard WDT generation table S */ -#define SIZE_HWDT_STS 0x00000004 - -/* SDRAM Labels Destruct Status Detection Table A Offset from the beginning 0x44 */ -#define ADDR_DRAMLABEL_STS (ADDR_HWDT_STS + SIZE_HWDT_STS) -/* SDRAM Labels Destruct Status Detection Table S */ -#define SIZE_DRAMLABEL_STS 0x00000004 - -#define ADDR_SSB_MNG (ADDR_DRAMLABEL_STS + SIZE_DRAMLABEL_STS) /* SSB management table A Offset from the beginning 0x48 */ -#define SIZE_SSB_MNG 0x00000004 /* SSB management table S */ - -#define ADDR_NMI_END (ADDR_SSB_MNG + SIZE_SSB_MNG) /* NMI completion flag A Offset from the beginning 0x4c */ -#define SIZE_NMI_END 0x00000004 /* NMI completion flag S */ - -/* Opening indication determination table A Offset from the beginning 0x50 */ -#define ADDR_OPDSP_CHK (ADDR_NMI_END + SIZE_NMI_END) -/* Opening indication determination table S */ -#define SIZE_OPDSP_CHK 0x00000004 - -#define ADDR_SYS_FROM_STS (ADDR_OPDSP_CHK + SIZE_OPDSP_CHK) /* FROM destruction status table A Offset from the beginning 0x54 */ -#define SIZE_SYS_FROM_STS 0x00000004 /* FROM destruction status table S */ - -/* BootLoader status A Offset from the beginning 0x58 */ -#define ADDR_BOOT_STS (ADDR_SYS_FROM_STS + SIZE_SYS_FROM_STS) -/* BootLoader status S */ -#define SIZE_BOOT_STS 0x00000004 - -/* BootLoader Exceptions Recording Table A Offset from the beginning 0x5c */ -#define ADDR_BOOTEXP_LOG (ADDR_BOOT_STS + SIZE_BOOT_STS) -/* BootLoader Exceptions Recording Table S */ -#define SIZE_BOOTEXP_LOG 0x00000004 - -/* SDRAM startup identification table (3) A Offset from the beginning0x60 */ -#define ADDR_SYSUP_DRAM3 (ADDR_BOOTEXP_LOG + SIZE_BOOTEXP_LOG) -/* SDRAM startup identification table (3) S */ -#define SIZE_SYSUP_DRAM3 0x00000004 - -/* Error Logging Table in BootLoader Drivers A Offset from the beginning 0x64 */ -#define ADDR_BOOTERR_LOG (ADDR_SYSUP_DRAM3 + SIZE_SYSUP_DRAM3) -/* Error Logging Table in BootLoader Drivers S */ -#define SIZE_BOOTERR_LOG 0x00000004 - -/* EPC register values at the time of exceptions in the BootLoader A Offset from the beginning 0x68 */ -#define ADDR_BOOT_EPC (ADDR_BOOTERR_LOG + SIZE_BOOTERR_LOG) -/* EPC register values at the time of exceptions in the BootLoader S */ -#define SIZE_BOOT_EPC 0x00000004 - -/* Status register when exceptions occur in the BootLoader A Offset from the beginning 0x6c */ -#define ADDR_BOOT_SR (ADDR_BOOT_EPC + SIZE_BOOT_EPC) -/* Status register when exceptions occur in the BootLoader S */ -#define SIZE_BOOT_SR 0x00000004 - -/* Cause Register Values When Internal BootLoader Exceptions Occur A Offset from the beginning 0x70 */ -#define ADDR_BOOT_CAUSE (ADDR_BOOT_SR + SIZE_BOOT_SR) -/* Cause Register Values When Internal BootLoader Exceptions Occur S */ -#define SIZE_BOOT_CAUSE 0x00000004 - -/* NMI completion flag(Copying) A Offset from the beginning 0x74 */ -#define ADDR_NMI_END_CPY (ADDR_BOOT_CAUSE + SIZE_BOOT_CAUSE) -/* NMI completion flag(Copying) S */ -#define SIZE_NMI_END_CPY 0x00000004 - -/* Target Type A Offset from the beginning 0x78 */ -#define ADDR_TARGET (ADDR_NMI_END_CPY + SIZE_NMI_END_CPY) -/* Target Type S */ -#define SIZE_TARGET 0x00000004 - -#define ADDR_SYS_NR_RST (ADDR_TARGET + SIZE_TARGET) /* Normal reset factor table A 0x7c */ -#define SIZE_SYS_NR_RST 0x00000004 /* Normal reset factor table S */ - -#define ADDR_NK_LOAD_STS (ADDR_SYS_NR_RST + SIZE_SYS_NR_RST) /* NK Load Status Table A 0x80 */ -#define SIZE_NK_LOAD_STS 0x00000004 /* NK Load Status Table S */ - -#define ADDR_CRC_RETRY (ADDR_NK_LOAD_STS + SIZE_NK_LOAD_STS) /* CRC retry count table A 0x84 */ -#define SIZE_CRC_RETRY 0x00000004 /* CRC retry count table S */ - -#define ADDR_BOOT_VBR (ADDR_CRC_RETRY + SIZE_CRC_RETRY) /* VBR-saved table in BootLoaderr A 0x88 */ -#define SIZE_BOOT_VBR 0x00000004 /* VBR-saved table in BootLoaderr S */ - -#define ADDR_MONI_TYPE (ADDR_BOOT_VBR + SIZE_BOOT_VBR) /* Monitor Type Table A 0x8C */ -#define SIZE_MONI_TYPE 0x00000004 /* Monitor Type Table S */ - -#define ADDR_B_FLAG (ADDR_MONI_TYPE + SIZE_MONI_TYPE) /* B genuine flag A 0x90 */ -#define SIZE_B_FLAG 0x00000010 /* B genuine flag S */ - -#define ADDR_RGBCABLE_TYPE (ADDR_B_FLAG + SIZE_B_FLAG) /* Connection RGB Cable Type Table A 0xA0 */ -#define SIZE_RGBCABLE_TYPE 0x0000004 /* Connection RGB Cable Type Table S */ - -#define ADDR_RESET_LABEL (ADDR_RGBCABLE_TYPE + SIZE_RGBCABLE_TYPE) /* Normal reset label area A 0xA4 */ -#define SIZE_RESET_LABEL 0x00000010 /* Normal reset label area S */ - -#define ADDR_NK_VUP_FLAG (ADDR_RESET_LABEL + SIZE_RESET_LABEL) /* NK version upgrade flag A 0xB4 */ -#define SIZE_NK_VUP_FLAG 0x00000004 /* NK version upgrade flag S */ - -#define ADDR_TRANS_VUP (ADDR_NK_VUP_FLAG + SIZE_NK_VUP_FLAG) /* VUP migration flag A */ -#define SIZE_TRANS_VUP 0x00000004 /* VUP migration flag S */ - -#define ADDR_PRG_SPAR_BOOT (ADDR_TRANS_VUP + SIZE_TRANS_VUP) /* Preliminary program start occurrence flag A */ -#define SIZE_ADDR_PRG_SPAR_BOOT 0x00000004 /* Preliminary program start occurrence flag S */ - -#define ADDR_BOOT_ERR (ADDR_PRG_SPAR_BOOT + SIZE_ADDR_PRG_SPAR_BOOT) /* OS Pre-boot Error Information Storage Table A */ -#define SIZE_BOOT_ERR 0x00000004 /* OS Pre-boot Error Information Storage Table S */ - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_ - diff --git a/vehicleservice/positioning_base_library/library/include/tchar.h b/vehicleservice/positioning_base_library/library/include/tchar.h deleted file mode 100755 index ee45e4d..0000000 --- a/vehicleservice/positioning_base_library/library/include/tchar.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define _T(x) __TEXT(x) - -#ifdef UNICODE - /* ++++++++++++++++++++ UNICODE ++++++++++++++++++++ */ - -#define _TEOF WEOF - -#define _tmain wmain - -#ifdef UNDER_CE -# define _tWinMain WinMain -#else -# define _tWinMain wWinMain -#endif - - /* Formatted i/o */ -#define _tprintf wprintf -#define _ftprintf fwprintf -#define _stprintf swprintf -#define _sntprintf _snwprintf -#define _vtprintf vwprintf -#define _vftprintf vfwprintf -#define _vstprintf vswprintf -#define _vsntprintf _vsnwprintf -#define _tscanf wscanf -#define _ftscanf fwscanf -#define _stscanf swscanf - - /* Unformatted i/o */ -#define _fgettc fgetwc -#define _fgetts fgetws -#define _fputtc fputwc -#define _fputts fputws -#define _gettc getwc -#define _gettchar getwchar -#define _getts _getws -#define _puttc putwc -#define _puttchar putwchar -#define _putts _putws -#define _ungettc ungetwc - -#define _tfopen _wfopen -#define _tfreopen _wfreopen - - /* String conversion functions */ -#define _tcstod wcstod -#define _tcstol wcstol -#define _tcstoul wcstoul - -#define _itot _itow -#define _ltot _ltow -#define _ultot _ultow -#define _ttoi _wtoi -#define _ttol _wtol -#define _ttoi64 _wtoi64 - - /* String functions */ -#define _tcscat wcscat -#define _tcschr wcschr -#define _tcscmp wcscmp -#define _tcscpy wcscpy -#define _tcscspn wcscspn -#define _tcslen wcslen -#define _tcsclen wcslen - -#define _tcsncat wcsncat -#define _tcsnccat wcsncat -#define _tcsnccmp wcsncmp -#define _tcsncmp wcsncmp -#define _tcsncpy wcsncpy -#define _tcsnccpy wcsncpy -#define _tcspbrk wcspbrk -#define _tcsrchr wcsrchr -#define _tcsspn wcsspn -#define _tcsstr wcsstr -#define _tcstok wcstok -#define _tcsdup _wcsdup -#define _tcsicmp _wcsicmp -#define _tcsncicmp _wcsnicmp -#define _tcsnicmp _wcsnicmp -#define _tcsnset _wcsnset -#define _tcsncset _wcsnset -#define _tcsrev _wcsrev -#define _tcsset _wcsset - -#define _tcslwr _wcslwr -#define _tcsupr _wcsupr - -#define _istalpha iswalpha -#define _istupper iswupper -#define _istlower iswlower -#define _istdigit iswdigit -#define _istxdigit iswxdigit -#define _istspace iswspace -#define _istpunct iswpunct -#define _istalnum iswalnum -#define _istprint iswprint -#define _istgraph iswgraph -#define _istcntrl iswcntrl -#define _istascii iswascii - -#define _totupper towupper -#define _totlower towlower - -#define _istlegal(_c) (1) -#define _istlead(_c) (0) -#define _istleadbyte(_c) (0) - -#else /* ndef UNICODE */ - - /* ++++++++++++++++++++ SBCS (MBCS in Not supported) ++++++++++++++++++++ */ - -#define _TEOF EOF - - /* Program */ -#define _tmain main -#define _tWinMain WinMain - - /* Formatted i/o */ -#define _tprintf printf -#define _ftprintf fprintf -#define _stprintf sprintf -#define _sntprintf _snprintf -#define _vtprintf vprintf -#define _vftprintf vfprintf -#define _vstprintf vsprintf -#define _vsntprintf _vsnprintf -#define _tscanf scanf -#define _ftscanf fscanf -#define _stscanf sscanf - - /* Unformatted i/o */ -#define _fgettc fgetc -#define _fgetts fgets -#define _fputtc fputc -#define _fputts fputs -#define _gettc getc -#define _gettchar getchar -#define _getts gets -#define _puttc putc -#define _puttchar putchar -#define _putts puts -#define _ungettc ungetc - -#define _tfopen _wfopen -#define _tfreopen _wfreopen - -#ifndef UNDER_CE - -#define _tcstod strtod -#define _tcstol strtol -#define _tcstoul strtoul -#endif - -#define _itot _itoa -#define _ltot _ltoa -#define _ultot _ultoa -#define _ttoi atoi -#define _ttol atol - -#ifndef UNDER_CE -#define _ttoi64 atoi64 -#endif - - /* String functions */ -#define _tcscat strcat -#define _tcschr strchr -#define _tcscmp strcmp -#define _tcscpy strcpy -#define _tcscspn strcspn -#define _tcslen strlen -#define _tcsclen strlen - -#define _tcsncat strncat -#define _tcsnccat strncat -#define _tcsnccmp strncmp -#define _tcsncmp strncmp -#define _tcsncpy strncpy -#define _tcsnccpy strncpy - -#ifndef UNDER_CE - -#define _tcspbrk strpbrk -#define _tcsrchr strrchr -#define _tcsspn strspn -#endif - -#define _tcsstr strstr -#define _tcstok strtok - -#ifndef UNDER_CE - -#define _tcsdup _strdup -#define _tcsicmp _stricmp -#define _tcsncicmp _strnicmp -#define _tcsnicmp _strnicmp -#define _tcsnset _strnset -#define _tcsncset _strnset -#define _tcsrev _strrev -#define _tcsset _strset -#define _tcslwr _strlwr -#define _tcsupr _strupr -#endif - -#ifndef UNDER_CE - -#define _istalpha isalpha -#define _istupper isupper -#define _istlower islower -#define _istdigit isdigit -#define _istxdigit isxdigit -#define _istspace isspace -#define _istpunct ispunct -#define _istalnum isalnum -#define _istprint isprint -#define _istgraph isgraph -#define _istcntrl iscntrl -#define _istascii isascii -#define _totupper toupper -#define _totlower tolower -#endif - -#endif /* UNICODE */ - -#ifdef __cplusplus -} -#endif - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h deleted file mode 100755 index 085640a..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h +++ /dev/null @@ -1,1653 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_ - -/** - * @file WPF_STD.h - * @brief Header file for system standard definitions - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup vehicle_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup positioning_base_library - * @ingroup vehicle_service - * @{ - */ - -/*---------------------------------------------------------------------------------* - * Incluce * - *---------------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------------* - * Definition * - *---------------------------------------------------------------------------------*/ -#define POS_THREAD_NAME "Positioning" //!< \~english Positioning thread name - -#ifdef UNICODE -#define __TEXT(quote) L##quote -#else /* UNICODE */ -#define __TEXT(quote) (quote) /* r_winnt */ -#endif /* UNICODE */ - -#define D_LTEXT(x) __TEXT(x) -#define LTEXT(x) D_LTEXT(x) - -#define DEBUG_DUMP_MAX_SIZE 4096 -//!< \~english FrameworkunifiedOnDebugDump max size - -/* Sensor Log Type */ -#define POS_SENSLOG_TYPE_NONE 0 //!< \~english sensor log type NONE -#define POS_SENSLOG_TYPE_SYS 1 //!< \~english sensor log type SYS -#define POS_SENSLOG_TYPE_GPS 2 //!< \~english sensor log type GPS -#define POS_SENSLOG_TYPE_NAV 3 //!< \~english sensor log type NAV -#define POS_SENSLOG_TYPE_CMD 4 //!< \~english sensor log type CMD - -#define POS_SENSLOG_GET_ZONE(typ) \ - (((typ) == (POS_SENSLOG_TYPE_SYS))?(ZONE_POS_SYS_IN):\ - ((typ) == (POS_SENSLOG_TYPE_GPS))?(ZONE_POS_GPS_IN):\ - ((typ) == (POS_SENSLOG_TYPE_NAV))?(ZONE_POS_NAV_IN):\ - ((typ) == (POS_SENSLOG_TYPE_CMD))?(ZONE_POS_CMD_IN):\ - (0)) -//!< \~english get sensor log zone code - -#define POS_WRITE_SENSLOG(zone, data, len) (((zone) != (0))?((void)((FRAMEWORKUNIFIEDLOG_DATA(zone, data, len)))):((void)(0))) -//!< \~english write sensor log output -#define POS_SENSLOG(typ, data, len) (POS_WRITE_SENSLOG(POS_SENSLOG_GET_ZONE(typ), data, len)) - -/* HW configuration type */ -/* - * Note. - * This feature needs to be defined by the vendor. - */ -#define UNIT_TYPE_NONE 0x00000000UL //!< \~english type none -#define UNIT_TYPE_UNKNOWN 0x00000001UL //!< \~english type unknown -#define UNIT_TYPE_GRADE1 0x00000002UL //!< \~english type Grade1 -#define UNIT_TYPE_GRADE2 0x00000004UL //!< \~english type Grade2 - -#define MAX_NAME_LEN 32 //!< \~english name max length -#define _CWORD31__NO_SIZE 16 //!< \~english _CWORD31_ No size -#define RESERVE1_SIZE 16 //!< \~english reserve 1 -#define HELPNET_ID_SIZE 21 //!< \~english helpnet ID size -#define RESERVE2_SIZE 11 //!< \~english reserve 2 -#define DATE_SIZE 32 //!< \~english make time size -#define SERIAL_NO_SIZE 3 //!< \~english serial No size -#define PRODUCT_NAME_SIZE 1 //!< \~english product name size - -#define _pb_memcpy memcpy -#define _pb_memset memset - -/* RET_API define */ -#define RET_NORMAL 0 //!< \~english normal return -#define RET_ERROR (-1) //!< \~english error return -#define RET_ERRPARAM (-2) //!< \~english parameter error - -#define SAPI_EVSET_ABSOLUTE 1 //!< \~english absolute vale set -#define SAPI_EVWAIT_VAL 1 //!< \~english event wait value set - -/* sys common commandID definition */ -#define CID_GPS_BASE (CID)0xF030 -//!< \~english GPS - -#define CID_TIMER_BASE (CID)0xF040 -//!< \~english timer management - -#define CID_INITIAL_BASE (CID)0xF100 -//!< \~english initial - -/* ResourceManager/CID definition */ -#define CID_GPS_SERIAL0 (CID)0x0100 -//!< \~english GPS reset request func definition - -#define CID_GPS_REQRESET (CID)(CID_GPS_BASE | CID_GPS_SERIAL0) -//!< \~english GPS reset request CID - - -/* sys common commandID detail definition */ -#define CID_COM_SERIAL4 (CID)0x0004 -//!< \~english serial command ID 4 - -#define CID_COM_SERIAL6 (CID)0x0006 -//!< \~english serial command ID 6 - -#define CID_COM_SERIAL7 (CID)0x0007 -//!< \~english serial command ID 7 - -/* initial CID definition */ -#define CID_INI_SYSTEMERR (CID)(CID_INITIAL_BASE | CID_COM_SERIAL6) -//!< \~english system abnormality notify - -#define CID_INI_INTERNAL_ACCOFF_START (CID)(CID_INITIAL_BASE | CID_COM_SERIAL7) -//!< \~english internal ACC-OFF start Indication - -/* timer control CID definition */ -#define CID_TIMER_TOUT (CID)(CID_TIMER_BASE | CID_COM_SERIAL4) -//!< \~english timeout notify - - -/* PNO definition */ -#define PNO_NONE 0x0000 //!< \~english initial value - -#define PNO__CWORD88___CWORD23_ 0x0100 -//!< \~english _CWORD23_ primary thread -#define PNO_GINI_MAIN 0x0300 -//!< \~english G initial -#define PNO_CLK_GPS 0x0316 -//!< \~english clock GPS thread -#define PNO_VEHICLE_SENSOR 0x0363 -//!< \~english vehicle sensor thread -#define PNO_LINE_SENS_DRV 0x0364 -//!< \~english line sensor driver thread -#define PNO_NAVI_GPS_MAIN 0x0440 -//!< \~english GPS communication manager thread -#define PNO_NAVI_GPS_RCV 0x0441 -//!< \~english GPS receive thread -#define PNO__CWORD83_ 0x0900 -//!< \~english _CWORD83_(Intersystem Communication Message)thread - -#define SYS_PNO_MIN PNO__CWORD88___CWORD23_ -//!< \~english minimum PNO.(normal process) -#define SYS_PNO_MAX PNO__CWORD83_ -//!< \~english maximum PNO.(normal process) - -/*---------------------------------------------------------------------------------* - * Typedef declaration * - *---------------------------------------------------------------------------------*/ -typedef u_int32 EventID; -typedef int32 RET_API; //!< \~english _CWORD64_API return code -typedef u_int32 event_id; -typedef event_id SemID; //!< \~english semaphore ID -typedef u_int16 CID; //!< \~english command ID - -typedef uint32_t UNIT_TYPE; //!< \~english unit type data type define -typedef int32 ANA_RET_API; - -typedef char TCHAR; - -/** - * @enum _RcvMsgMode - * \~english mode of receive message - */ -typedef enum { - RM_WAIT, //!< \~english wait until received message - RM_CHECKRCV //!< \~english do not wait message, return -} _RcvMsgMode; - -/** - * @enum - * \~english definition of event reset mode - */ -enum { - _CWORD64_EVENT_MANUALRESET_OFF = 0, //!< \~english manual reset off - _CWORD64_EVENT_MANUALRESET_ON, //!< \~english manual reset on - _CWORD64_EVENT_MANUALRESET_MAX //!< \~english manual reset max value -}; - - -/*---------------------------------------------------------------------------------* - * Struct declaration * - *---------------------------------------------------------------------------------*/ -/** - * @struct _SECURITY_ATTRIBUTES - * \~english security attribute - */ -typedef struct _SECURITY_ATTRIBUTES { - DWORD nLength; //!< \~english length - LPVOID lpSecurityDescriptor; //!< \~english data pointer - BOOL bInheritHandle; //!< \~english inherited handle -} SECURITY_ATTRIBUTES; -typedef SECURITY_ATTRIBUTES *PSECURITY_ATTRIBUTES; //!< \~english security attribute -typedef SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES; //!< \~english security attribute - -/*---------------------------------------------------------------------------------* - * Prototype Declaration * - *---------------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Create event by specified name -/// -/// \~english @param [in] ucManualReset -/// - u_int8 manual reset mode -/// \~english @param [in] lInitData -/// - int32 event value -/// \~english @param [in] cpEventName -/// - char* event name -/// -/// \~english @par -/// - manual reset mode(ucManualReset) -/// - _CWORD64_EVENT_MANUALRESET_OFF manual reset OFF -/// - _CWORD64_EVENT_MANUALRESET_ON manual reset ON -/// -/// \~english @retval 0 event create failed -/// \~english @retval not 0 created event ID -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter cpEventName is NULL -/// - The parameter ucManualReset is more than or equal _CWORD64_EVENT_MANUALRESET_MAX -/// - The string of parameter cpEventName has no text -/// - The string length of parameter cpEventName is longer than MAX_EVENT_NAME_LEN -/// - The event is created in same process, but the count of thread reference to the event is reach to the max -/// - The event is created in system, but the count of process reference to the event is reach to the max -/// - Memory allocate failed for creating event table -/// - During create the event table, the event flag register failed -/// - The event table is full -/// -/// \~english @par Detail -/// - Call this API to create event and return the created event ID. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -EventID _pb_CreateEvent(u_int8 ucManualReset, int32 lInitData, char *cpEventName); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Wait for the event specified by ID -/// -/// \~english @param [in] eventID -/// - EventID event ID -/// \~english @param [in] lWaitMode -/// - int32 event wait mode -/// \~english @param [in] lMinVal -/// - int32 event wait min value -/// \~english @param [in] lMaxVal -/// - int32 event wait max value -/// \~english @param [out] plEventVal -/// - int32* event wait value output pointer -/// \~english @param [in] ulMillSecTime -/// - u_int32 timeout time(ms) -/// -/// \~english @par -/// - event wait mode(lWaitMode) -/// - SAPI_EVWAIT_VAL -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_EV_NONE parameter error or specified event not exist -/// \~english @retval RET_ERRTIMEOUT timeout -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter plEventVal is NULL -/// - The parameter eventID is more than MAX_PB_EVENTS -/// - The specified event has not been registered in event table -/// - The count of threads which is waiting this event is reach max -/// - The parameter ulMillSecTime is 0 -/// - The parameter ulMillSecTime is INFINITE, and wait event flag failed -/// - The parameter ulMillSecTime is not INFINITE, and timeout -/// - The parameter ulMillSecTime is not INFINITE, and get event flag failed -/// -/// \~english @par Detail -/// - Call this API to wait event. -/// - This API will return after timeout or this event been set. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_WaitEvent(EventID eventID, int32 lWaitMode, int32 lMinVal, - int32 lMaxVal, int32* plEventVal, u_int32 ulMillSecTime); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Set the value of event specified by ID -/// -/// \~english @param [in] eventID -/// - EventID event ID -/// \~english @param [in] lSetMode -/// - int32 event value set mode -/// \~english @param [in] iVal -/// - int32 event value -/// -/// \~english @par -/// - event value set mode(lSetMode) -/// - SAPI_EVSET_ABSOLUTE absolute value set(set parameter value) -/// - SAPI_EVSET_RELATE offset set(offset of current value set) -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_EV_NONE specified event not exist -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter eventID is more than MAX_PB_EVENTS -/// - The specified event has not been registered in event table -/// - The parameter lSetMode is neither SAPI_EVSET_ABSOLUTE nor SAPI_EVSET_RELATE -/// -/// \~english @par Detail -/// - Call this API to set event value. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_SetEvent(EventID eventID, int32 lSetMode, int32 lval); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Destroy the event specified by ID -/// -/// \~english @param [in] eventID -/// - EventID event ID -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERROR event flag destroy failed -/// \~english @retval RET_EV_NONE specified event not exist -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter eventID is more than MAX_PB_EVENTS -/// - The specified event has not been registered in event table -/// - Event flag destroy failed -/// -/// \~english @par Detail -/// - Call this API to destroy specified event. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_DeleteEvent(EventID eventID); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Initialization before call Base API(every process used Base API should call this API firstly). -/// -/// \~english @param [in] hApp -/// - HANDLE app Handle -/// -/// \~english @retval RET_NORMAL normal return -/// -/// \~english @par Precondition -/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to initialize Base API. -/// - Every process used Base API should call this API firstly. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_Setup_CWORD64_API(HANDLE hApp); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Terminate current thread. -/// -/// \~english @param [in] dwExitCode -/// - DWORD exit code(not used) -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - None -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to terminate current thread. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -VOID _pb_ExitThread(DWORD dwExitCode); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Create the message queue -/// -/// \~english @param [in] eventID -/// - EventID process No -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter pno is 0 -/// - The name length of thread called this API is longer than MAX_QUEUE_NAME_SIZE -/// -/// \~english @par Detail -/// - Call this API to create the message queue. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_CreateMsg(PNO pno); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Send message in process -/// -/// \~english @param [in] pno -/// - PNO process No -/// \~english @param [in] size -/// - u_int16 message size -/// \~english @param [in] msgbuf -/// - void* message buffer -/// \~english @param [in] mode -/// - u_int16 not used -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter msgbuf is NULL -/// - The parameter pno is 0 -/// - The message queue specified by parameter pno has not been created -/// - Get sender Handle failed -/// - Send message failed -/// -/// \~english @par Detail -/// - Call this API to send message in process. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Send message between process -/// -/// \~english @param [in] name -/// - PCSTR destination process name -/// \~english @param [in] cid -/// - CID command ID -/// \~english @param [in] size -/// - u_int16 message size -/// \~english @param [in] msgbuf -/// - const void* message buffer -/// \~english @param [in] mode -/// - u_int16 not used -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter name is NULL -/// - The parameter msgbuf is NULL -/// - The length of parameter name is longer than MAX_QUEUE_NAME_SIZE -/// - Get sender Handle failed -/// - Send message failed -/// -/// \~english @par Detail -/// - Call this API to send message between process. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, u_int16 mode); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Create semaphore by specified name -/// -/// \~english @param [in] semName -/// - char* semaphore name -/// -/// \~english @retval 0 semaphore create failed -/// \~english @retval not 0 created semaphore ID -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter semName is NULL -/// - The string of parameter semName has no text -/// - The string length of parameter semName is longer than MAX_SEMAPHORE_NAME_LEN -/// - Memory allocate failed for creating semaphore table -/// - The semaphore table is full -/// -/// \~english @par Detail -/// - Call this API to create semaphore and return the created semaphore ID. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -SemID _pb_CreateSemaphore(char* semName); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Semaphore lock -/// -/// \~english @param [in] semID -/// - SemID semaphore ID -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_OSERROR error return -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter semName is 0 -/// - The parameter semName is more than MAX_PB_SEMAPHORES -/// - The specified semaphore has not been registered in semaphore table -/// - The specified semaphore's mutex has not been created -/// - The specified semaphore's mutex lock failed -/// -/// \~english @par Detail -/// - Call this API to get semaphore. -/// - This API will return after got semaphore. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_SemLock(SemID semID); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Semaphore unlock -/// -/// \~english @param [in] semID -/// - SemID semaphore ID -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_OSERROR error return -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter semName is 0 -/// - The parameter semName is more than MAX_PB_SEMAPHORES -/// - The specified semaphore has not been registered in semaphore table -/// - The specified semaphore's mutex has not been created -/// - The specified semaphore's mutex release failed -/// -/// \~english @par Detail -/// - Call this API to relesae semaphore. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_SemUnlock(SemID semID); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Create Share Data -/// -/// \~english @param [in] area_name -/// - char* share data name -/// \~english @param [in] size -/// - u_int32 data size -/// \~english @param [out] mem_ptr -/// - void** share memory pointer -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERROR error return -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter area_name is NULL -/// - The parameter mem_ptr is NULL -/// - The string of parameter area_name has no text -/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN -/// - The parameter size is 0 -/// - The specified share data has already been created -/// - Memory allocate failed for creating share data -/// - The specified share data file create failed -/// -/// \~english @par Detail -/// - Call this API to create share data. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Link Share Data -/// -/// \~english @param [in] area_name -/// - char* share data name -/// \~english @param [out] mem_ptr -/// - void** share memory pointer -/// \~english @param [in] size -/// - u_int32* data size -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERROR error return -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter area_name is NULL -/// - The parameter mem_ptr is NULL -/// - The string of parameter area_name has no text -/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN -/// - The parameter size is NULL -/// - Memory allocate failed for linking share data -/// - The specified share data file open failed -/// -/// \~english @par Detail -/// - Call this API to link share data. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Start timer -/// -/// \~english @param [in] SndPno -/// - PNO source process No -/// \~english @param [in] TimerSeq -/// - u_int16 timer sequence No -/// \~english @param [in] TimerType -/// - u_int8 timer type -/// \~english @param [in] TimeOut -/// - u_int32 timeout time -/// -/// \~english @par -/// - timer type(TimerType) -/// - TIMER_TYPE_SYN fixed term timer -/// - TIMER_TYPE_USN asynchronous timer -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - Initialization of positioning_base_library has not been done in current process -/// - The parameter TimerType is neither TIMER_TYPE_SYN nor TIMER_TYPE_USN -/// - The parameter TimeOut is 0 -/// - The same timer has already been started -/// - Timer start failed -/// -/// \~english @par Detail -/// - Call this API to start timer. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_ReqTimerStart(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType, u_int32 TimeOut); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Stop timer -/// -/// \~english @param [in] SndPno -/// - PNO source process No -/// \~english @param [in] TimerSeq -/// - u_int16 timer sequence No -/// \~english @param [in] TimerType -/// - u_int8 timer type -/// -/// \~english @par -/// - timer type(TimerType) -/// - TIMER_TYPE_SYN fixed term timer -/// - TIMER_TYPE_USN asynchronous timer -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERROR error return -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - Initialization of positioning_base_library has not been done in current process -/// - Timer stop failed -/// -/// \~english @par Detail -/// - Call this API to stop timer. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_TimerStop(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Create mutex -/// -/// \~english @param [in] lpMutexAttributes -/// - LPSECURITY_ATTRIBUTES not used -/// \~english @param [in] bInitialOwner -/// - BOOL not used -/// \~english @param [in] lpName -/// - LPCTSTR mutex name -/// -/// \~english @retval NULL error return -/// \~english @retval Except NULL created mutex Handle -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter lpName is NULL -/// - The string length of pamareter lpName is longer than NAME_MAX -/// - Mutex lock map failed -/// -/// \~english @par Detail -/// - Call this API to create mutex. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get message management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// \~english @param [in/out] pLen -/// - uint8_t* output buffer size -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get message management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get mutex management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// \~english @param [in/out] pLen -/// - uint8_t* output buffer size -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get mutex management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugMutexMngTbl(void* pBuf, uint8_t* pLen); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get timer management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get timer management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugTimerMngTbl(void* pBuf); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get event management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// \~english @param [in/out] pLen -/// - uint8_t* output buffer size -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get event management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugEventMngTbl(void* pBuf, uint8_t* pLen); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get memory management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get memory management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugMemoryMngTbl(void* pBuf); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get common info management table dump info. -/// -/// \~english @param [out] pBuf -/// - void* output buffer -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get common info management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_GetDebugOtherMngTbl(void* pBuf); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get current app Handle. -/// -/// \~english @param None -/// -/// \~english @retval 0 get Handle failed -/// \~english @retval not 0 Handle -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - Current app Handle has not been registered -/// -/// \~english @par Detail -/// - Call this API to get current app Handle. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -HANDLE _pb_GetAppHandle(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Set current app Handle. -/// -/// \~english @param [in] hApp -/// - HANDLE app Handle -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get common info management table dump info. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_SetAppHandle(HANDLE hApp); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Base API stop process(every process used Base API should call this API before stop). -/// -/// \~english @param None -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to stop Base API. -/// - Every process used Base API should call this API before stop. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_Teardown_CWORD64_API(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Terminate current process. -/// -/// \~english @param [in] pFunc -/// - char* source function -/// \~english @param [in] line -/// - int source line -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - None -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to terminate current process. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_Exit_d(const char* pFunc, int line); -#define _pb_Exit() _pb_Exit_d(__func__, __LINE__) - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Receive message. -/// -/// \~english @param [in] pno -/// - PNO process No -/// \~english @param [in] size -/// - u_int16 message size -/// \~english @param [out] msgbuf -/// - void* message buffer -/// \~english @param [in] mode -/// - u_int16 not used -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter msgbuf is NULL -/// - The parameter pno is 0 -/// - The message queue specified by parameter pno has not been created -/// - Receive message failed -/// - Receive message successrully, but the received message size is longer than parameter size -/// - Get received message data failed -/// -/// \~english @par Detail -/// - Call this API to receive message of specified pno. -/// - This API will return after received message. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get send buffer for message transferring in process -/// -/// \~english @param [in] pno -/// - PNO process No -/// \~english @param [out] pSndBuf -/// - void** send buffer -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter pno is 0 -/// - The message queue specified by parameter pno has not been created -/// - Get sender Handle failed -/// - Get send buffer failed -/// -/// \~english @par Detail -/// - Call this API to get send buffer for message transferring in process. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_GetZcSndBuf(PNO pno, void** pSndBuf); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Send message in process -/// -/// \~english @param [in] pno -/// - PNO process No -/// \~english @param [in] size -/// - u_int16 message size -/// \~english @param [in] mode -/// - u_int16 not used -/// -/// \~english @retval RET_NORMAL normal return -/// \~english @retval RET_ERRPARAM parameter error -/// \~english @retval RET_ERROR other error -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter pno is 0 -/// - The message queue specified by parameter pno has not been created -/// - Get sender Handle failed -/// - Get send buffer failed -/// - Set send buffer failed -/// - Send message failed -/// -/// \~english @par Detail -/// - Call this API to send message in process. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Convert process name to pno -/// -/// \~english @param [in] name -/// - PCSTR process name -/// -/// \~english @retval 0 convert failed -/// \~english @retval not 0 converted PNO -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter name is NULL -/// - The size of parameter name is longer than THREAD_NAME_LEN_MAX -/// -/// \~english @par Detail -/// - Call this API to convert process name to pno. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -PNO _pb_CnvName2Pno(PCSTR name); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Convert pno to process name -/// -/// \~english @param [in] pno -/// - PNO process No -/// -/// \~english @retval NULL convert failed -/// \~english @retval not NULL converted process name -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Failure condition -/// - The parameter pno has not been registered(not the return pno of _pb_CnvName2Pno). -/// -/// \~english @par Detail -/// - Call this API to convert pno to process name. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Sync -/// -//////////////////////////////////////////////////////////////////////////////////////////// -PCSTR _pb_CnvPno2Name(PNO pno); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get message resource -/// -/// \~english @param None -/// -/// \~english @retval TRUE normal return -/// \~english @retval FALSE error(lack of resource) -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get message resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -BOOL _pb_GetMsgResource(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get mutex resource -/// -/// \~english @param None -/// -/// \~english @retval TRUE normal return -/// \~english @retval FALSE error(lack of resource) -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get mutex resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -BOOL _pb_GetMutexResource(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Get common resource -/// -/// \~english @param None -/// -/// \~english @retval TRUE normal return -/// \~english @retval FALSE error(lack of resource) -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to get common resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -BOOL _pb_GetOtherResource(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Release message resource -/// -/// \~english @param None -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to release message resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_ReleaseMsgResource(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Release mutex resource -/// -/// \~english @param None -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to release mutex resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_ReleaseMutexResource(void); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup positioning_base_library -/// \~english @par Brief -/// - Release common resource -/// -/// \~english @param None -/// -/// \~english @retval None -/// -/// \~english @par Precondition -/// - positioning_base_library initialization are completed \n -/// (_pb_Setup_CWORD64_API has already been called) in current process. -/// -/// \~english @par changes of the internal status -/// - There is no changes of the internal status by this API -/// -/// \~english @par Detail -/// - Call this API to release common resource. -/// \n -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -//////////////////////////////////////////////////////////////////////////////////////////// -void _pb_ReleaseOtherResource(void); - -#ifdef __cplusplus -} -#endif - -/** @}*/ // end of positioning_base_library -/** @}*/ // end of vehicle_service -/** @}*/ // end of BaseSystem -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h deleted file mode 100755 index b6af335..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _POS_MESSAGE_HEADER_ // NOLINT(build/header_guard) -#define _POS_MESSAGE_HEADER_ - -/** - * @file pos_message_header.h - * @brief Header file for message data definitions - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup vehicle_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup positioning_base_library - * @ingroup vehicle_service - * @{ - */ - -#include - -/** - * @struct T_APIMSG_HEADER - * \~english _CWORD64_API message header structure - */ -typedef struct { - uint16_t replyid; //!< \~english message send result notify dest ID - uint16_t sndpno; //!< \~english message send source process No - uint16_t respno; //!< \~english message response process No - uint16_t cid; //!< \~english message command ID - uint16_t msgbodysize; //!< \~english message body size - uint8_t rid; //!< \~english message resource ID */ - uint8_t reserve; //!< \~english reserve - uint8_t filler[2]; //!< \~english filter -} T_APIMSG_HEADER; - -/** - * @struct T_APIMSG_MSGBUF_HEADER - * \~english _CWORD64_API message buffer header structure - */ -typedef struct { - uint32_t signo; //!< \~english signal No, _pb_SndMsg to set 0 - T_APIMSG_HEADER hdr; //!< \~english message header -} T_APIMSG_MSGBUF_HEADER; - -/** - * @struct _CWORD64_MSG_LOG_HDR - * \~english _CWORD64_API message log header structure - */ -typedef struct { - uint32_t kickTime; //!< \~english kick time - uint32_t srCid; //!< \~english message command ID - uint32_t pno; //!< \~english process No - uint32_t dataBytes; //!< \~english data size -} _CWORD64_MSG_LOG_HDR; - -/** @}*/ // end of positioning_base_library -/** @}*/ // end of vehicle_service -/** @}*/ // end of BaseSystem -#endif // _POS_MESSAGE_HEADER_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h deleted file mode 100755 index c6ce3ce..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - - -#ifndef VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard) -#define VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard) - -/** - * @file positioning_base_library.h - * @brief Common header of positioning_base_library - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup vehicle_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup positioning_base_library - * @ingroup vehicle_service - * @{ - */ - -#include -#include -#include -#include - -/** @}*/ // end of positioning_base_library -/** @}*/ // end of vehicle_service -/** @}*/ // end of BaseSystem -#endif // VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h deleted file mode 100755 index b0fd4e1..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This file has been generated automatically. - * User hand written code entry is not allowed. Do not modify the file content. - * - */ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_ - -/* Include Files */ -#include - -#define ZONE_INIT ZONEMASK(10) -#define ZONE_FUNC ZONEMASK(11) -#define ZONE_MEM ZONEMASK(12) -#define ZONE_APP ZONEMASK(13) -#define ZONE_14 ZONEMASK(14) -#define ZONE_15 ZONEMASK(15) -#define ZONE_16 ZONEMASK(16) -#define ZONE_17 ZONEMASK(17) -#define ZONE_18 ZONEMASK(18) -#define ZONE_19 ZONEMASK(19) -#define ZONE_20 ZONEMASK(20) -#define ZONE_21 ZONEMASK(21) -#define ZONE_22 ZONEMASK(22) -#define ZONE_23 ZONEMASK(23) -#define ZONE_24 ZONEMASK(24) -#define ZONE_25 ZONEMASK(25) -#define ZONE_26 ZONEMASK(26) -#define ZONE_27 ZONEMASK(27) -#define ZONE_28 ZONEMASK(28) -#define ZONE_INFO ZONEMASK(29) -#define ZONE_WARN ZONEMASK(30) -#define ZONE_ERR ZONEMASK(31) - -#define ZONE_POS_SYS_IN ZONE_SP_ZONE_99 -#define ZONE_POS_GPS_IN ZONE_SP_ZONE_100 -#define ZONE_POS_CMD_IN ZONE_SP_ZONE_101 -#define ZONE_POS_NAV_IN ZONE_SP_ZONE_102 - -#define ZONE_TEXT_10 "Init" -#define ZONE_TEXT_11 "Function" -#define ZONE_TEXT_12 "Memory" -#define ZONE_TEXT_13 "StateMachine Example" -#define ZONE_TEXT_14 "" -#define ZONE_TEXT_15 "" -#define ZONE_TEXT_16 "" -#define ZONE_TEXT_17 "" -#define ZONE_TEXT_18 "" -#define ZONE_TEXT_19 "" -#define ZONE_TEXT_20 "" -#define ZONE_TEXT_21 "" -#define ZONE_TEXT_22 "" -#define ZONE_TEXT_23 "" -#define ZONE_TEXT_24 "" -#define ZONE_TEXT_25 "" -#define ZONE_TEXT_26 "" -#define ZONE_TEXT_27 "" -#define ZONE_TEXT_28 "" -#define ZONE_TEXT_29 "Info" -#define ZONE_TEXT_30 "Warning" -#define ZONE_TEXT_31 "Error" - -#ifndef FRAMEWORKUNIFIEDLOGOPTIONS -#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) /* LPRINT, LMSGQ, LSLOGGER */ -#endif - -#ifndef FRAMEWORKUNIFIEDLOGAPPZONES -#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INIT, ZONE_ERR, ZONE_14, ZONE_INFO, ZONE_POS_SYS_IN, ZONE_POS_GPS_IN, ZONE_POS_CMD_IN, \ - ZONE_POS_NAV_IN -#endif - -#define PS_APPNAME_MAX 12 -extern const CHAR kAppName[PS_APPNAME_MAX]; - -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h deleted file mode 100755 index 41ebbc8..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_ - -/** - * @file std_types.h - * @brief Header file for base type definitions - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup vehicle_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup positioning_base_library - * @ingroup vehicle_service - * @{ - */ - -typedef signed char int8; -typedef unsigned char u_int8; -typedef signed short int int16; -typedef unsigned short int u_int16; -typedef signed int int32; -typedef unsigned int u_int32; -typedef float float_t; -typedef double double_t; - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif -/** @}*/ // end of positioning_base_library -/** @}*/ // end of vehicle_service -/** @}*/ // end of BaseSystem -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_ diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h deleted file mode 100755 index 03a24ff..0000000 --- a/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_ -#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_ - -/** - * @file sys_timerapi.h - * @brief Header file for timer management - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup vehicle_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup positioning_base_library - * @ingroup vehicle_service - * @{ - */ - -/*---------------------------------------------------------------------------------* - * Definition * - *---------------------------------------------------------------------------------*/ - -#define WTM_DUPTIME_MAX 5 //!< \~english duplication timer max count - -#define TIMER_TYPE_SYN 1 -//!< \~english fixing cycle timer(unit: 100ms) -#define TIMER_TYPE_USN 2 -//!< \~english asynchronous timer(unit: 100ms) -#define TIMER_TYPE_ALM 5 //!< \~english specific time timer - -#define SUN 0 //!< \~english sunday -#define MON 1 //!< \~english monday -#define TUE 2 //!< \~english tuesday -#define WED 3 //!< \~english wednesday -#define THU 4 //!< \~english thursday -#define FRI 5 //!< \~english friday -#define SAT 6 //!< \~english saturday -#define DEFAULT_DIFFTIME 0x00 //!< \~english time difference value of japan - -#define GPS_SAT 0x00 //!< \~english corrected GPS time -#define GPS_IST 0x01 //!< \~english not corrected GPS time -#define GPS_RTC 0x02 //!< \~english RTC time -#define GPS_IRG 0x03 //!< \~english initial time -#define GPS_NON 0x7E //!< \~english GPS unused -#define GPS_IGN 0x7F //!< \~english time not received - -#define END_TIMER_RPT_OFF 0 //!< \~english No continuation -#define END_TIMER_RPT_ON 1 //!< \~english With continuation - -#define CID_TIMER_SETGPS 0x4040 -//!< \~english command ID of GPS setting timer -#define CID_TIMER_DIFSET 0x4045 -//!< \~english command ID of time difference setting timer -#define CID_TIMER_CYCLE (CID)(CID_TIMER_BASE | CID_COM_SERIAL5) -//!< \~english command ID of cycle data receive timer - -#define CNV_YEAR_MAX 136 -//!< \~english max value of conversion year(number of years + 1) -#define SEC_PER_MIN 60 //!< \~english 60[sec] -#define SEC_PER_HOUR 3600 //!< \~english 60[min] * 60[sec] -#define SEC_PER_DAY 86400 //!< \~english 24[h] * 60[min] * 60[sec] - -#define TIM_ROLOVR_DISABLE 0 //!< \~english GPS week rollover correct prohibition -#define TIM_ROLOVR_ENABLE 1 //!< \~english GPS week rollover correct permission - -/* - * Definition - * \~english timer manager error definition - */ -#define RET_ERR_NONEINIT (-30) //!< \~english initialization untreated error -#define RET_ERR_SEMLOCK (-31) //!< \~english get semaphore error -#define RET_ERR_SEMUNLOCK (-32) //!< \~english open semaphore error -#define RET_ERR_SRAMREAD (-33) //!< \~english read SRAM error - -/* - * Definition - * \~english command notify information definition(almanac abnormality notify, and time enable notify) - */ -#define TIM_NUM_SNDCMD 4 //!< \~english command send number - -#define NON_TIMEUNIT_INVALID_TIME 0 -//!< \~english No time manager unit - system time not set -#define NON_TIMEUNIT_VALID_TIME 1 -//!< \~english No time manager unit - system time set complete -#define GPS_INVALID_TIME 2 -//!< \~english With GPS unit - system time not set -#define GPS_VALID_TIME 3 -//!< \~english With GPS unit - system time set complete - -#define TMT_RETRY 3 //!< \~english retry count -#define TMT_RETRY_INTERVAL 500 //!< \~english retry interval(500[msec]) - - -/*---------------------------------------------------------------------------------* - * Struct declaration * - *---------------------------------------------------------------------------------*/ - -/** - * \~english define data type - */ -typedef struct { - u_int32 TimeOut[WTM_DUPTIME_MAX]; //!< \~english timeout value - u_int8 ContFlg; //!< \~english continue flag - u_int8 Dummy1; //!< \~english dummy data - u_int16 Dummy2; //!< \~english dummy data -} TimerDupData; - -/** - * @struct RealTimeData - * \~english current time data - */ -typedef struct { - u_int16 Yyear; //!< \~english current time(year:A.D.) - u_int8 Mmonth; //!< \~english (month) - u_int8 Dday; //!< \~english (day) - u_int8 Hhour; //!< \~english (hour) - u_int8 Mmin; //!< \~english (min) - u_int8 Ssec; //!< \~english (sec) - u_int8 Wweek; //!< \~english (week) - u_int8 CrtFlg; //!< \~english GPS time not corrected/corrected flag - u_int8 CrtHou; //!< \~english the last correction(hour) - u_int8 CrtMin; //!< \~english min - u_int8 CrtSec; //!< \~english sec -} RealTimeData; - -/** - * @struct RealTimeDataBcd - * \~english current time data(BCD format) - */ -typedef struct { - u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex.0x1998) - u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12) - u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31) - u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23) - u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59) - u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59) - u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06) - u_int8 CrtFlg; - //!< \~english GPS time not corrected or corrected flag(BIN 0x00 to 0x03) - u_int8 CrtHou; //!< \~english the last correction(hour BCD 0x00 to 0x23) - u_int8 CrtMin; //!< \~english (min BCD 0x00 to 0x59) - u_int8 CrtSec; //!< \~english (sec BCD 0x00 to 0x59) -} RealTimeDataBcd; - -/** - * @struct GpsSetData - * \~english GPS time setting data - */ -typedef struct { - u_int16 Yyear; //!< \~english current time(year:A.D.) - u_int8 Mmonth; //!< \~english (month) - u_int8 Dday; //!< \~english (day) - u_int8 Hhour; //!< \~english (hour) - u_int8 Mmin; //!< \~english (min) - u_int8 Ssec; //!< \~english (sec) - u_int8 Dummy; //!< \~english dummy data -} GpsSetData; - -/** - * @struct TimerToutMsg - * \~english timeout message - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific) - u_int16 Dummy; //!< \~english dummy -} TimerToutMsg; - -/** - * @struct TimerTimeReq - * \~english timer start request - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - PNO SndPno; //!< \~english process No.(claimant specific) - u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific) - u_int8 TimeType; //!< \~english timer type - u_int8 Dummy[3]; //!< \~english dummy data - TimerDupData DupData; //!< \~english timeout value -} TimerTimeReq; - -/** - * @struct TimerAlrmReq - * \~english time specified timer start request - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - PNO SndPno; //!< \~english process No.(claimant specific) - u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific) - u_int8 TimeHou; //!< \~english specific timeout hour - u_int8 TimeMin; //!< \~english min - u_int8 TimeSec; //!< \~english sec - u_int8 Dummy; //!< \~english dummy -} TimerAlrmReq; - -/** - * @struct TimerStopReq - * \~english timer stop request - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - PNO SndPno; //!< \~english process No.(claimant specific) - u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific) - u_int8 TimeType; //!< \~english timer type - u_int8 Dummy[3]; //!< \~english dummy data -} TimerStopReq; - -/** - * @struct GpsSetTimeReq - * \~english GPS RTC time set request - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - PNO SndPno; //!< \~english process No.(claimant specific) - u_int8 Dummy1; //!< \~english dummy data - u_int8 Dummy2; //!< \~english dummy data - GpsSetData SetData; //!< \~english GPS setting data -} GpsSetTimeReq; - -/** - * @struct GpsSetTimeReq - * \~english time difference set request - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - int8 DiffTime; //!< \~english time difference value - int8 Dummy1; //!< \~english dummy data - int16 Dummy2; //!< \~english dummy data -} SetDiffTimeReq; - - -/** - * @struct T_TIM_RCV_DATA - * \~english command notify information structure - */ -typedef struct { - PNO SndPno; //!< \~english command delivery PNO - u_int8 ucAlmanc_Flg; - //!< \~english almanac abnormal judgement notify complete flag - u_int8 ucInvalid_Flg; - //!< \~english time acquisition notify complete flag -} T_TIM_RCV_DATA; - -/** - * @struct TimerSramData - * \~english timer SRAM data structure - */ -typedef struct { - u_int32 navitime; //!< \~english Navi operation addition time - int8 _difftime; //!< \~english time difference value of current time - int8 timeUnit; //!< \~english specific time manager unit - int8 dummy[2]; //!< \~english dummy data - T_TIM_RCV_DATA timCmdData[TIM_NUM_SNDCMD]; - //!< \~english command receive information -} TimerSramData; - -/** - * @struct SysTimeData - * \~english system time data - */ -typedef struct { - u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex. 0x1998) - u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12) - u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31) - u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23) - u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59) - u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59) - u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06) -} SysTimeData; - -/** - * @struct YearCntTbl - * \~english year convert table - */ -typedef struct TimeCnvTbl_tag { - uint32_t ulYear; //!< \~english year - uint32_t ulCount; //!< \~english count - uint32_t ulMonth[12]; //!< \~english month -} YearCntTbl; - -/** - * @struct DayCntTbl - * \~english day convert table - */ -typedef struct DayCnvTbl_tag { - YearCntTbl stTbl[CNV_YEAR_MAX]; //!< \~english year convert table -} DayCntTbl; - -/** - * @struct TG_TIM_ROLOVR_GPSWEEKCORDATA - * \~english GPS week correction data - */ -typedef struct { - u_int8 gpsweekcorcnt; //!< \~english GPS week rollover correct count - u_int8 permission; //!< \~english GPS week rollover correct permission - u_int8 dummy[2]; //!< \~english dummy data -} TG_TIM_ROLOVR_GPSWEEKCORDATA; - -/** - * @struct TIMECHGIND_MSG - * \~english time change information message structure - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - RealTimeData RealTime; //!< \~english data body(current time data) -} TIMECHGIND_MSG; - -/** - * @struct T_TIM_CMDMSG - * \~english time available notification/almanac abnormality notification structure - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header -} T_TIM_CMDMSG; - -/** - * @struct T_TIM_RETTIMEMSG - * \~english time setting response message - */ -typedef struct { - T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header - int8 cResult; //!< \~english process result - int8 dummy[2]; //!< \~english dummy data -} T_TIM_RETTIMEMSG; - -/** - * @struct TimerModDat - * \~english current time data module structure - */ -typedef struct { - u_int32 InitFlg; //!< \~english initialization complete flag - u_int8 CrtFlg; //!< \~english corrected/not corrected flag - u_int8 CrtHou; //!< \~english the last correction: hour - u_int8 CrtMin; //!< \~english min - u_int8 CrtSec; //!< \~english sec -} TimerModDat; - -/** @}*/ // end of positioning_base_library -/** @}*/ // end of vehicle_service -/** @}*/ // end of BaseSystem -#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_ - diff --git a/vehicleservice/positioning_base_library/library/libPOS_base_API.ver b/vehicleservice/positioning_base_library/library/libPOS_base_API.ver deleted file mode 100755 index 019a271..0000000 --- a/vehicleservice/positioning_base_library/library/libPOS_base_API.ver +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -# -# libPOS_base_API version script -# -{ - global: - _pb_*; - *MemoryTerm*; - *ErrTrapTerm*; - *MsgTerm*; - *EventTerm*; - *MutexTerm*; - *SemaphoreTerm*; - *ErrTrapInit*; - *MsgInit*; - *EventInit*; - *MemoryInit*; - *SemaphoreInit*; - *MutexInit*; - local: - *; -}; - - diff --git a/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp b/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp deleted file mode 100755 index 66e78ae..0000000 --- a/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * MsgBapi.cpp - * @brief system common functions - */ - -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ -#include - -#include -#include -#include -#include "_pbInternalProc.h" -#include "WPF_STD_private.h" - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Create Shared Memory - * - * Create a file mapping object with the specified shared memory name and size, then
- * maps it to the invoking process space. If the shared memory that has already been
- * created is specified, an error is returned.
- * The shared memory management information allocates a heap area each time it is
- * created, and return this address as a shared memory handle. - * - * @param[in] TCHAR* name - * @param[in] DWORD size - * - * @return HANDLE
- * Except NULL Handle of the created shared memory(Management information pointer)
- * NULL ABEND - */ -HANDLE CreateSharedMemory(TCHAR* name, DWORD size) { - int32 lret = EOK; - RET_API ret_api = RET_ERROR; - int32 fd = POSITIONINGBASELIBRARY_NON_FD; - SHARED_MEMORY* p_shm = NULL; - char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY; - - if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0 - /* Allocate the shared memory management information area in the heap. */ - p_shm = reinterpret_cast(malloc(sizeof(SHARED_MEMORY))); - if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case - } else { - p_shm->h_heap = NULL; - p_shm->phy_addr = 0; - p_shm->h_map = NULL; - p_shm->size = size; - - /* Create directory */ - (void)mkdir(SHARED_MEMORY_DIRECTORY, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); - - /* Create shared memory with the specified size and name.(Error if it already exists) */ - (void)strncat(c_file_path, (const char*)name, 128); - fd = open(c_file_path, O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length) - if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ { // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length) - /* Set size */ - lret = ftruncate(fd, size); - if (lret == EOK) { // LCOV_EXCL_BR_LINE 5: ftruncate's error case - /* Map the created shared memory to the invoking process space. */ - p_shm->p_memory = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error - ret_api = RET_NORMAL; - } - } - } - } - } - - if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ { - close(fd); - } - - if (ret_api == RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - /* Indicate that it is the creator of the shared memory */ - p_shm->owner = TRUE; - } else { - // LCOV_EXCL_START 200: can not be not normal - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* In case of an error */ - if (fd != POSITIONINGBASELIBRARY_NON_FD) { - /* Delete shared memory object if created */ - shm_unlink(name); - } - - if (p_shm != NULL) { - free(p_shm); - } - - p_shm = NULL; - // LCOV_EXCL_STOP - } - - return (HANDLE)p_shm; -} - -/** - * @brief - * Open Shared Memory - * - * Create a file mapping object with the specified shared memory name and size,
- * then map it to the invoking process space. Since this is not shared memory
- * creation processing, an error is returned if it is not a file mapping object.
- * The shared memory management information allocates a heap area each time
- * it is created, and return this address as a shared memory handle. - * - * @param[in] TCHAR* name - * @param[in] DWORD size - * - * @return HANDLE
- * Except NULL Handle of the acquired shared memory(Management information pointer)
- * NULL ABEND - */ -HANDLE OpenSharedMemory(TCHAR* name, DWORD size) { - RET_API ret_api = RET_ERROR; - int32 fd = POSITIONINGBASELIBRARY_NON_FD; - SHARED_MEMORY* p_shm = NULL; - char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY; - - if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0 - /* Allocate the shared memory management information area in the heap. */ - p_shm = reinterpret_cast(malloc(sizeof(SHARED_MEMORY))); - if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case - } else { - p_shm->h_heap = NULL; - p_shm->phy_addr = 0; - p_shm->h_map = NULL; - p_shm->size = size; - - /* Open shared memory with the specified size and name(Error if not exists) */ - (void)strncat(c_file_path, (const char*)name, 128); - fd = open(c_file_path, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error - if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ { - /* Map open shared memory to invoking process space. */ - p_shm->p_memory = reinterpret_cast(mmap(0, size, PROT_READ | PROT_WRITE, \ - MAP_SHARED | POSITIONINGBASELIBRARY_MAP_NON_INIT, fd, 0)); - if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error - ret_api = RET_NORMAL; - } - } - } - } - - if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ { - close(fd); - } - - if (ret_api == RET_NORMAL) { - /* Indicate that the opener of the shared memory not the creator of it. */ - p_shm->owner = FALSE; - } else { - /* In case of an error */ - if (p_shm != NULL) { - free(p_shm); - } - - p_shm = NULL; - } - - return (HANDLE)p_shm; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DeleteAllSharedMemory() - * ABSTRACT : Delete all shared memory objects - * NOTE : Delete all shared memory objects - * : However, the heap area allocated at the time of shared memory creation or open is not released. - * ARGUMENT : None - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -DeleteAllSharedMemory(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - char* cwd = NULL; - char sz_cwd[PATH_MAX + 1] = {0}; - DIR* p_dir = NULL; - struct dirent* p_dir_ent = NULL; - - /* Get path of current directory */ - cwd = getcwd(sz_cwd, PATH_MAX + 1); - - if (cwd != NULL) { - /* Move to shared memory directory */ - lret = chdir(SHARED_MEMORY_DIRECTORY); - - if (lret == EOK) { - /* Open shared memory directory */ - p_dir = opendir(SHARED_MEMORY_DIRECTORY); - if (p_dir != NULL) { - for (;;) { - /* Get directory entry */ - p_dir_ent = readdir(p_dir); - if (p_dir_ent == NULL) { - break; - } - - if ((_pb_strcmp(p_dir_ent->d_name, ".") != 0) && - (_pb_strcmp(p_dir_ent->d_name, "..") != 0)) { - /* Delete shared memory objects */ - shm_unlink(p_dir_ent->d_name); - } - } - - /* Close shared memory directory */ - closedir(p_dir); - } - - /* Go to original directory */ - lret = chdir(cwd); - if (lret != EOK) /* Coverity CID: 18816 compliant */ { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "chdir ERROR [lret:%d]", lret); - } - } - } - - /* Delete shared memory directory */ - lret = rmdir(SHARED_MEMORY_DIRECTORY); - - return; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetSharedMemoryPtr() - * ABSTRACT : Shared memory start address acquisition processing - * NOTE : Return the start address of the shared memory that is allocated/mapped at the - * : time of shared memory creation or open - * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer) - * RETURN : void* Except NULL Pointer to the acquired shared memory - * : NULL ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void* -GetSharedMemoryPtr(HANDLE h_shm) { - void *p_vret = NULL; - SHARED_MEMORY *p_shm = reinterpret_cast(h_shm); - - if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ { // LCOV_EXCL_BR_LINE 200: p_shm can not be NULL // NOLINT(whitespace/line_length) - } else { - p_vret = p_shm->p_memory; - } - - return p_vret; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : CloseSharedMemory() - * ABSTRACT : Shared memory close processing - * NOTE : Close the shared memory that is allocated/mapped at the time of its creation or open - * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer) - * RETURN : NONE - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -CloseSharedMemory(HANDLE h_shm) { - SHARED_MEMORY* p_shm = reinterpret_cast(h_shm); - int32 lret = EOK; - - if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ { - } else if (p_shm->phy_addr != 0) /* If the physical memory area address is specified,(Currently never comes here) */ { - if (p_shm->p_memory != NULL) { - /* Release physical memory area */ - if (lret != EOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "_CWORD64_api.dll:%s:LINE %d\r\n munmap_device_memory ERROR In PbFreePhysicalMem\r\n", \ - LTEXT(__FILE__), __LINE__); - _pb_Exit(); /* System recovery processing(Exception execution) */ - } - } - } else { - /* Release the shared memory object mapped to invoking process space */ - if (p_shm->p_memory != NULL) { - lret = munmap(p_shm->p_memory, p_shm->size); - p_shm->p_memory = NULL; - } - - /* Release the shared memory management information allocated in the heap */ - free(p_shm); - } - - return; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DeleteSharedMemory() - * ABSTRACT : Shared memory object delete processing - * NOTE : Delete the shared memory object that is specified name - * ARGUMENT : TCHAR* name Pointer to the name of the shared memory to be deleted - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -DeleteSharedMemory(TCHAR* name) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - char* cwd = NULL; - char sz_cwd[PATH_MAX + 1] = {0}; - - if (name != NULL) { - /* Get path of current directory */ - cwd = getcwd(sz_cwd, PATH_MAX + 1); - - if (cwd != NULL) { - /* Move to shared memory directory */ - lret = chdir(SHARED_MEMORY_DIRECTORY); - - if (lret == EOK) { - /* Delete shared memory object */ - lret = shm_unlink(name); - - /* Go to original directory */ - lret = chdir(cwd); - } - } - } - - return; -} -// LCOV_EXCL_STOP - - -HANDLE -OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return NULL; -} -// LCOV_EXCL_STOP - diff --git a/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp b/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp deleted file mode 100755 index ed833fd..0000000 --- a/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _CWORD64_api.cpp - */ - -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include "tchar.h" -#include "WPF_STD_private.h" - - - -/*---------------------------------------------------------------------------------* - * Function Prototype * - *---------------------------------------------------------------------------------*/ -extern RET_API MutexInit(void); -extern RET_API SemaphoreInit(void); -extern RET_API MemoryInit(void); -extern RET_API EventInit(void); -extern RET_API MsgInit(void); -extern RET_API ErrTrapInit(void); -extern RET_API TimerInit(HANDLE h_app); -extern void MsgTerm(void); - -static void BaseCreateMutex(void); -static void BaseLockMutex(void); -static void BaseUnlockMutex(void); - -/*---------------------------------------------------------------------------------* - * Grobal Value * - *---------------------------------------------------------------------------------*/ -/** Handle for locking Base API setups */ -static HANDLE g_h_mtx = NULL; - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Setup Base API - * - * Perform the processing required to use the Base API.(Call per process) - * - * @param[in] h_app Application handle - * - * @return RET_NORMAL Normal completion - */ -RET_API _pb_Setup_CWORD64_API(HANDLE h_app) { // NOLINT(readability/nolint) API - RET_API result; - static int8 i = 0; - int32 ret; - - if (i != 0) { - /* If the process has already initialized */ - /* nop */ - } else { - /* Interprocess lock initialization(CLS) */ - ret = CL_LockProcessInit(); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockProcessInit ERROR!! [ret=%d]", ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - BaseCreateMutex(); /* Create Mutex */ - BaseLockMutex(); /* Get Mutex */ - - /* Recheck during getting Mutex */ - if (i == 0) { // LCOV_EXCL_BR_LINE 6: i can not be other value - /* Not initialized */ - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_pb_Setup_CWORD64_API Entered."); - - /* Mutex function initialization */ - result = MutexInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MutexInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal - } - - /* Semaphore function initialization */ - result = SemaphoreInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SemaphoreInit ERROR!! [result=%d]", \ - result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal - } - - /* Memory function initialization */ - result = MemoryInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MemoryInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal - } - - /* Event function initialization */ - result = EventInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "EventInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal - } - - /* Message function initialization */ - result = MsgInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal - } - - result = ErrTrapInit(); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ErrTrapInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal - } - - /* For Positioning processes */ - if (_tcscmp("Positioning", FrameworkunifiedGetAppName(h_app)) == 0) { // LCOV_EXCL_BR_LINE 200: can not be other value - /* Timer function initialization */ - result = TimerInit(h_app); - if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "TimerInit ERROR!! [result=%d]", result); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal - } - } - - i = 1; - } - - BaseUnlockMutex(); /* Release Mutex */ - } - - /* Set application handle */ - _pb_SetAppHandle(h_app); - - return RET_NORMAL; -} - -/** - * @brief - * Teardown Base API - * - * Base API termination processing (Call per process) - * - * @param[in] none - * - * @return none - */ -void _pb_Teardown_CWORD64_API(void) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Interprocess Lock Control(CLS) */ - - - /* - Resources cannot be released unless it is guaranteed that other processes do not call the Positioning API. - Even if the resource is not released at the time of termination, it will not lead to illegal operation such as memory leak. - Comment out release processing. - */ - - /* Mutex */ - /* Semaphore */ - /* Memory */ - /* Event */ - /* Message */ - - /* Timer */ - - return; -} -// LCOV_EXCL_STOP - - -/** - * @brief - * Create Mutex for Base API setups - */ -static void BaseCreateMutex(void) { - g_h_mtx = (HANDLE)CL_LockMap(LOCK_POS_MTX_1); // LCOV_EXCL_BR_LINE 4: nsfw error - if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Get Mutex for Base API setups - */ -static void BaseLockMutex(void) { - int32 ret; - - ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", \ - g_h_mtx, ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Release Mutex for Base API Setup - */ -static void BaseUnlockMutex(void) { - int32 ret; - - ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", \ - g_h_mtx, ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - diff --git a/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp b/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp deleted file mode 100755 index e144d6f..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/******************************************************************************* -* $Header:: $ -* $Revision:: $ -*******************************************************************************/ - -/**************************************************************************** - * File name :_pbCSection.cpp - * System name :GPF - * Subsystem name :_CWORD64_API Critical Section Function - * Title :Critical Section Function Definition File - ****************************************************************************/ - -#include -#include -#include -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : PbDeleteCriticalSection() -* ABSTRACT : Specify a critical section object that is not owned and free all resources used by that object. -* NOTE : -* ARGUMENT : LPCRITICAL_SECTION lp_critical_section -* RETURN : VOID defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - - if (lp_critical_section == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbDeleteCriticalSection\r\n", - LTEXT(__FILE__), __LINE__); - } else { - lret = pthread_mutex_destroy(lp_critical_section); - if (lret != EOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbDeleteCriticalSection\r\n", - LTEXT(__FILE__), __LINE__, lret); - } - } - - return; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : PbEnterCriticalSection() -* ABSTRACT : Wait to take ownership of the specified critical section object -* NOTE : -* ARGUMENT : LPCRITICAL_SECTION lp_critical_section -* RETURN : VOID defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - - if (lp_critical_section == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbEnterCriticalSection\r\n", - LTEXT(__FILE__), __LINE__); - } else { - lret = pthread_mutex_lock(lp_critical_section); - if (lret != EOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbEnterCriticalSection\r\n", - LTEXT(__FILE__), __LINE__, lret); - } - } - - return; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : PbInitializeCriticalSection -* ABSTRACT : Initialize the specified critical section object. -* NOTE : -* ARGUMENT : LPCRITICAL_SECTION lp_critical_section -* RETURN : VOID defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : PbLeaveCriticalSection -* ABSTRACT : Discard ownership of the specified critical section object. -* NOTE : -* ARGUMENT : LPCRITICAL_SECTION lp_critical_section -* RETURN : VOID defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section ) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - - if (lp_critical_section == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbLeaveCriticalSection\r\n", - LTEXT(__FILE__), __LINE__); - } else { - lret = pthread_mutex_unlock(lp_critical_section); - if (lret != EOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbLeaveCriticalSection\r\n", - LTEXT(__FILE__), __LINE__, lret); - } - } - - return; -} -// LCOV_EXCL_STOP - diff --git a/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp b/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp deleted file mode 100755 index 6bb4fb9..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp +++ /dev/null @@ -1,928 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbCommon.cpp - System name : 05 Integration Platform - Subsystem name : System wide functions - Title : System API _CWORD64_ configuration processes -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ -#include -#include -#include -#include -#include - -#include "_pbCommon.h" -#include "WPF_STD_private.h" -#include "sysup_addr.h" -#include "tchar.h" -#include "sysup.h" - -/* - Constants and data type definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define BLOCK_SIZE (1*1024*1024) -#define WDTC_REG_ADDR (0x13500000 | ADDR_P2) /* WDT clear register address */ -#define SUM_ZERO 0 -#define ALLOC_SIZE 0x00200000 -#define EXIST_CLEAR 0x434c4f4b /* Flag to indicate cleared Non-OS management area */ - -#define PRCM_BASE 0x48180000 -#define PRM_RSTCTRL 0xA0 - -#define RST_GLOBAL_COLD_SW (0x01 << 1) -#define RST_GLOBAL_WARM_SW (0x01 << 0) - -/* - Internal function prototype declarations -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -u_int32 RomCheck(u_int32 *start_addr, u_int32 check_size); -u_int32 RomCheckEx(u_int32 *start_addr, u_int32 check_size); -uint64_t AtoxLong(char* str, unsigned int ascii_size); -void XtoaLong(uint64_t x, char* str); -#ifdef PBCOM_CONFIGREAD -static RET_API SysGetConfigSize(FILE*, u_int32*); -static RET_API SysReadConfigInfo(FILE*, TCHAR*, TCHAR*, u_int32); -static int SysUniToInt(TCHAR*, u_int32); -#endif /* PBCOM_CONFIGREAD */ - -/* - External function prototype declarations -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - Global Variable Definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef PSL_USED -extern int g_n_api_set_id; /* ID variable for PSL registration */ -#endif // PSL_USED - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _CWORD64_NotOSAreaInit - * ABSTRACT : Initialization non-OS managed areas of _CWORD64_ - * NOTE : This function initializes the non-OS control areas of _CWORD64_. - * ARGUMENT : None - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_CWORD64_NotOSAreaInit(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#ifndef CEPC_EM /* If not emulated in CEPC */ - RET_API ret; - char *cp_addr = NULL; - u_int32 size; - u_int32 *p_clear_flag; /* Pointer for storing non-OS management area clear flag */ - LPVOID notos_topaddr; - - /* Link of shared memory area to store the non-OS management area clear flag */ - ret = _pb_LinkShareData(const_cast("NOTOS_DATA"), reinterpret_cast(&cp_addr), &size); - if (ret != RET_NORMAL) { - /* Create a shared memory area to store the non-OS management area clear flag */ - Memset64pSync(cp_addr, 0, sizeof(p_clear_flag)); /* NULL initialization process of acquisition area */ - } - - p_clear_flag = reinterpret_cast(cp_addr); - - /* Non-OS management area clear processing */ - /* Because an exception occurs when garbage data remains in the message pool at startup, - Clear the entire non-OS management area as 0 Only for the first time after startup. */ - if (*p_clear_flag != EXIST_CLEAR) { - /* Execute mapping to non-OS management area */ - ret = PbAccessPhysicalMem(TOP_ADDR_NOTOS, /* Start address non-OS management area for of the _CWORD64_ */ - ¬os_topaddr, /* Start address of the mapping */ - NOTOS_SISE, /* Area-size */ - 0); - - /* failed mapping */ - if (ret != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_msg.lib:%s:LINE %d\r\n PbAccessPhysicalMem ERROR In " \ - "_CWORD64_NotOSAreaInit ... ret[%d] \r\n", - LTEXT(__FILE__), __LINE__, ret); - _pb_Exit(); - } - - /* Non-OS management area clear processing */ - Memset64pSync(notos_topaddr, 0, NOTOS_SISE); - - /* Shared area release processing */ - ret = PbFreePhysicalMem(TOP_ADDR_NOTOS, /* Start address of the _CWORD64_ non-OS management area */ - notos_topaddr, /* Start address of the mapped area */ - NOTOS_SISE); /* Size */ - - if (ret != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_msg.lib:%s:LINE %d\r\n PbFreePhysicalMem ERROR " \ - "In_CWORD64_NotOSAreaInit ... ret[%d] \r\n", - LTEXT(__FILE__), __LINE__, ret); - _pb_Exit(); - } - - *p_clear_flag = EXIST_CLEAR; /* Set non-OS management area clear flag */ - } -#endif - - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _CWORD64_APIInit - * ABSTRACT : System initialization of _CWORD64_API - * NOTE : This function is called once from the initialization process - * : at system startup to perform the _CWORD64_API initialization process. - * ARGUMENT : u_int32 (*sighand)() Completion of signal handling within APIs if NULL - * : Otherwise calls this first when a signal is raised - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_CWORD64_APIInit(u_int32 (*sighand)()) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API RetSts = RET_ERROR; - - if (sighand == NULL) { - /* Parameter is set to an error other than NULL */ - RetSts = _pb_Setup_CWORD64_API(NULL); /* Execute initialization processing for normal processing */ - } - - return(RetSts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_GetPrgVer - * ABSTRACT : Get the program version - * NOTE : Get the program version of the mask ROM (BootLoader) and flash - * : ROM (NK-image) into specified buffers. - * : In hardware-independent CEPC emulation environment, return the following version, - * : otherwise always return RET_NORMAL as the return value. - * : mask_ver=0x0102 0304 0506 0708 - * : flash_ver1=0x0102 0304 0506 0708 - * : flash_ver2=0x0102 0304 0506 0708 - * : flash_ver3=0x0102 0304 0506 0708 - * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_GetPrgVer(T_SYS_PRGVER *pbuf) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_UpManage - * ABSTRACT : Boot management process - * NOTE : Set the startup identifier in the SDRAM startup identification table (SDRAM) - * : or TinyFugue area (FLASH) at the next startup. - * : Which one to set depends on the table type of the argument. - * : Soft reset is performed when reset is instructed by the parameter. - * : In hardware-independent CEPC emulation environment, return the RET_NORMAL as the return value without recording the startup identifier. - * ARGUMENT : u_int16 up_sts :Startup Identifier Value - * : int reset :Reset instruction - * : u_int8 table :Table Type - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_UpManage(u_int32 up_sts, int reset, u_int8 table) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Is reset instructed? */ - if ((reset == SYS_RESET) || (reset == SYS_ONLY_RESET)) { - PbReset(); /* Soft reset */ - } - - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_RomcheckMask - * ABSTRACT : Check the sum value of masked part - * NOTE : Check the sum value of the mask ROM (BOOTROM) - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL :Sum value normal - * REL_ERROR :Sum value error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_RomcheckMask(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_RomcheckApl - * ABSTRACT : Check sum value of APL part (NK image) - * NOTE : In hardware-independent CEPC emulations do nothing and return RET_NORMAL. - * ARGUMENT : - * RETURN : RET_API RET_NORMAL :Sum Value Normal - * REL_ERROR :Sum value error - * RET_OSERROR :AccessPhysicalMem error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_RomcheckApl(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbReset - * ABSTRACT : Hard reset processing - * NOTE : Manipulate the WDT control register to generate a hard reset - * : Hardware-independent CEPC emulations do nothing and return RET_NORMAL. - * ARGUMENT : void - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -PbReset(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - - /* Message log output processing */ - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " PbReset:%s:LINE %d\r\n #### HARD RESET !! ####\r\n", - LTEXT(__FILE__), __LINE__); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_GetDeviceInfo - * ABSTRACT : Getting device information - * NOTE : Gets device information into the specified buffer. - * : In hardware-independent CEPC emulations, the following device - * : information is returned permanently. The return value is always RET_NORMAL. - * : _CWORD31__no="8611052060010001" mci_no="CNCS0200A" date="200301011200" - * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_GetDeviceInfo(T_SYS_DEVINFO *pbuf) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_WriteDeviceInfo - * ABSTRACT : Write device key information - * NOTE : Write device key information to flash memory - * ARGUMENT : u_char *ucpData Start address of write data (256 bytes) - * RETURN : int32 VUP_SUCCESS Flash write complete - * : VUP_FAILED Flash write abend - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 -_pb_WriteDeviceInfo(u_char *ucpData) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_GetSramVer - * ABSTRACT : SRAM versioning process - * NOTE : Getting SRAM version - * : In hardware-independent CEPC emulations, return the following SRAM Version statically. - * : The return value is always RET_NORMAL. - * : SRAM Version=0x1112 1314 - * ARGUMENT : char *pbuf Destination buffer address - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -_pb_GetSramVer(char *pbuf) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_GetDisplayInfo - * ABSTRACT : Getting display information - * NOTE : Get the screen size (width and height) into the buffer of the DISPLAY_INFO structure - * ARGUMENT : DISPLAY_INFO *pSystemInfo Screen size acquisition destination buffer address - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define DISPLAYINFO_SUBKEY_SIZE 56 -#define DISPLAYINFO_VALNAME_SIZE 16 -#define DISPLAYINFO_VAL_SIZE 8 - -RET_API -_pb_GetDisplayInfo(DISPLAY_INFO *pSystemInfo) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#ifdef PBCOM_CONFIGREAD - FILE* fpConfigFile = NULL; /* Configuration file handle */ - TCHAR tcData[DISPLAYINFO_VAL_SIZE] = {0}; /* Data section read buffer */ - TCHAR tcDataName[DISPLAYINFO_VALNAME_SIZE] = {0}; /* Data information storage buffer */ - int iRet = PBCOM_API_NORMAL; /* API return value */ -#endif - int iHeight = 0; /* Screen height information */ - int iWidth = 0; /* Screen width information */ - RET_API Retapi = RET_NORMAL; /* Results of this Module process */ - - /************************************************************ - * Parameter check - ************************************************************/ - if (NULL == pSystemInfo) { - /* Parameter is set to error */ - Retapi = RET_ERRPARAM; - } - - /************************************************************ - * Set the information in the configuration file - ************************************************************/ -#ifdef PBCOM_CONFIGREAD - /************************************************************ - * Open configuration file - ************************************************************/ - if (RET_NORMAL == Retapi) { - fpConfigFile = fopen(PBCOM_CONFIGFILE, "r"); - if (NULL == fpConfigFile) { - /* Set error in as a result */ - Retapi = RET_ERROR; - } - } - - /************************************************************ - * Get screen width information from configuration file - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Buffer clear */ - memset(tcData, 0x00, sizeof(tcData)); - memset(tcDataName, 0x00, sizeof(tcDataName)); - - /* Data information setting */ - memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRWIDTH, strlen(PBCOM_CONFIG_INDEX_SCRWIDTH)); - - /************************************************************ - * Setting file information reading process - ************************************************************/ - Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData)); - - /************************************************************ - * Conversion process from character string (UNICODE) to numeric - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Conversion from string to numeric */ - iHeight = SysUniToInt(tcData, strlen(tcData)); - } - } - - /************************************************************ - * Get screen height information from setting file - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Buffer clear */ - memset(tcData, 0x00, sizeof(tcData)); - memset(tcDataName, 0x00, sizeof(tcDataName)); - - /* Data information setting */ - memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRHEIGHT, strlen(PBCOM_CONFIG_INDEX_SCRHEIGHT)); - - /************************************************************ - * Setting file information reading process - ************************************************************/ - Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData)); - - /************************************************************ - * Conversion process from character string (UNICODE) to numeric - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Conversion from string to numeric */ - iWidth = SysUniToInt(tcData, strlen(tcData)); - } - } - - /************************************************************ - * Configuration file close - ************************************************************/ - /* Executed only when the open is successful. */ - if (NULL != fpConfigFile) { - iRet = fclose(fpConfigFile); - if (PBCOM_API_NORMAL != iRet) { - Retapi = RET_ERROR; - } - } - - /************************************************************ - * Direct value setting - ************************************************************/ -#else - iHeight = 480; - iWidth = 800; -#endif - /************************************************************ - * Display information setting - ************************************************************/ - - if (RET_NORMAL == Retapi) { - /* Coverity CID: 18756 compliant */ - pSystemInfo->i_height_size = iHeight; - pSystemInfo->i_width_size = iWidth; - } /* Coverity CID: 18756 compliant */ - - return Retapi; -} -// LCOV_EXCL_STOP - -/****************************************************************************** -* MODULE : RomCheck -* ABSTRACT : Calculate sum value within range of address specified by argument -* FUNCTION : u_int32 RomCheck() -* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated -* u_int32 check_size Size for which the sum is to be calculated -* NOTE : -* RETURN : u_int32 sum Sum value -******************************************************************************/ -u_int32 -RomCheck(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - u_int32 *addr_tmp; - u_int32 *end_addr; - u_int32 sum; - - end_addr = start_addr + check_size / sizeof(u_int32); - addr_tmp = start_addr; - - for (sum = 0; addr_tmp < end_addr;) { - sum += *(addr_tmp++); - } - return(sum); -} -// LCOV_EXCL_STOP - -/****************************************************************************** -* MODULE : RomCheckEx -* ABSTRACT : Calculate sum value in range of address on ROM specified by argument -* FUNCTION : u_int32 RomCheckEx() -* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated -* u_int32 check_size Size for which the sum is to be calculated -* NOTE : For single operation(For a one-bank configuration). APIs provided by FROM management -* are used because FROM management must be exclusively controled. -* The sum calculation unit is assumed to be the sector size of FlashROM. -* RETURN : u_int32 sum Sum value -* When this function terminates with an error, "RET_ERROR" is returned. -******************************************************************************/ -u_int32 -RomCheckEx(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(0); -} -// LCOV_EXCL_STOP - -/******************************************************************************* - * MODULE : AtoxLong - * ABSTRACT : Convert ASCII to hex - * FUNCTION : Convert a ASCII string (up to 8 characters) to a uint64_t hexadecimal string - * NOTE : - * RETURN : uint64_t :Converted hexadecimal number (up to 8 digits) - * INPUT : char *str -------------------- Pointer to a source ASCII string - * unsigned int ascii_size ------ Number of characters in source ASCII string - * OUTPUT : - ******************************************************************************/ -uint64_t AtoxLong(char* str, unsigned int ascii_size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - uint64_t x = 0; /* Return value */ - unsigned int i; /* For work */ - unsigned int tmp; /* For work */ - - /* Check that the specified ASCII number of characters does not exceed the number of digits represented by int64_t (8 hexadecimal digits). */ - if (ascii_size > (sizeof(x)) * 2) { - ascii_size = static_cast(sizeof(x) * 2); - } - /* Convert one character at a time to hexadecimal */ - for (i = 0; i < ascii_size; i++) { - /* Is a number? */ - tmp = *str - '0'; - if (tmp > 9) { - /* Coverity CID: 18790 compliant */ - /* a-f? */ - tmp = *str - 'a' + 10; - if ((tmp < 0x0a) || (tmp > 0x0f)) { - /* A to F ? */ - tmp = *str - 'A' + 10; - if ((tmp < 0x0a) || (tmp > 0x0f)) { - /* Stop when a non-hexadecimal value is found */ - break; - } - } - } - - /* Increase the digit */ - x <<= 4; - /* Add to the bottom digit */ - x |= tmp; - str++; - } - - return x; -} -// LCOV_EXCL_STOP - -/******************************************************************************* - * MODULE : XtoaLong - * ABSTRACT : Convert HEX to ASCII - * FUNCTION : This function converts the 8-digit hexadecimal number from str[0] to the ASCII code and stores the code. - * NOTE : The string to be passed as *str must be at least 8 characters in length. * RETURN : - * INPUT : uint64_t x ------------ Source hexadecimal number - * OUTPUT : char* str ------------------ Converted ASCII Strings (8 Characters) - ******************************************************************************/ -void XtoaLong(uint64_t x, char* str) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int i; /* For looping */ - int size; /* For looping */ - char tmp; /* Conversion temporary buffer */ - - /* Maximum number of loops (for character string) */ - size = static_cast(sizeof(int64_t) * 2); - /* Convert eight digits */ - for (i = 0; i < size; i++) { - tmp = static_cast((x >> ((size - i - 1) * 4)) & 0x0F); - - /* For 0xA to 0xF */ - if (tmp > 0x09) { - str[i] = static_cast('A' + tmp - 0x0A); - } else { - str[i] = static_cast('0' + tmp); - } - } -} -// LCOV_EXCL_STOP - -/****************************************************************************** -* MODULE : _pb_SendSystemError -* ABSTRACT : System error notification -* FUNCTION : Notify the system error and reset the software. -* ARGUMENT : PNO pno Error process No. -* int32 errcode Error code -* NOTE : _pb_SndMsg : Send message (System API) -* _sys_GetPno : PNO to be gotten -* RETURN : RET_API defined -******************************************************************************/ -RET_API _pb_SendSystemError(PNO pno, int32 errcode) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - T_SYS_SYSTEMERROR msg; /* Message */ - register T_APIMSG_HEADER *hdr; /* Message header */ - RET_API api_ret; - - /* Message Header Settings */ - hdr = &(msg.bhead.hdr); - - msg.bhead.signo = 0; /* Extension member */ - hdr->sndpno = 0; /* Source Process No. */ - hdr->respno = 0; /* Response destination process No.(None) */ - hdr->cid = CID_INI_SYSTEMERR; /* Command ID */ - hdr->msgbodysize = static_cast(sizeof(T_SYS_SYSTEMERROR) - sizeof(T_APIMSG_MSGBUF_HEADER)); - /* Main unit size */ - hdr->rid = 0; /* Resources ID (Dummy) */ - hdr->reserve = 0; - msg.pno = pno; /* Error process No. */ - msg.errcode = errcode; /* Error code */ - - /* Send Message */ - api_ret = _pb_SndMsg(PNO_GINI_MAIN, sizeof(msg), &msg, 0); - - return(api_ret); -} -// LCOV_EXCL_STOP - -/****************************************************************************** -* MODULE : _pb_GetVupFileName -* ABSTRACT : Getting the version upgrade file name -* FUNCTION : Get the path name and file name of the version upgrade. -* ARGUMENT : LPTSTR filename File name storage -* u_char media Container media -* NOTE : -* RETURN : RET_API defined -******************************************************************************/ -RET_API _pb_GetVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API api_ret = RET_NORMAL; /* API return value */ - T_SYS_PRGVER ver; /* Version Information */ - RET_API ret; /* Internal function return value */ - u_char kisyu; /* Storage of model code */ - - /* Get version */ - ret = _pb_GetPrgVer(&ver); - - if (ret == RET_NORMAL) { - /* Extract model code from version */ - kisyu = ver.mask_ver[3]; - - /* If the media is a disk */ - if (media == VUP_GETNAME_MEDIA_DISC) { - _stprintf(filename, _T("%s%s%s%02x%s"), - VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM); - } else { - /* Media is USB */ - _stprintf(filename, _T("%s%s%s%02x%s"), - VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM); - } - } else { - api_ret = RET_ERROR; - } - - return(api_ret); -} -// LCOV_EXCL_STOP - -/****************************************************************************** -* MODULE : _pb_GetForceVupFileName -* ABSTRACT : Getting the version upgrade file name -* FUNCTION : Get the path name and file name of the version upgrade. -* ARGUMENT : LPTSTR filename File name storage -* u_char media Container media -* NOTE : -* RETURN : RET_API defined -******************************************************************************/ -RET_API _pb_GetForceVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API api_ret = RET_NORMAL; /* API return value */ - - /* If the media is a disk */ - if (media == VUP_GETNAME_MEDIA_DISC) { - _stprintf(filename, _T("%s%s%s"), - VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP); - } else { - /* Media is USB */ - _stprintf(filename, _T("%s%s%s"), - VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP); - } - - return(api_ret); -} -// LCOV_EXCL_STOP - -#ifdef PBCOM_CONFIGREAD -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SysGetConfigSize - * ABSTRACT : Setting file size acquisition processing - * NOTE : Get file size. - * : When this Module is called, an area must be allocated at a higher level. - * : Parameter checking is not performed in this Module. - * ARGUMENT : FILE* fpFile(File handle) - * : int* piSize(File size storage area) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static RET_API -SysGetConfigSize(FILE* fpFile, u_int32* puiSize) { - int64_t lCurrentPos = 0; /* File current position */ - int64_t lEndPos = 0; /* End position of the file */ - int iRet = PBCOM_API_NORMAL; /* API processing result */ - RET_API Retapi = RET_NORMAL; /* Result of this Module process */ - - /************************************************************ - * Get current offset - ************************************************************/ - lCurrentPos = ftell(fpFile); - - /* If the return value is abnormal, the processing result is set to abnormal. */ - if (PBCOM_API_ERROR == lCurrentPos) { - Retapi = RET_ERROR; - } - - /************************************************************ - * Get end offset (size) - * -Set offset to end-of-file - * -Get end-of-file offset - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Set offset to end-of-file */ - iRet = fseek(fpFile, 0L, SEEK_END); - - /* If the return value is abnormal, the processing result is set to abnormal. */ - if (PBCOM_API_NORMAL != iRet) { - Retapi = RET_ERROR; - } - } - - if (RET_NORMAL == Retapi) { - /* Get end-of-file offset */ - lEndPos = ftell(fpFile); - - /* Set file size if the return value is normal */ - if (PBCOM_API_ERROR != lEndPos) { - *puiSize = (u_int32)lEndPos; - } else { - /* If the return value is abnormal, the processing result is set to abnormal. */ - Retapi = RET_ERROR; - } - } - - /************************************************************ - * Revert current offset - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Revert offset and complete processing */ - iRet = fseek(fpFile, lCurrentPos, SEEK_SET); - - /* If the return value is abnormal, the processing result is set to abnormal. */ - if (PBCOM_API_NORMAL != iRet) { - Retapi = RET_ERROR; - } - } - - return Retapi; -} -#endif /* PBCOM_CONFIGREAD */ - -#ifdef PBCOM_CONFIGREAD -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SysReadConfigInfo - * ABSTRACT : Setting file information reading process - * NOTE : Read the data associated with the specified data information from the configuration file. - * : When this module is called, an area must be allocated at a higher level. - * : Parameter checking is not performed in this module. - * ARGUMENT : FILE* fpConfig(File handle) - * : TCHAR* tcDataIndex(Data information) - * : TCHAR* tcDataBuf(Data read buffer) - * : int tcDataSize(Data read size) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static RET_API -SysReadConfigInfo(FILE* fpConfig, TCHAR* tcDataIndex, TCHAR* tcDataValue, u_int32 tcDataSize) { - TCHAR tcReadBuf[PBCOM_CONFIGSIZE_MAX] = {0}; /* Read buffer */ - u_int32 uiDataPos = 0; /* Data position */ - u_int32 uiCpyPos = 0; /* Copy position */ - u_int32 uiFileSize = 0; /* File size */ - u_int32 uiReadSize = 0; /* Data read size */ - u_int32 uiDataNum = 0; /* Number of read data */ - int iRet = 0; /* API processing result */ - RET_API Retapi = RET_NORMAL; /* Result of this Module process */ - - /************************************************************ - * Get setting file size - ************************************************************/ - /* Get setting file size */ - Retapi = SysGetConfigSize(fpConfig, &uiFileSize); - - /* When the setting file size is gotten successfully */ - if (RET_NORMAL == Retapi) { - /* The maximum size of the configuration file is greater than or equal to the maximum size of the configuration file. */ - if (uiFileSize > PBCOM_CONFIGSIZE_MAX) { - /* Set the maximum value of the configuration file as the size */ - uiFileSize = PBCOM_CONFIGSIZE_MAX; - } - } - - /************************************************************ - * Read setting file - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Read data count */ - uiDataNum = uiFileSize / sizeof(TCHAR); - - /* Set file pointer to the beginning of file */ - rewind(fpConfig); - - /* Read the data */ - uiReadSize = fread(tcReadBuf, sizeof(TCHAR), uiDataNum, fpConfig); - - /* When the data corresponding to the file size cannot be read */ - if (uiReadSize != uiFileSize) { - /* Set error in processing result */ - Retapi = RET_ERROR; - } - } - - /************************************************************ - * Data information search & retrieval - * -Find data information from the configuration file you read - * -Read associated data if data information can be found - ************************************************************/ - if (RET_NORMAL == Retapi) { - /* Set error to processing result (Set normal when search is normal) */ - Retapi = RET_ERROR; - - for (uiDataPos = 0; uiDataPos < uiDataNum; uiDataPos++) { - /* Determine file information */ - iRet = memcmp(&tcReadBuf[uiDataPos], tcDataIndex, strlen(tcDataIndex)); - - /************************************************************ - * If the applicable data information(Data information matched) - ************************************************************/ - if (0 == iRet) { - /* Move to data position (Move file information)*/ - uiDataPos += strlen(tcDataIndex) / sizeof(TCHAR); - - /* Set normal to processing result for data discovery */ - Retapi = RET_NORMAL; - - /************************************************************ - * Data read processing - * -Read data from the read data size - * -Assume that he end of the data has been reached when the following conditions are met - * NULL character code - * Line feed character code - * The data end of the configuration file is exceeded. - ************************************************************/ - for (uiCpyPos = 0; uiCpyPos < tcDataSize; uiCpyPos++) { - if (uiDataNum > uiDataPos) { - /* Coverity CID: 18781 compliant */ - /* If it is valid data */ - if ((PBCOM_UNICODE_NUL != tcReadBuf[uiDataPos]) && - (PBCOM_UNICODE_LF != tcReadBuf[uiDataPos])) { - /* Data setting*/ - tcDataValue[uiCpyPos] = tcReadBuf[uiDataPos]; - } else { - /* Exit from this loop */ - break; - } - } else { - /* When the end of data is reached */ - /* Exit from this loop */ - break; - } - /* Move the data position by the set amount */ - uiDataPos++; - } - /************************************************************ - * Completion of data information search - ************************************************************/ - break; - } else { - /************************************************************ - * Not applicable data information(Data information mismatch) - ************************************************************/ - /************************************************************ - * Move to next data information - * -Determine supine data if following condition is met - * Line feed character code - * -End processing when the end of file is reached - ************************************************************/ - while (uiDataPos < uiDataNum) { - /* Data determination */ - if (PBCOM_UNICODE_LF == tcReadBuf[uiDataPos]) { - /*Next Data Detection */ - break; - } - /* Move the data by the determined amount */ - uiDataPos++; - } - } - } - } - return Retapi; -} -#endif /* PBCOM_CONFIGREAD */ - -#ifdef PBCOM_CONFIGREAD -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SysUniToInt - * ABSTRACT : Converting from Unicode(string) to Int(number) - * NOTE : Convert from Unicode(string) to Int(number). - * : The number of characters that can be converted is defined in PBCOM_UTOIMAX_NUM. - * : When this module is called, an area must be allocated at a higher level. - * : Parameter checking is not performed in this module. - * ARGUMENT : TCHAR* tcData(Character string storage area) - * : int iDataSize(Character array size) - * RETURN : Number converted from character string - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static int SysUniToInt(TCHAR* tcData, u_int32 iDataSize) { - int iValue = 0; /* Converted value */ - u_int8 ucCount = 0; /* Character string data position */ - - /************************************************************ - * Parameter check - ************************************************************/ - if (PBCOM_UTOIMAX_NUM < iDataSize) { - iDataSize = PBCOM_UTOIMAX_NUM; - } - - /************************************************************ - * Conversion from string to number - ************************************************************/ - for (ucCount = 0; ucCount < iDataSize; ucCount++) { - /*If it is a number */ - if ((tcData[ucCount] >= '0') && - (tcData[ucCount] <= '9')) { - iValue = (iValue * 10) + (tcData[ucCount] - '0'); - } else { - /* If it is not a digit */ - /* End of data */ - break; - } - } - return iValue; -} -#endif /* PBCOM_CONFIGREAD */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : _sysCommon.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - diff --git a/vehicleservice/positioning_base_library/library/src/_pbDram.cpp b/vehicleservice/positioning_base_library/library/src/_pbDram.cpp deleted file mode 100755 index eb70131..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbDram.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbDram.cpp - System name : 05 Integration Platform - Subsystem name : System common functions - Title : System API -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - -#include -#include "WPF_STD_private.h" - -/* - Constants and structure definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define END 0xFFFFFFFF /* DRAM R/W check address table end flag */ -/* Definitions for CRC calculations */ -#define DIV_BYTE_DATA 0x000000FF -#define CRC_INIT 0x00000000 -#define DATA_L_SHIFTNUM 8 -#define DATA_R_SHIFTNUM 24 - -/* - Global Variable Definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -extern int g_n_api_set_id; /* ID variable for PSL registration */ - -/* -External function prototype declaration -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef __cplusplus -extern "C" { -#endif - BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect); -#ifdef __cplusplus -}; -#endif - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramWt - * ABSTRACT : DRAM self-refresh area write process - * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID. - * Perform CRC calculation and add it to the end of the area - * ARGUMENT : u_int8 id DRAM Area IDs - * void *pbuf Source buffer pointer - * u_int32 off Destination DRAM offsets(bytes) - * u_int16 size Transfer data size(bytes) - * RETURN : RET_API defineed -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret = PbDramWt32(id, pbuf, off, (u_int32)size); - return(ret); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbDramWt32 - * ABSTRACT : DRAM self-refresh area write process - * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID. - * Perform CRC calculation and add it to the end of the area - * ARGUMENT : u_int8 id DRAM Area IDs - * void *pbuf Source buffer pointer - * u_int32 off Destination DRAM offsets(bytes) - * u_int32 size Transfer data size(bytes) - * RETURN : RET_API defined - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramRd - * ABSTRACT : DRAM self-refresh area read process - * NOTE : Write the offsets of the area of the specified DRAM ID to buffer. - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int32 off Source DRAM Offsets(bytes) - * void *pbuf Destination buffer pointer - * u_int16 size Transfer data size(bytes) - * RETURN : RET_API definef - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramRd32 - * ABSTRACT : DRAM self-refresh area read process - * NOTE : Write the offsets of the area of the specified DRAM ID to buffer. - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int32 off Source DRAM Offset(bytes) - * void *pbuf Destination buffer pointer - * u_int32 size Transfer data size(bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramSz - * ABSTRACT : DRAM ID size acquisition processing - * NOTE : Get the effective area size of the specified DRAM ID. - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int16 *psize Size(bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramSz32 - * ABSTRACT : DRAM ID size acquisition processing - * NOTE : Get the effective area size of the specified DRAM ID. - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int32 *psize Size(bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramFilCrc - * ABSTRACT : DRAM memory-fill process (add CRC-value) - * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID. - * After filling, add result of the CRC calculation to the end of the region. - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int32 off Fill destination DRAM offset(bytes) - * u_int8 pat Fill pattern - * u_int16 size Fill size(bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramFilCrc(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramFil32Crc - * ABSTRACT : DRAM memory-fill process (CRC-value addition) - * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID. - * After filling, perform CRC calculation and add it to the end of the region - * ARGUMENT : u_int8 id DRAM Area IDs - * u_int32 off Fill destination DRAM offset(bytes) - * u_int8 pat Fill pattern - * u_int32 size Fill size(bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramFil32Crc(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramCrcChk - * ABSTRACT : DRAM self-refresh area CRC-check - * NOTE : Perform CRC calculation for the specified area and check whether the CRC value is normal. - * ARGUMENT : u_int8 id DRAM Area IDs - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramCrcChk(u_int8 id) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramRWChk - * ABSTRACT : DRAM read/write checking - * NOTE : Check whether DRAM can be read/written correctly - * ARGUMENT : None - * RETURN : RET_API define RET_NORMAL : Normal status - * RET_ERROR : In case of read/write error - * RET_OSERRER : Virtual area mapping error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramRWChk(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/******************************************************************************* - * MODULE : Crc - * ABSTRACT : Calculate sum of a given range - * FUNCTION : RET_API Crc(u_int32 start_addr,u_int32 size, u_int32 *sum); - * ARGUMENT : u_int32 start_addr Top address - * u_int32 size Size - * u_int32* sum Sum value storage - * NOTE : Calculate the 4 bytes sum of the size portion from start_addr and stores the result in sum. - * If start_addr and size are not 4-bytes boundaries, errors are returned. - * On error, -1 is stored in sum and returned. - * RETURN : RET_NORMAL Sum value calculation success - * RET_ERROR Sum value calculation failed - ******************************************************************************/ -RET_API -Crc(u_int32 start_addr, u_int32 size, u_int32 *sum) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DramDestroy - * ABSTRACT : SRAM alternative DRAM self-refresh area destruction process - * NOTE : The SRAM replacement DRAM self-refresh area is destroyed by adding 1 - * to the CRC value held by the area ID and destroying the CRC value. - * ARGUMENT : u_int8 id DRAM Area IDs - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DramDestroy(u_int8 id) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : CrcEx - * ABSTRACT : Calculate the sum of the CRC values in the given range and the CRC values passed in the arguments - * FUNCTION : RET_API CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc); - * ARGUMENT : u_int32 start_addr Top address - * u_int32 size Size - * u_int32* sum CRC value storage - * u_int32 addcrc CRC value to add - * NOTE : When the 4-bytes-CRC value for the size is calculated from start_addr, - * Add the CRC value passed in the fourth argument to sum, and store it in sum. - * Note:Because the address align is undefined, 1-byte calculation shall be performed. - * RETURN : RET_NORMAL Sum value calculation success - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - - - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : _pbDram.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ diff --git a/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp b/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp deleted file mode 100755 index 0912a13..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp +++ /dev/null @@ -1,1695 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbEvent.cpp - */ - -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ -#include -#include "_pbEvent_Internal.h" -#include "_pbInternalProc.h" -#include "WPF_STD_private.h" -#include "tchar.h" - -/*---------------------------------------------------------------------------------* - * Internal Function Prototype * - *---------------------------------------------------------------------------------*/ -static BOOL FindEventTable(PB_EVENT*, TCHAR*, u_int32*); -static BOOL AllocNewEventTable(PB_EVENT*, u_int32*); - -static void FreeEventTable(PB_EVENT* p_event_table, int index); -static RET_API SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lp_val); -static RET_API WaitProc(PB_EVENT_OPEN_HANDLE*, WAITING_CONDITION*, u_int32); -static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data); - -static EventID EventCreateNewEventInSystem(u_int8, int32, TCHAR*); -static EventID EventCreateNewEventInProcess(u_int32); - -static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE*, u_int32); -static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE*, u_int32, u_int32); - -static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE*); -static void EventLockMutex(PB_EVENT_OPEN_HANDLE*); -static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE*); -static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE*); - -void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* p_evt, uint8_t* p_indent); - -/*---------------------------------------------------------------------------------* - * Grobal Value * - *---------------------------------------------------------------------------------*/ -static PB_EVENT_INSTANCE g_instance; // NOLINT(readability/nolint) - -static uint8_t g_my_proc_cnt; /* Invoking process counter value */ - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Initializing Event-Related Processing - * - * Instantiate and initialize system API event related processing. - * Creates a flags in the CLS event library. - * - * @return RET_NORMAL Normal completion
- * RET_ERRINIT Initialization error - */ -RET_API EventInit(void) { - PB_EVENT_INSTANCE *p_inst = &g_instance; - PB_EVENT* p_event_table = NULL; - u_int32 ul_share_mem_size = 0; - RET_API ret_api = RET_ERROR; - char c_share_mem_name[32] = {0}; - char c_sem_name[32] = {0}; - void *pv_share_mem_addr = NULL; - int32 n; - RET_API l_ret_api; - - /* Create Mutex */ - _tcscpy(c_sem_name, "POS_BASE_EVENT_MUTEX"); - p_inst->id_event_table_sem = _pb_CreateSemaphore(c_sem_name); // LCOV_EXCL_BR_LINE 200: can not be 0 - if (p_inst->id_event_table_sem == 0) /* When mutex creation fails */ { // LCOV_EXCL_BR_LINE 200: can not be 0 - // LCOV_EXCL_START 200: can not be 0 - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "_pb_CreateSemaphore ERROR [name:%s]", c_sem_name); - _pb_Exit(); - // LCOV_EXCL_STOP - } - - l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Get event-control-table-locking Mutex */ - if (l_ret_api != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed"); - } - - /* Initialize table of handles. */ - for (n = 0; n < MAX_PB_EVENTS; n++) { - p_inst->p_handle_table[n] = NULL; - } - - /* Generate shared memory name */ - _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE"); - - /* Link to event information storage area */ - ret_api = _pb_LinkShareData(c_share_mem_name, &pv_share_mem_addr, &ul_share_mem_size); - if (ret_api != RET_NORMAL) /* When the link fails */ { - /* Generate shared memory */ - ret_api = _pb_CreateShareData(c_share_mem_name, - static_cast((sizeof(PB_EVENT) * MAX_PB_EVENTS)), &pv_share_mem_addr); - - /* Terminate processing when generating fails */ - if (ret_api != RET_NORMAL) { - ret_api = RET_ERRINIT; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* Event information storage area initialization processing */ - p_event_table = reinterpret_cast(pv_share_mem_addr); - for (n = 0; n < MAX_PB_EVENTS; n++) { - memset(reinterpret_cast(p_event_table[n].event_name), 0, \ - sizeof(p_event_table[n].event_name)); - p_event_table[n].l_event_val = 0; - for (int wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) { - p_event_table[n].st_condition[wcn].uc_use_flag = FALSE; /* Initialize to unused */ - p_event_table[n].st_condition[wcn].uc_waiting = FALSE; - p_event_table[n].st_condition[wcn].us_mode = 0; - p_event_table[n].st_condition[wcn].ul_mask = 0; /* Initialize Mask Value */ - p_event_table[n].st_condition[wcn].l_min_val = 0; - p_event_table[n].st_condition[wcn].l_max_val = 0; - /* Initialize event values at WaitEvent Returns */ - p_event_table[n].st_condition[wcn].l_last_val = 0; - p_event_table[n].st_condition[wcn].flag_id[p_event_table->proc_cnt] = 0; - } - - p_event_table[n].l_process_ref = 0; - p_event_table[n].l_reset_data = 0; - p_event_table[n].uc_manual_reset = _CWORD64_EVENT_MANUALRESET_OFF; - } - } - } else { - /* When the link is successful */ - p_event_table = reinterpret_cast(pv_share_mem_addr); - p_event_table->proc_cnt++; - } - - if (ret_api == RET_NORMAL) /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ { - g_my_proc_cnt = p_event_table->proc_cnt; - /* Get the address of the acquired event information storage area. */ - p_inst->h_shared_memory = (HANDLE)pv_share_mem_addr; - p_inst->p_event_table = reinterpret_cast(pv_share_mem_addr); - } - - _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch - - return ret_api; -} - -/** - * @brief - * Event-related instance destruction processing - * - * Delete a Flag from the CLS Event Library (Not implemented) - * - * @return RET_NORMAL Normal completion
- * RET_ERROR ABEND - */ -RET_API EventTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_INSTANCE *p_inst = &g_instance; - char c_share_mem_name[32] = {0}; - - RET_API ret_api = RET_NORMAL; - - /* TODO:Implement processing to delete event flags */ - - /* Generate shared memory name */ - _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE"); - - /* Discard the semaphore if it has already been created */ - if (p_inst->id_event_table_sem != 0) { - PbDeleteSemaphore(p_inst->id_event_table_sem); - p_inst->id_event_table_sem = 0; - } - - /* Discard the shared memory if it has already been created */ - if (p_inst->h_shared_memory != NULL) { - /* Release shared memory */ - PbDeleteShareData(c_share_mem_name); - p_inst->h_shared_memory = NULL; - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create the event - * - * Create an event with the specified name and returns the event ID.
- * If it has already been generated, the event ID is searched and returned. - * - * @param[in] uc_manual_reset - * @param[in] l_init_data - * @param[in] *cp_event_name Pointer to the names of the event to be generated (NULL termination string) - * - * @return Non-zero Generated event ID
- * 0 Event generation error - */ -EventID _pb_CreateEvent(u_int8 uc_manual_reset, int32 l_init_data, // NOLINT(readability/nolint) - char *cp_event_name) { // NOLINT(readability/nolint) - PB_EVENT_INSTANCE *p_inst = &g_instance; - EventID ret_event_id = 0; - TCHAR *p_event_name = NULL; - u_int32 index = 0; - BOOL bret = FALSE; - BOOL check_status = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - RET_API l_ret_api; - - /* Parameter check */ - if ((cp_event_name == NULL) || - (uc_manual_reset >= _CWORD64_EVENT_MANUALRESET_MAX)) { - check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - -#ifdef UNICODE - /* Event name character limit processing */ - if (strlen(cp_event_name) > MAX_EVENT_NAME_LEN) { - _pb_Exit(); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - TCHAR unicodeEventName[MAX_EVENT_NAME_LEN + 1]; /* Maxmum nunber of characters + NULL area */ - mbstowcs(unicodeEventName, cp_event_name, MAX_EVENT_NAME_LEN); - p_event_name = unicodeEventName; -#else - p_event_name = cp_event_name; -#endif // UNICODE - - if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - (p_event_name[0] == __TEXT('\0'))) { - check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* Event name character limit processing */ - if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - (_tcslen(p_event_name) < MAX_EVENT_NAME_LEN)) { - l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Mutex from here */ - if (l_ret_api != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed"); - } - - /* Search the event table by the specified event name */ - bret = FindEventTable(p_inst->p_event_table, p_event_name, &index); - /* If the same event already exists on the system */ - if (bret != FALSE) { - ret_event_id = EventCreateNewEventInProcess(index); // LCOV_EXCL_BR_LINE 200: no branch - } else { - /* When creating a new file */ - ret_event_id = EventCreateNewEventInSystem(uc_manual_reset, l_init_data, p_event_name); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - } - - _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch - } - - return ret_event_id; -} - -/** - * @brief - * Set the event - * - * Set the event value by specifying the event ID acquired when the event was created.
- * The event value setting modes are as follows.
- * SAPI_EVSET_ABSOLUTE : Absolute value setting(Specify the value to be set.)
- * SAPI_EVSET_RELATE : Relative value setting(Specifies the value relative to the current value.) - * - * @param[in] event_id Specify the event ID for which the event value is to be set. - * @param[in] l_set_mode Specify the event value setting mode - * @param[in] l_Val Specify the event value to be set - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Configuration mode error
- * RET_EV_NONE Specified event does not exist
- * RET_EV_MAX The set event value exceeds the maximum value
- * RET_EV_MIN The set event value is below the minimum value. - */ -RET_API _pb_SetEvent(EventID event_id, int32 l_set_mode, int32 l_val) { // NOLINT(readability/nolint) - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - RET_API ret_sts = RET_EV_NONE; - int32 l_work_val = 0; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if (ul_index < MAX_PB_EVENTS) { - /* If the specified event ID value is within range */ - p_event_open = p_inst->p_handle_table[ul_index]; - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - /* Determine the event setting mode and call the event value setting function. */ - if (l_set_mode == SAPI_EVSET_ABSOLUTE) { - ret_sts = SetProc(p_event_open, EVSET_ABSOLUTE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - } else if (l_set_mode == SAPI_EVSET_RELATE) { - ret_sts = SetProc(p_event_open, EVSET_RELATE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch - } else { - ret_sts = RET_ERRPARAM; - } - } - } - - return ret_sts; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SetandEvent() - * ABSTRACT : Event value AND setting process - * NOTE : Set the logical AND result of the specified mask value to the event value of the specified event ID. - * ARGUMENT : EventID event_id Specify the event ID to wait for an event - * : u_int32 ul_mask Mask value to be logically ANDed with the event value - * : int32* pl_val Pointer to the area to store the pre-event value - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE Specified event does not exist - * : RET_ERROR - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SetandEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if ((ul_index < MAX_PB_EVENTS) && - (pl_val != NULL)) { - /* If the specified event ID value is within range */ - p_event_open = p_inst->p_handle_table[ul_index]; - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - ret_sts = SetProc(p_event_open, EVSET_AND, static_cast(ul_mask), pl_val); - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SetorEvent() - * ABSTRACT : Event value OR setting process - * NOTE : Set the logical OR result of the specified mask value and the event value of the specified event ID. - * ARGUMENT : EventID event_id Specify the event ID to wait for an event. - * : u_int32 ul_mask Mask value to be logically ANDed with the event value - * : int32* pl_val Pointer to the area to store the pre-event value - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE Specified event does not exist - * : RET_ERROR - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SetorEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if ((ul_index < MAX_PB_EVENTS) && - (pl_val != NULL)) { - /* If the specified event ID value is within range */ - p_event_open = p_inst->p_handle_table[ul_index]; - - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - ret_sts = SetProc(p_event_open, EVSET_OR, static_cast(ul_mask), pl_val); - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Wait for the event - * - * Wait until the event value of the specified event ID reaches the specified range. - * - * @param[in] event_id Specify the event ID for which the event value is to be set. - * @param[in] l_wait_mode Monitoring mode of event * Current only SAPI_EVWAIT_VAL is allowed - * @param[in] l_min_val Minimum Event Wait - * @param[in] l_max_val Maximum value waiting for an event - * @param[in] *pl_event_val Pointer to the event value storage area after waiting for an event - * @param[in] ul_mill_sec_time Timeout period(ms) - * -_ * @return RET_NORMAL Normal completion
- * RET_EV_NONE Specified event does not exist
- * RET_ERROR Other errors - */ -RET_API _pb_WaitEvent(EventID event_id, int32 l_wait_mode, int32 l_min_val, // NOLINT(readability/nolint) - int32 l_max_val, int32* pl_event_val, u_int32 ul_mill_sec_time) { // NOLINT(readability/nolint) - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - WAITING_CONDITION st_condition = {0}; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if ((pl_event_val != NULL) && - (ul_index < MAX_PB_EVENTS)) { - p_event_open = p_inst->p_handle_table[ul_index]; - - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - /* Set Wait Mode and Mask Value to Parameter Blk */ - st_condition.us_mode = EVWAIT_VAL; - st_condition.l_min_val = l_min_val; - st_condition.l_max_val = l_max_val; - - /* Call the event wait processing */ - ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time); // LCOV_EXCL_BR_LINE 200: no branch - if (ret_sts == RET_NORMAL) { - *pl_event_val = st_condition.l_last_val; - } - } - } - - return ret_sts; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : WaitallclrEvent() - * ABSTRACT : Event Bit Clear Wait - * NOTE : Wait until all the bits specified by the mask value are cleared - * : for the event value of the specified event ID. - * ARGUMENT : EventID event_id Specifies the event ID to wait for an event. - * : u_int32 ul_mask Mask value waiting for an event (Bit pattern) - * : int32* pl_val Pointer to the event value storage area after waiting for an event - * : u_itn32 ul_mill_sec_time Timeout period(ms) - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE Specified event does not exist - * : RET_ERROR Maximum number of waiting threads exceeded - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -WaitallclrEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - WAITING_CONDITION st_condition = {0}; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = static_cast(event_id) - 1; - - /* Parameter check */ - if ((pl_val != NULL) && - (ul_index < MAX_PB_EVENTS)) { - p_event_open = p_inst->p_handle_table[ul_index]; - - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - /* Set Wait Mode and Mask Value to Parameter Blk */ - st_condition.us_mode = EVWAIT_ALLCLR; - st_condition.ul_mask = ul_mask; - - /* Call the event wait processing */ - ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time); - if (ret_sts == RET_NORMAL) { - *pl_val = st_condition.l_last_val; - } - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : WaitanysetEvent() - * ABSTRACT : Event Bit Set Waiting Process - * NOTE : Wait until one of the bits specified by the mask value is set - * : for the event value of the specified event ID. - * ARGUMENT : EventID event_id Specify the event ID to wait for an event. - * : u_int32 ul_mask Mask value waiting for an event - * : int32* ipVal Pointer to the event value storage area after waiting for an event - * : u_itn32 ul_mill_sec_time Timeout period(ms) - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE Specified event does not exist - * : RET_ERROR When the maximum number of waiting events is exceeded - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -WaitanysetEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - WAITING_CONDITION st_condition = {0}; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if ((pl_val != NULL) && - (ul_index < MAX_PB_EVENTS)) { - p_event_open = p_inst->p_handle_table[ul_index]; - - /* If the specified event ID is registered in the table, */ - if (p_event_open != NULL) { - /* Set Wait Mode and Mask Value to Parameter Blk */ - st_condition.us_mode = EVWAIT_ANYSET; - st_condition.ul_mask = ul_mask; - - /* Call the event wait processing */ - ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time); - if (ret_sts == RET_NORMAL) { - *pl_val = st_condition.l_last_val; - } - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : LookupEvent() - * ABSTRACT : Event value reading process - * NOTE : Read the event value of the specified event ID. - * ARGUMENT : EventID event_id Specify the event ID to read the event value from. - * : int32 *iEventVal Pointer to the read event value storage area - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE Specified event does not exist - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -LookupEvent(EventID event_id, int32* pl_event_val) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - u_int32 ul_index = (u_int32)event_id - 1; - RET_API ret_sts = RET_EV_NONE; - - /* Parameter check */ - if ((pl_event_val != NULL) && - (ul_index < MAX_PB_EVENTS)) { - p_event_open = p_inst->p_handle_table[ul_index]; - - /* When the specified event ID is already registered in the table */ - if (p_event_open != NULL) { - EventLockMutex(p_event_open); - /* Store the current event value. */ - *pl_event_val = static_cast(p_event_open->p_sys_event->l_event_val); - EventUnlockMutex(p_event_open); - ret_sts = RET_NORMAL; - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Delete the event - * - * Delete the event with the specified event ID. - * - * @param[in] event_id Specify the event ID for which the event value is to be set. - * - * @return RET_NORMAL Normal completion
- * RET_EV_NONE Specified event does not exist - */ -RET_API _pb_DeleteEvent(EventID event_id) { // NOLINT(readability/nolint) - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - RET_API ret_api = RET_EV_NONE; - u_int32 index = static_cast(event_id) - 1; - EV_ERR ev_err; - RET_API l_ret_api; - - /* Parameter check */ - if (index < MAX_PB_EVENTS) { - p_event_open = p_inst->p_handle_table[index]; - /* When the specified event ID is registered in the table */ - if (p_event_open != NULL) { - ret_api = RET_NORMAL; - } - } - - /* Parameter normal */ - if (ret_api == RET_NORMAL) { - l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); - if (l_ret_api != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed"); - } - - /* When no one references in the same process */ - if ((p_event_open->l_thread_ref - 1) <= 0) { - /* Delete event flag */ - ev_err = EV_destroy_flag(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]); - /* When initialization fails */ - if (ev_err == EV_OK) { - p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt] = 0; - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "EV_destroy_flag ERROR!! [ev_err=%d, flag_id=0x%x]", \ - ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]); - - ret_api = RET_ERROR; - } - } - - /* When the event flag is deleted successfully */ - if (ret_api == RET_NORMAL) { - /* Reduce the number of event references in the same process */ - p_event_open->l_thread_ref--; - - /* When no one references in the same process */ - if (p_event_open->l_thread_ref <= 0) { - /* Reduce the number of event references in the system */ - p_event_open->p_sys_event->l_process_ref--; - } - - /* When no one references in the system */ - if (p_event_open->p_sys_event->l_process_ref <= 0) { - /* Initialization of the target area */ - FreeEventTable(p_inst->p_event_table, index); - } - - /* If no one references in the same process, release the resource here */ - if (p_event_open->l_thread_ref <= 0) { - /* Exclusive deletion for the target event */ - EventDeleteMutex(p_event_open); - - /* Open the heap area storing the target event. */ - /* */ - PbProcessHeapFree(0, p_inst->p_handle_table[index]); - p_inst->p_handle_table[index] = NULL; - } - } - - _pb_SemUnlock(p_inst->id_event_table_sem); - } - - return ret_api; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : ResetEvent() - * ABSTRACT : Event Clear - * NOTE : Specified event clear processing - * ARGUMENT : EventID event_id Event ID to reset - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_EV_NONE ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -ResetEvent(EventID event_id) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - RET_API ret_sts = RET_EV_NONE; - u_int32 ul_index = (u_int32)event_id - 1; - - /* Parameter check */ - if (ul_index < MAX_PB_EVENTS) { - p_event_open = p_inst->p_handle_table[ul_index]; - - /* When the specified event ID is already registered in the table */ - if (p_event_open != NULL) { - EventLockMutex(p_event_open); - - /* Clear the event value */ - p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data; - - EventUnlockMutex(p_event_open); - ret_sts = RET_NORMAL; - } - } - - return ret_sts; -} -// LCOV_EXCL_STOP - -/* Private functions. */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SetProc() - * ABSTRACT : General Event Configuration Processing - * NOTE : Sets the event according to the specified event setting method. - * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to manage event waiting for the event TBL - * : int32 i_mode Event setting method - * : int32 iVal Event setting value - * : int32* ipVal Pointer to the area to store the pre-event value - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_ERROR - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static RET_API -SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lpVal) { - RET_API ret_sts = RET_NORMAL; - int32 lTempEventData = 0; - int32 lTestValue = 0; - BOOL bCastCondFlag = FALSE; - - EventLockMutex(p_event_open); - - /* Get current event value */ - lTempEventData = p_event_open->p_sys_event->l_event_val; - *lpVal = p_event_open->p_sys_event->l_event_val; /* Set the value before the event operation */ - - /* Switch Processing by event configuration mode */ - switch (i_mode) { // LCOV_EXCL_BR_LINE 200:only the first two cases will be called - case EVSET_ABSOLUTE: /* In absolute mode */ { - /* Updating event values with specified values */ - lTempEventData = l_val; - break; - } - case EVSET_RELATE: /* In relative setting mode */ { - lTestValue = lTempEventData + l_val; - /* Exceeding representable event value */ - if ((l_val > 0) && (lTempEventData > lTestValue)) { - ret_sts = RET_EV_MAX; - } - /* Below representable event value */ - if ((l_val < 0) && (lTempEventData < lTestValue)) { - ret_sts = RET_EV_MIN; - } - /* Normal range */ - if (ret_sts == RET_NORMAL) { - /* Add specified value to event value */ - lTempEventData += l_val; - } - break; - } - case EVSET_AND: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value - // LCOV_EXCL_START 200: i_mode cannot be this value - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lTempEventData &= ((u_int32)l_val); /* Logical AND of the event value and the specified value */ - break; - // LCOV_EXCL_STOP - } - case EVSET_OR: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value - // LCOV_EXCL_START 200: i_mode cannot be this value - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lTempEventData |= ((u_int32)l_val); /* Logical AND of the event value and the specified value */ - break; - // LCOV_EXCL_STOP - } - default: /* Event setting mode error */ // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_sts = RET_ERRPARAM; // LCOV_EXCL_LINE 200: i_mode cannot be this value - } - - /* When the manual reset function is enabled */ - - if (ret_sts == RET_NORMAL) { - /* When the manual reset function is enabled */ - if (p_event_open->p_sys_event->uc_manual_reset == _CWORD64_EVENT_MANUALRESET_ON) { - /* Set event value */ - p_event_open->p_sys_event->l_event_val = lTempEventData; - } - - /* Loop for the maximum number of waiting threads per event and check the condition of event wait processing of the state TBL. */ - for (DWORD wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) { - /* If the event wait flag is waiting, */ - if (p_event_open->p_sys_event->st_condition[wcn].uc_waiting == TRUE) { - /* Check if event wait conditions are met */ - BOOL bret = CheckCondition(p_event_open->p_sys_event, wcn, lTempEventData); - /* If the event wait conditions are met, */ - if (bret == TRUE) { - bCastCondFlag = TRUE; - /* Save the event value at the time of SetEvent issuance (at the time of WaitEvent return). */ - p_event_open->p_sys_event->st_condition[wcn].l_last_val = lTempEventData; - - /* Processing to prevent concurrent SetEvent from more than one threads for a single event which is in WAIT state */ - /* Set WAIT status to wait-canceled */ - p_event_open->p_sys_event->st_condition[wcn].uc_waiting = FALSE; - /* Setting the default min value for event */ - p_event_open->p_sys_event->st_condition[wcn].l_min_val = MIN_EVENT_VAL; - /* Setting the default max event */ - p_event_open->p_sys_event->st_condition[wcn].l_max_val = MAX_EVENT_VAL; - - /* Signal issuance */ - (void)EventSendSignal(p_event_open, static_cast(wcn)); - } - } - } - - /* When the manual reset function is disabled */ - if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) { - /* If no one has issued the event */ - if (bCastCondFlag == FALSE) { - /* Set event value */ - p_event_open->p_sys_event->l_event_val = lTempEventData; - } else { - /* If issued event */ - /* Reset event value */ - p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data; - } - } - } - - EventUnlockMutex(p_event_open); - - return ret_sts; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : WaitProc() - * ABSTRACT : Generic Event Wait Processing - * NOTE : Wait for an event according to the wait queue of the specified event. - * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to TBL which is managed waiting for events - * : WAITING_CONDITION* st_condition Pointer to the event wait condition setting parameter - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_ERROR The maximum number of waits has been exceeded, or a parameter error has occurred. - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static RET_API -WaitProc(PB_EVENT_OPEN_HANDLE* p_event_open, WAITING_CONDITION* st_condition, u_int32 ul_mill_sec_time) { - RET_API ret_sts = RET_ERROR; - u_int32 ul_wcn = 0; - - /* Get semaphore for event table */ - EventLockMutex(p_event_open); - - /* Loop for the maximum number of waiting threads per event and retrieve free area of state TBL */ - for (ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) { - if ((p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag == FALSE) && \ - (p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting == FALSE)) { - /* For the unused state TBL */ - /* If the event wait flag is released, */ - /* finish searching when free area is found */ - ret_sts = RET_NORMAL; - break; - } - } - - /* If there is free space in the state TBL */ - if (ret_sts == RET_NORMAL) { - /* Set wait rule for free space of state TBL */ - /* Determine the wait rule */ - switch (st_condition->us_mode) { // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR and EVWAIT_ANYSET - case EVWAIT_VAL: /* For range waiting */ - { - /* Set event monitoring mode */ - p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode; - /* Set the minimum value for establishing an event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = st_condition->l_min_val; - /* Set the maximum value for establishing an event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = st_condition->l_max_val; - break; - } - case EVWAIT_ALLCLR: /* If waiting for the specified bit to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR - case EVWAIT_ANYSET: /* If waiting for the specified bit to be set */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET - { - // LCOV_EXCL_START 200: can not be EVWAIT_ANYSET and EVWAIT_ALLCLR - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Set event monitoring mode */ - p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode; - /* Set event wait mask value */ - p_event_open->p_sys_event->st_condition[ul_wcn].ul_mask = st_condition->ul_mask; - break; - // LCOV_EXCL_STOP - } - default: - ret_sts = RET_ERROR; - } - } - - /* When the specified mode is normal */ - if (ret_sts == RET_NORMAL) { - /* Check if event wait conditions are met */ - BOOL bret = CheckCondition(p_event_open->p_sys_event, ul_wcn, p_event_open->p_sys_event->l_event_val); - - /* Target event received */ - if (bret == TRUE) { - /* Set the received event value */ - st_condition->l_last_val = p_event_open->p_sys_event->l_event_val; - /* Since it does not wait for an event, set the initial value to the state TBL. */ - p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE; - p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE; - /* Set the default minimum value for the event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL; - /* Set the default maximum value for the event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL; - - /* When the manual reset function is disabled */ - if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) { - /* Initialize event values */ - p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data; - } - } else { - /* When no event is received */ - /* Set event wait state in free area of state TBL */ - /* Set event wait flag to waiting */ - p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = TRUE; - /* Set table usage flag in use */ - p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = TRUE; - - /* Perform event wait */ - ret_sts = EventWaitForSignal(p_event_open, ul_wcn, ul_mill_sec_time); - /* Set event wait flag to unused */ - p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE; - /* Set table usage flag to unused */ - p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE; - /* Set the default minimum value for the event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL; - /* Setting the default maximum value for the event */ - p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL; - /* Set event return value */ - st_condition->l_last_val = p_event_open->p_sys_event->st_condition[ul_wcn].l_last_val; - } - } - - /* Release semaphore for event table */ - EventUnlockMutex(p_event_open); - - return ret_sts; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FindEventTable() - * ABSTRACT : Event Table Search Processing - * NOTE : Search the event table for the specified event name and return the index number - * : of the event if it has been already registerd. - * ARGUMENT : PB_EVENT *p_event_table Pointer to the start of event table array in the shared memory - * : TCHAR *ptcEventName Event name to search - * : u_int32* puc_index storage area for the index number of the specified event table - * RETURN : BOOL FALSE No specified event - * : TRUE Specified Event Yes - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static BOOL -FindEventTable(PB_EVENT* p_event_table, TCHAR* ptcEventName, u_int32* puc_index) { - u_int32 ul_index = 0; - BOOL bret = FALSE; - - for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) { - if (_tcscmp(p_event_table[ul_index].event_name, ptcEventName) == 0) { - /* Save target index */ - *puc_index = ul_index; - bret = TRUE; - break; - } - } - - return bret; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : AllocNewEventTable() - * ABSTRACT : Event table allocation processing - * NOTE : Search the event table pointed to from the beginning for an area in - * : which the event name is not registered, and returns its index number. - * : The event table structure is allocated as an array in shared memory. - * : One element of the array is the event table structure, and its index - * : plus one is used as the event ID. - * : Whether the event table structure is in use or unused is determined - * : by whether the event name is set or not. - * : Note: Since the Mutex part inside this function was deleted to - * : fix a bug caused by Mutex leak, use Mutex around this function from the - * : outside before using this function. - * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory - * : TCHAR *name Event name to reserve table Note: Currently unused. - * : HANDLE hMutex Mutex handle for event table Note: Currently unused. - * RETURN : DWORD other than -1 Index number of the allocted event table - * : -1 There is no free space in the event table. - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static BOOL -AllocNewEventTable(PB_EVENT* p_event_table, u_int32* puc_index) { - u_int32 ul_index = 0; - BOOL bret = FALSE; - - for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) { - if (p_event_table[ul_index].event_name[0] == __TEXT('\0')) { - *puc_index = ul_index; - bret = TRUE; - break; - } - } - - return bret; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FreeEventTable() - * ABSTRACT : Event table release processing - * NOTE : Initialize the event name and event value of the index number - * : of the specified event table to make them free. - * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory - * : int index Index number of the event table to release - * : HANDLE hMutex Mutex handle for event table - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static void -FreeEventTable(PB_EVENT* p_event_table, int index) { - p_event_table[index].event_name[0] = __TEXT('\0'); - p_event_table[index].l_event_val = 0; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : CheckCondition() - * ABSTRACT : Event condition determination processing - * NOTE : Check whether the event value of the specified event table is - * : satisfied as an event wait condition. - * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory - * : DWORD wcn Index number of the event table to be checked - * RETURN : BOOL TRUE Condition satisfied - * : FALSE Condition not met - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data) { - BOOL bret = FALSE; - - if (p_sys_event != NULL) { // LCOV_EXCL_BR_LINE 6: p_sys_event can not be NULL - /* Determine the wait mode of the event state TBL. */ - switch (p_sys_event->st_condition[wcn].us_mode) { // LCOV_EXCL_BR_LINE 200: EVWAIT_ALLCLR and EVWAIT_ANYSET will not be called // NOLINT(whitespace/line_length) - case EVWAIT_VAL: /* For value range wait */ - { - /* Check whether the event value is within the condition satisfied range */ - if ((l_event_data >= p_sys_event->st_condition[wcn].l_min_val) && - (l_event_data <= p_sys_event->st_condition[wcn].l_max_val)) { - bret = TRUE; - } - break; - } - case EVWAIT_ALLCLR: /* When waiting for all specified bits to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR // NOLINT(whitespace/line_length) - { - // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) == EVENT_BIT_ZERO) { - bret = TRUE; - } - break; - // LCOV_EXCL_STOP - } - case EVWAIT_ANYSET: /* If the specified bit is waiting to set any bits */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET // NOLINT(whitespace/line_length) - { - // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) != EVENT_BIT_ZERO) { - bret = TRUE; - } - break; - // LCOV_EXCL_STOP - } - default: /* If the wait mode is out of range, */ - break; /* return with error */ - } - } - - return bret; -} - -/** - * @brief - * Event generation processing - * - * @param[in] u_int8 uc_manual_reset - * @param[in] int32 l_init_data - * @param[in] char *cp_event_name Pointer to the names of event to be generated (NULL termination string) - * @return EventID Non-zero Event ID created
- * 0 Event generation error - */ -static EventID EventCreateNewEventInSystem(u_int8 uc_manual_reset, int32 l_init_data, TCHAR* p_event_name) { - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - PB_EVENT *p_sys_event = NULL; - EventID ret_event_id = 0; - u_int32 ul_index = 0; - BOOL bret = FALSE; - EV_ERR ev_err; - - /* Parameter check */ - if (p_event_name != NULL) { // LCOV_EXCL_BR_LINE 6: p_event_name can not be NULL - /* Parameter normal */ - /* Get the index number of the newly created event table */ - bret = AllocNewEventTable(p_inst->p_event_table, &ul_index); - - /* When there is no free space */ - if (bret == FALSE) { - /* Error log output */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:_pb_CreateEvent : AllocNewEventTable Full... \r\n"); - } - } - - /* When there is free space */ - if (bret != FALSE) { - /* allocate event table to generate from heap */ - /* */ - p_event_open = reinterpret_cast(PbProcessHeapAlloc(0, sizeof(PB_EVENT_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length) - - /* Failure in allocating heap area */ - if (p_event_open == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - // LCOV_EXCL_START 200: can not be NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - bret = FALSE; - /* Error log output */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n", - p_event_open, sizeof(PB_EVENT_OPEN_HANDLE)); - // LCOV_EXCL_STOP - } - } - - /* When the heap area can be allocated */ - if (bret != FALSE) { - /* Initialization of generated event management information */ - p_event_open->index = ul_index; - p_event_open->p_sys_event = &p_inst->p_event_table[ul_index]; - p_event_open->l_thread_ref = 1; - - /* Initialization processing of event information storage area */ - p_sys_event = p_event_open->p_sys_event; - _tcscpy(p_sys_event->event_name, p_event_name); /* Event name registration */ - p_sys_event->l_event_val = l_init_data; /* Default setting */ - for (u_int32 ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) { - p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE; - p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE; - p_sys_event->st_condition[ul_wcn].us_mode = 0; - p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL; - p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL; - - /* Create Event Flag */ - ev_err = EV_create_flag_auto_id(&(p_sys_event->st_condition[0].flag_id[g_my_proc_cnt])); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - if (ev_err != EV_OK) /* When initialization fails */ { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x", \ - ev_err, p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]); - - /* Release heap space */ - PbProcessHeapFree(0, p_event_open); // LCOV_EXCL_BR_LINE 200: no branch - - ret_event_id = 0; - bret = FALSE; - } - } - - if (bret != FALSE) { - p_sys_event->l_process_ref = 1; /* Set the number of references to this event. */ - p_sys_event->l_reset_data = l_init_data; /* Default setting */ - p_sys_event->uc_manual_reset = uc_manual_reset; /* Setting for a manual reset */ - - /* Create an event table Mutex and set it in the event table. */ - bret = EventCreateMutex(p_event_open); - /* If generating fails, reset is executed. */ - if (bret == FALSE) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n", LTEXT(__FILE__), __LINE__); \ - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CreateMutex Err ... Event Name[%s]\r\n", p_event_name); - _pb_Exit(); - } - - /* Register event table with event instance */ - p_inst->p_handle_table[ul_index] = p_event_open; - ret_event_id = ul_index + 1; - } - } - - return ret_event_id; -} - -/** - * @brief - * Event generation processing - * - * @param[in] char *cpEventName Pointer to name of the event to be generated (NULL termination string) - * @return EventID Non-zero Event ID created
- * 0 Event generation error - */ -static EventID EventCreateNewEventInProcess(u_int32 index) { - PB_EVENT_OPEN_HANDLE *p_event_open = NULL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - EventID ret_event_id = 0; - EV_ERR ev_err; - - /* Already created in the same process */ - if (p_inst->p_handle_table[index] != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - /* When the number of event references in the same process is less than the upper limit */ - if (p_inst->p_handle_table[index]->l_thread_ref < _CWORD64_EVENT_MAXOPEN_IN_PROCESS) { - /* Increase the number of thread references */ - (p_inst->p_handle_table[index]->l_thread_ref)++; - ret_event_id = index + 1; - } else { - /* When the number of event references in the same process is the upper limit */ - /* Error log output */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_pb_CreateEvent Err ... Event Max In Process : EventName[%s]\r\n", - p_inst->p_handle_table[index]->p_sys_event->event_name); - } - } else { - /* Creating for the first time in the process */ - /* Checking the upper limit of the reference count of the same event in the system */ - if (p_inst->p_event_table[index].l_process_ref < _CWORD64_EVENT_MAXOPEN_IN_SYSTEM) { - /* Allocate event table to generate from heap */ - /* */ - p_event_open = reinterpret_cast(PbProcessHeapAlloc(0, \ - sizeof(PB_EVENT_OPEN_HANDLE))); - - /* Failure in allocating heap area */ - if (p_event_open == NULL) { - /* Error log output */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n", \ - p_event_open, sizeof(PB_EVENT_OPEN_HANDLE)); - } - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "_pb_CreateEvent Err ... Event Max In sYSTEM : EventName[%s]\r\n", - p_inst->p_handle_table[index]->p_sys_event->event_name); - } - - /* When heap allocation is successful */ - if (p_event_open != NULL) { - /* When it is not created in the same process, set each data. */ - /* Set the index to which the event name is registered */ - p_event_open->index = index; - /* Initialize the reference count of the threads referencing this event in the same process. */ - p_event_open->l_thread_ref = 1; - /* Set event instance start address */ - p_event_open->p_sys_event = &p_inst->p_event_table[index]; - /* Add the reference count of the process referencing this event in the system. */ - p_event_open->p_sys_event->l_process_ref++; - - /* Create an event flag */ - ev_err = EV_create_flag_auto_id(&(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt])); - if (ev_err != EV_OK) /* When initialization fails */ { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x]", - ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]); - - /* Release heap space */ - PbProcessHeapFree(0, p_event_open); - - ret_event_id = 0; - } else { - /* Even if event information already exists in the system, the Mutex is created for each process. */ - (void)_pb_CreateMutex(NULL, FALSE, p_event_open->p_sys_event->name_of_mutex); - - p_inst->p_handle_table[index] = p_event_open; /* Register event tables with event instance */ - ret_event_id = index + 1; - } - } - } - - return ret_event_id; -} - -/** - * @brief - * Send the signal - * - * Sends the specified event signal. - * - * - Sending signals in the CLS event library - * - * @param[in] PB_EVENT_OPEN_HANDLE *p_evet_open_handle - * @param[in] u_int32 ul_index - * - * @return RET_NORMAL Normal completion
- * RET_ERROR Other errors - */ -static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index) { - RET_API ret_api = RET_NORMAL; - PB_EVENT_INSTANCE *p_inst = &g_instance; - EV_ERR ev_err; - int32 i; - BOOL errFlag = TRUE; - - if ((p_evet_open_handle != NULL) && - (ul_index < MAX_PB_EVENT_WAIT_THREADS)) { - for (i = 0; i <= p_inst->p_event_table->proc_cnt; i++) { - /* Signal issuance */ - if (p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i] != 0) { - ev_err = EV_set_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i], 1); - if (ev_err == EV_OK) { - errFlag = FALSE; - } - } - } - } - - if (errFlag == TRUE) /* Event issuance NG */ { - ret_api = RET_ERROR; - } - - return ret_api; -} - -/** - * @brief - * Wait for the signal - * - * Wait until the specified signal is received. Timeout can be specified (ms). - * When this API is called, the semaphore for the event element must be acquired. - * - * Receive a signal in the CLS event library. - * - * @param[in] *p_evet_open_handle - * @param[in] ul_index - * @param[in] ul_mill_sec_time - * - * @return RET_NORMAL Normal completion
- * RET_ERRTIMEOUT Timeout End
- * RET_ERROR Other errors - */ -static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index, \ - u_int32 ul_mill_sec_time) { - RET_API ret_api = RET_ERRTIMEOUT; - EV_ERR ev_err; - EV_Flag ev_flag; - u_int32 timeOutCnt = 0; - - /* Parameter check */ - if ((p_evet_open_handle != NULL) && (ul_index < MAX_PB_EVENT_WAIT_THREADS)) { // LCOV_EXCL_BR_LINE 6: param can not be invalid // NOLINT(whitespace/line_length) - /* Release semaphore for event table */ - EventUnlockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch - - /* Distribute processing by timeout period */ - /* To check the event occurrence status */ - if (ul_mill_sec_time == 0) { - /* Untreated */ - } else if (ul_mill_sec_time == INFINITE) { - /* Without timeout */ - ret_api = RET_NORMAL; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_wait_flag CALL [flag_id=0x%x]", - p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]); - - /* Wait for event flag */ - ev_err = EV_wait_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \ - &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch - if (ev_err != EV_OK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "EV_wait_flag ERROR!! [ev_err=%d]", ev_err); - ret_api = RET_ERROR; - } else { - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \ - "EV_wait_flag RETURN [ev_err=%d]", ev_err); - } - } else { - /* When the timeout period is specified */ - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag CALL [flag_id=0x%x]", - p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]); - - while (1) { - /* Get elag event */ - ev_err = EV_get_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \ - &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch - if (ev_err == EV_OK) { - if (ev_flag.flagID == EV_NO_ID) { - timeOutCnt++; - if (timeOutCnt <= ul_mill_sec_time) { - usleep(1000); // LCOV_EXCL_BR_LINE 200: no branch - } else { - break; /* Timeout error */ - } - } else { - ret_api = RET_NORMAL; - break; - } - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "EV_get_flag ERROR!! [ev_err=%d]", ev_err); - ret_api = RET_ERROR; - break; - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag BREAK [ret_api=%d]", ret_api); - } - - /* Get event table semaphore */ - EventLockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch - } else { - /* Parameter error */ - ret_api = RET_ERROR; - } - - return ret_api; -} - -/** - * @brief - * Create the mutex for event - * - * @param[in] *p_evet_open_handle - * - * @return TRUE Normal completion
- * FALSE ABENDs - */ -static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) { - static u_int8 idx = 0; - uint32_t ulPid; /* Process ID */ - BOOL bret = FALSE; - TCHAR name[NAME_MAX]; - HANDLE handle; - - /* Parameter check */ - if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL - ulPid = (uint32_t)getpid(); - - wsprintf(name, __TEXT("POS_BASE_EVENT_MUTEX%05d_p%d"), idx, ulPid); - - /****************************************/ - /* Create Mutex */ - /****************************************/ - handle = _pb_CreateMutex(NULL, FALSE, name); - if (handle != NULL) { - _tcscpy(p_evet_open_handle->p_sys_event->name_of_mutex, name); - idx++; - bret = TRUE; - } - } - - /* When mutex processing fails */ - if (bret != TRUE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret); - } - - return bret; -} - -/** - * @brief - * Lock the mutex for event - * - * @param[in] *p_evet_open_handle - */ -static void EventLockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) { - DWORD lret = WAIT_FAILED; - HANDLE handle; - - if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL - /* Get handle from Mutex name */ - handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex); - - /****************************************/ - /* Get Mutex */ - /****************************************/ - lret = PbMutexLock(handle, INFINITE); - - /* Cancel by deleting the generated portion when a handle was acquired */ - (void)PbDeleteMutex(handle); - } - - /* When mutex processing fails */ - if (lret != WAIT_OBJECT_0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%lu]", lret); - } - - return; -} - -/** - * @brief - * Unlock the mutex for event - * - * @param[in] *p_evet_open_handle - */ -static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) { - BOOL bret = FALSE; - HANDLE handle; - - if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL - /* Get handle from Mutex name */ - handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex); - - /****************************************/ - /* Release Mutex */ - /****************************************/ - bret = PbMutexUnlock(handle); - - /* Cancel by deleting the generated portion when a handle was acquired */ - (void)PbDeleteMutex(handle); - } - - /* When mutex processing fails */ - if (bret != TRUE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret); - } - - return; -} - -/** - * @brief - * delete the mutex for event - * - * @param[in] *p_evet_open_handle - */ -static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) { - RET_API ret_api = RET_ERROR; - HANDLE handle; - - if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL - /* Get handle from Mutex name */ - handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex); - - /****************************************/ - /* Delete Mutex */ - /****************************************/ - ret_api = static_cast(PbDeleteMutex(handle)); /* Coverity CID:18817 Comment Managed */ - - /* Cancel by deleting the generated portion when a handle was acquired */ - (void)PbDeleteMutex(handle); - } - - /* When mutex processing fails */ - if (ret_api != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ret_api ERROR [ret_api:%d]", ret_api); - } - - return; -} - -/** - * @brief - * Get dump information - * - * @param[out] p_buf Dump info - * @param[in/out] p_len Buffer size - */ -void _pb_GetDebugEventMngTbl(void* p_buf, uint8_t* p_len) { - PB_EVENT_INSTANCE *p_inst = &g_instance; - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufHdlTbl[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufSysEvt[DEBUG_DUMP_MAX_SIZE]; - static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE]; - uint8_t buf_indent[16]; - uint32_t i; - PB_EVENT_OPEN_HANDLE* p_hdl_tbl; - uint8_t cnt = 0; - - if ((p_buf != NULL) && (p_len != NULL)) { - memset(&buf[0], 0x00, sizeof(buf)); - memset(&bufSysEvt, 0x00, sizeof(bufSysEvt)); - snprintf(reinterpret_cast(&buf_indent[0]), sizeof(buf_indent), " "); - GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_inst->p_event_table, &buf_indent[0]); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Event-1\n ShrMem:%p\n idEvt:%d\n Evt:\n%s", - p_inst->h_shared_memory, - p_inst->id_event_table_sem, - &bufSysEvt[0]); - memcpy(p_buf, &buf[0], sizeof(buf)); - p_buf = reinterpret_cast((reinterpret_cast(p_buf)) + sizeof(buf)); - cnt++; - if (cnt < *p_len) { - memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl)); - for (i = 0; i < MAX_PB_EVENTS; i++) { - // p_handle_table - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - p_hdl_tbl = p_inst->p_handle_table[i]; - if (p_hdl_tbl == NULL) { - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n [%d] NULL", - i); - } else { - memset(&bufSysEvt[0], 0x00, sizeof(bufSysEvt)); - snprintf(reinterpret_cast(&buf_indent[0]), sizeof(buf_indent), " "); - GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_hdl_tbl->p_sys_event, &buf_indent[0]); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n [%d]\n h_heap:%p, index:%lu, l_thread_ref:%d\n p_sys_event:\n%s", - i, - p_hdl_tbl->h_heap, - p_hdl_tbl->index, - p_hdl_tbl->l_thread_ref, - &bufSysEvt[0]); - } - strncat(reinterpret_cast(&bufHdlTbl[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - if (((i + 1) % 4) == 0) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Event-%d\n Handle:%s", - cnt, - &bufHdlTbl[0]); - memcpy(p_buf, &buf[0], sizeof(buf)); - p_buf = reinterpret_cast((reinterpret_cast(p_buf)) + sizeof(buf)); - memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl)); - if (cnt >= *p_len) { - break; - } - } - } - } - if (cnt < *p_len) { - if (bufHdlTbl[0] != 0x00) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Event-%d\n Handle:%s", - cnt, - &bufHdlTbl[0]); - memcpy(p_buf, &buf[0], sizeof(buf)); - } - *p_len = cnt; - } - } -} - -/** - * @brief - * Get dump information(PB_EVENT) - * - * @param[out] p_buf Dump info - * @param[in] pEvt PB_EVENT - * @param[in] pIndent Indenting - */ -void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* pEvt, uint8_t* pIndent) { - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t buf_condition[1024]; - static uint8_t buf_flag_id[512]; - static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE]; - uint32_t i; - uint32_t e; - - if ((p_buf != NULL) && (pEvt != NULL)) { // LCOV_EXCL_BR_LINE 6: p_buf and pEvt can not be NULL - memset(&buf, 0x00, sizeof(buf)); - memset(&buf_condition, 0x00, sizeof(buf_condition)); - snprintf(reinterpret_cast(&(buf_condition)), sizeof(buf_condition), "stCnd:"); - for (i = 0; i < MAX_PB_EVENT_WAIT_THREADS; i++) { - memset(&buf_flag_id, 0x00, sizeof(buf_flag_id)); - for (e = 0; e < MAX_EVENT_PROC_NUM; e++) { - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "[%d]0x%08x ", e, pEvt->st_condition[i].flag_id[e]); - strncat(reinterpret_cast(&buf_flag_id[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - } - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s [%d] UseFlg:%d, Wait:%d, Mode:%d, Mask:%d, Min:%d, Max:%d, Last:%d, flag:%s", - pIndent, - i, - pEvt->st_condition[i].uc_use_flag, - pEvt->st_condition[i].uc_waiting, - pEvt->st_condition[i].us_mode, - pEvt->st_condition[i].ul_mask, - pEvt->st_condition[i].l_min_val, - pEvt->st_condition[i].l_max_val, - pEvt->st_condition[i].l_last_val, - &buf_flag_id[0]); - strncat(reinterpret_cast(&buf_condition[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - } - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "%s EvtName:%s", - pIndent, - pEvt->event_name); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s EvtVal:%d", - pIndent, - pEvt->l_event_val); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s %s", - pIndent, - &buf_condition[0]); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s ProcRef:%d", - pIndent, - pEvt->l_process_ref); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s ResetData:%d", - pIndent, - pEvt->l_reset_data); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s ManualReset:%d", - pIndent, - pEvt->uc_manual_reset); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n%s name_of_mutex:%s", - pIndent, - pEvt->name_of_mutex); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - memcpy(p_buf, &buf[0], sizeof(buf)); - } -} diff --git a/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp b/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp deleted file mode 100755 index ee132b0..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbFsys.cpp - System name : 05 Integration Platform - Subsystem name : System common functions - Title : System API file access control related processes -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - -#include -#include "WPF_STD_private.h" - -/* - Constants and structure definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define ALLOC_SIZE 0x00200000 -#define MAX_MUTEX_NAME_LEN 32 - -/* Flag structure for file system protection */ -typedef struct { - u_int8 file_write_flag; - u_int8 dummy1; - u_int8 recover_flag; - u_int8 dummy2; -} FSYS_FLAG_STRUCT; - -/* File system protection flag area control table */ -typedef struct { - TCHAR mtx_name[MAX_MUTEX_NAME_LEN]; /* Mutex name */ - HANDLE h_mutex; /* Mutex handles */ -} FSYS_GLOBAL; - -/* - Global Variable Definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -FSYS_FLAG_STRUCT *g_fsys_flag_top_addr; - -/* - External function prototype declaration -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef __cplusplus -extern "C" { -#endif - BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect); -#ifdef __cplusplus -} -#endif - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FileSystemCheckInit - * ABSTRACT : File system protection flag area and setting value initialization processing - * NOTE : Allocate a flag area for protecting the file system, create a Mutex - * : for locking the area, and initialize the flags as follows. - * : File access flag :File Access Permission State - * : FlashFS recovery status flag :FlashFS access-prohibited status - * ARGUMENT : None - * RETURN : RET_API define - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -FileSystemCheckInit(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return (RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FileSystemCheckTerm - * ABSTRACT : File system protection flag area release processing - * NOTE : - * ARGUMENT : None - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -FileSystemCheckTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SetFileAccessFlag - * ABSTRACT : File access flag setting process - * NOTE : Sets the write access state in the file access flag.Parameter - * : Set "Write prohibited state" at the time of parameter error. - * ARGUMENT : u_int8 status : File access flag setting value - * WRITE_FLAG_OFF : Write prohibited state to file - * WRITE_FLAG_ON : Write permission status for the file - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -SetFileAccessFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetFileAccessFlag - * ABSTRACT : File access flag acquisition processing - * NOTE : Gets the write access status to a file from the file access flag - * ARGUMENT : u_int8 *status Pointer for storing access status - * RETURN : RET_NORMAL Normal completion Note : Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -GetFileAccessFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - *status = WRITE_FLAG_ON; - return (RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SetFFSRecoverFlag - * ABSTRACT : FLASH file system recovery processing status setting processing - * NOTE : Sets the status of FLASH file system recovery - * ARGUMENT : u_int8 status : FLASH file system recovery process status setting - * RECOVER_OFF : Access authorization state - * RECOVER_ON : Access prohibited status during recovery processing - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void -SetFFSRecoverFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetFFSRecoverFlag - * ABSTRACT : FLASH file system recovery processing status acquisition processing - * NOTE : Gets the status of FLASH file system recovery - * ARGUMENT : u_int8 *status Pointer for storing recovery processing status - * RETURN : RET_API define - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -GetFFSRecoverFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return (RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetFSAccessSts - * ABSTRACT : File system access status acquisition processing - * NOTE : Gets the access status to the file system - * ARGUMENT : u_int8 *status Pointer for storing the file system access status - * RETURN : RET_API define - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -GetFSAccessSts(u_int8 *status) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - *status = FSNOACCESS; - - return (RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* End _pbFsys.cpp */ diff --git a/vehicleservice/positioning_base_library/library/src/_pbMem.cpp b/vehicleservice/positioning_base_library/library/src/_pbMem.cpp deleted file mode 100755 index 4028ae3..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbMem.cpp +++ /dev/null @@ -1,989 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbMem.cpp - System name : 05 Integration Platform - Subsystem name : System common functions - Title : System API -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - -#include -#include -#include -#include -#include "tchar.h" -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" - -/* - Constants and data type definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define MAX_AREA_NAME_LEN 32 -#define MAX_FILENAME_LEN 32 -#define _CWORD64__MEM_MUTEX_NAME __TEXT("POS_BASE_MEM_MUTEX") -#define MAX_ROMFILENAME_LEN (32-4) /* To the name appended with "_rom" at the time of registration */ -#define PHYADDR_MAX 0x9FFFFFFF /* Physical address of the boundary divided by 256 */ -#define ROM_DATA_SIZE 0x00400000 /* Size of the virtual ROM data area(4MB) */ -#define ALLOC_SIZE 0x00200000 /* 2MB (Minimum VirtualAlloc allocation of shared memory, */ -/* which is less than 2MB, is not mapped to shared memory) */ -#define OFFSET_SIZE 0x00001000 /* 4KB (VirtualCopy Addressing Units) */ - - /* Memory map information */ -typedef struct TagMemMapItem { - HANDLE h_heap; /* Handle of heap. */ - struct TagMemMapItem* p_next; /* Pointers to the next Chain memory map table */ - struct TagMemMapItem* p_prev; /* Pointers to the previous Chain memory map table */ - DWORD address; - TCHAR name[MAX_AREA_NAME_LEN]; /* Name of shared data area(Not used when permit is processed) */ - HANDLE h_shared_mem; /* Shared memory handle */ -} MEMMAP_ITEM; - -/* Memory map information management table */ -typedef struct { - HANDLE h_heap; /* Heap handle of the invoking table */ - MEMMAP_ITEM* p_head; /* Pointer to the first memory map information */ - MEMMAP_ITEM* p_tail; /* Pointer to the terminating memory map information */ - DWORD num_of_items; /* Chain memory map data */ - HANDLE h_mutex; /* _CWORD64__MEM_MUTEX Exclusive Mutex handles */ -} MEMMAP_LIST; - -typedef struct { - DWORD mem_size; - DWORD reserv[3]; -} _CWORD64_SHMHDR; - -/* LINK ROM data top address/size storage ROM data */ -typedef struct { - u_int32 *link_rom_addr; /* ROM data start address */ - u_int32 link_size; /* ROM data size */ -} LINK_ROM; - -/* - Internal function prototype declaration -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static void UnlinkFromMemMapList(MEMMAP_ITEM* p_item); -static void LinkToMemMapList(MEMMAP_ITEM* p_item); -static MEMMAP_ITEM* FindMemMapItemByName(TCHAR* name); - -/* - Global variable -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -MEMMAP_LIST* g_p_mem_map_list; - -/** - * @brief - * Memory API initialization - * - * @param[in] none - * - * @return RET_API RET_NORMAL Normal completion
- * RET_ERROR ABENDs - */ - -RET_API MemoryInit(void) { - RET_API ret_api = RET_NORMAL; - TCHAR name[] = _CWORD64__MEM_MUTEX_NAME; - - // LCOV_EXCL_BR_START 5: standard lib error - g_p_mem_map_list = reinterpret_cast(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM))); - // LCOV_EXCL_BR_STOP - if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 5: standard lib error - } else { - /* Initialization of memory map information management table */ - g_p_mem_map_list->h_heap = NULL; - g_p_mem_map_list->p_head = NULL; - g_p_mem_map_list->p_tail = NULL; - g_p_mem_map_list->num_of_items = 0; - - /* Create Mutex */ - g_p_mem_map_list->h_mutex = _pb_CreateMutex(NULL, TRUE, name); // LCOV_EXCL_BR_LINE 200: no branch - if (g_p_mem_map_list->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - // LCOV_EXCL_START 200:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [name:%s]", name); - _pb_Exit(); /* System recovery processing(Exception execution) */ - // LCOV_EXCL_STOP - } - } - - return ret_api; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : MemoryTerm - * ABSTRACT : Memory API termination processing - * NOTE : This function frees each allocated object. - * : This function must be called only once by DllMain() at process termination. - * ARGUMENT : None - * RETURN : Return RET_NORMAL - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -MemoryTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - - if (g_p_mem_map_list == NULL) { - ret_api = RET_ERROR; - } else { - /* Lock Mutex */ - PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); - - while (g_p_mem_map_list->num_of_items > 0) { - MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head; - if (g_p_mem_map_list->num_of_items == 1) { - /* Delete last one of memory map list */ - g_p_mem_map_list->p_head = NULL; - g_p_mem_map_list->p_tail = NULL; - g_p_mem_map_list->num_of_items = 0; - } else { - /* Deletes the beginning of the memory map list, with the next at the beginning. */ - g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next; - g_p_mem_map_list->p_head->p_prev = NULL; - g_p_mem_map_list->num_of_items--; - } - - /* Releases the real memory specified in the memory map list. */ - if (p_item != NULL) { - PbProcessHeapFree(0, p_item); - p_item = NULL; - } - } - - /* Release Mutex */ - PbMutexUnlock(g_p_mem_map_list->h_mutex); - - /* Delete Mutex */ - PbDeleteMutex(g_p_mem_map_list->h_mutex); - - /* Free MEMMAP_LIST structure */ - PbProcessHeapFree(0, g_p_mem_map_list); - g_p_mem_map_list = NULL; - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Allocate Process Heap - * - * Allocates a memory block from the process heap - * - * @param[in] DWORD dw_flags Heap allocation scheme - * @param[in] SIZE_T dw_bytes Number of bytes to allocate - * - * @return LPVOID Except NULL Pointer to the allocated memory block - * NULL Assignment Failed - */ -LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) { - LPVOID pv_ret = NULL; - - if ((dw_flags & HEAP_ZERO_MEMORY) == 0) { // LCOV_EXCL_BR_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY - /* Zero initialization not specified */ - pv_ret = malloc(dw_bytes); - } else { - /* Zero initialization specified */ - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - pv_ret = calloc(dw_bytes, sizeof(char)); // LCOV_EXCL_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY - } - - return pv_ret; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PrivateHeapAlloc - * ABSTRACT : Allocate a block of memory from the private heap - * NOTE : Because there is no private-heap notion in PosixBasedOS001, - * Allocate from the process-heap using ProcessHeapAlloc - * ARGUMENT : DWORD dw_flags Controlling Heap Allocation Methods - * : SIZE_T dw_bytes Number of bytes to allocate - * RETURN : LPVOID Except NULL Pointer to the allocated memory block - * : NULL Assignment Failed - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -LPVOID -PrivateHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return PbProcessHeapAlloc(dw_flags, dw_bytes); -} -// LCOV_EXCL_STOP - -/** - * @brief - * Free Process Heap - * - * Frees memory blocks allocated from the process heap - * - * @param[in] DWORD dw_flags Heap free method(Unused) - * @param[in] LPVOID lp_mem Pointer to the memory to be freed - * - * @return BOOL Non-zero Normal completion - * 0 ABENDs - */ -BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem) { - free(lp_mem); - - return TRUE; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PrivateHeapFree - * ABSTRACT : Free memory blocks allocated from private heap - * NOTE : Because there is no private-heap notion in PosixBasedOS001, - * Open using ProcessHeapFree - * ARGUMENT : DWORD dw_flags Heap release option(Not used by PosixBasedOS001) - * : LPVOID lp_mem Pointer to the memory to be freed - * RETURN : BOOL Non-zero Normal - * : 0 Abnormality - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BOOL -PrivateHeapFree(DWORD dw_flags, LPVOID lp_mem) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return PbProcessHeapFree(dw_flags, lp_mem); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : MemPermit - * ABSTRACT : Acquire access privilege to non-managed memory block of invoking process - * NOTE : To the data of the unmanaged memory block of invoking process - * : Allocate to accessible area of invoking process - * ARGUMENT : u_int32 mem_adr Start address of the data area to which access privileges are granted - * : u_int32 size Size of the data area to be granted access privileges - * : int32 perm PERM_NONCACHE(Cache invalidation), PERM_CACHE(Cache enabled) - * : void** ptr Returns the start address of the actual data area that can be accessed - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_ERROR ABENDs - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API MemPermit(u_int32 mem_adr, u_int32 size, int32 perm, void** ptr) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : MemProtect - * ABSTRACT : Revoking access privileges to invoking process unmanaged memory blocks - * NOTE : Free unmanaged memory block allocated to invoking process area - * ARGUMENT : u_int32 mem_adr Start address of the data area from which the access privilege is to be revoked - * : u_int32 size Size of the data area for which access privileges are to be revoked - * RETURN : RET_API RET_NORMAL Access privilege revocation successful - * : RET_ERROR Failed to revoke access privilege - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API MemProtect(u_int32 mem_adr, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create Share Data - * - * @param[in] char* area_name Pointer to shared data area name string - * @param[in] u_int32 size Size of the data portion - * @param[out] void** mem_ptr Pointer to the start address of the shared data area - * - * @return RET_API - * RET_NORMAL Normal - * RET_ERROR Abnormality - */ -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h -#else -RET_API _pb_CreateShareData(TCHAR* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h -#endif // _CWORD64_API_DOES_NOT_USE_UNICODE -{ - RET_API ret_api = RET_NORMAL; - TCHAR *p_area_name = NULL; - TCHAR name[MAX_AREA_NAME_LEN] = {0}; - HANDLE h_shm = NULL; - _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED); - MEMMAP_ITEM *p_item = NULL; -#ifdef UNDER_CE - TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0}; -#endif // UNDER_CE - - if (mem_ptr == NULL) { - ret_api = RET_ERROR; /* Parameter error */ - } else if (area_name == NULL) { - ret_api = RET_ERROR; /* Parameter error */ - } else { -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -#ifdef UNDER_CE - if (area_name[0] == '\0') { - ret_api = RET_ERROR; - } else { - /* Shared memory name character limit processing */ - if (strlen(area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } else { - mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN); - p_area_name = unicode_area_name; - } - } -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif - } - - if (ret_api == RET_NORMAL) { - if ((p_area_name[0] == __TEXT('\0')) || (size == 0)) { - ret_api = RET_ERROR; /* Parameter error */ - } - } - - if (ret_api == RET_NORMAL) { - _tcscpy(name, p_area_name); - - /* Lock Mutex */ - PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch - - p_item = FindMemMapItemByName(name); /* Search memory map object by area name */ - if (p_item != NULL) /* When there is already a generated name */ { - *mem_ptr = NULL; - ret_api = RET_ERROR; /* Return in error because it has been generated */ - } else { - /* Allocate MEMMAP_ITEM structure from heap */ - // LCOV_EXCL_BR_START 5: standard lib error - p_item = reinterpret_cast(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM))); - // LCOV_EXCL_BR_STOP - if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error - ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error - } else { - p_item->h_heap = NULL; - p_item->p_next = NULL; - p_item->p_prev = NULL; - p_item->address = 0; - p_item->h_shared_mem = NULL; - LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch - - /* Allocate shared memory */ - h_shm = CreateSharedMemory(name, size + sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: can not be null - if (h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Remove the target memory-mapped object from the memory-mapped list */ - UnlinkFromMemMapList(p_item); - PbProcessHeapFree(0, p_item); - p_item = NULL; - *mem_ptr = NULL; - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - p_item->h_shared_mem = h_shm; - /* Get Accessible Address */ - // LCOV_EXCL_BR_START 200: can not be null - p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(GetSharedMemoryPtr(p_item->h_shared_mem)); - // LCOV_EXCL_BR_STOP - if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Delete allocated shared memory */ - CloseSharedMemory(h_shm); - DeleteSharedMemory(name); - /* Remove the target memory-mapped object from the memory-mapped list */ - UnlinkFromMemMapList(p_item); - PbProcessHeapFree(0, p_item); - p_item = NULL; - *mem_ptr = NULL; - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - p_hdr->mem_size = size; - *mem_ptr = reinterpret_cast(p_hdr + 1); /* Start at the address following the header */ - _tcscpy(p_item->name, name); /* Name registration in the table */ - } - } - } - } - - /* Release Mutex */ - PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch - } else { - /* When an error occurs during parameter check */ - if (mem_ptr != NULL) { - *mem_ptr = NULL; - } - } - - return ret_api; -} - -/** - * @brief - * Link Share Data - * - * @param[in] char* area_name Pointer to shared data area name string - * @param[out] void** mem_ptr Pointer to the start address of the shared data area - * @param[out] u_int32* size Size of the data portion - * - * @return RET_API - * RET_NORMAL Normal - * RET_ERROR Abnormality - */ -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h -#else -RET_API _pb_LinkShareData(TCHAR* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h -#endif // _CWORD64_API_DOES_NOT_USE_UNICODE -{ - RET_API ret_api = RET_NORMAL; - TCHAR *p_area_name = NULL; - TCHAR name[MAX_AREA_NAME_LEN] = {0}; - _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED); - MEMMAP_ITEM *p_item = NULL; - HANDLE h_shm = NULL; - HANDLE h_shm_temp = NULL; - DWORD mem_size = 0; -#ifdef UNDER_CE - TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0}; -#endif - - if (mem_ptr == NULL) { - ret_api = RET_ERROR; /* Parameter error */ - } else if ((area_name == NULL) || (size == NULL)) { - ret_api = RET_ERROR; /* Parameter error */ - } else { -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -#ifdef UNDER_CE - if (area_name[0] == '\0') { - ret_api = RET_ERROR; - } else { - /* Shared memory name character limit processing */ - if (strlen(area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } else { - mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN); - p_area_name = unicode_area_name; - } - } -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif - } - - if (ret_api == RET_NORMAL) { - if (p_area_name[0] == __TEXT('\0')) { - ret_api = RET_ERROR; /* Parameter error */ - } - } - - if (ret_api == RET_NORMAL) { - *size = 0; - _tcscpy(name, p_area_name); - mem_size = (u_int32) * size; - - /* Lock Mutex */ - PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch - - p_item = FindMemMapItemByName(name); /* Search memory map object by area name */ - if (p_item != NULL) { - /* When there is already a generated name */ - h_shm = p_item->h_shared_mem; - // LCOV_EXCL_BR_START 200: can not be null - p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm)); /* Get Accessible Address */ - // LCOV_EXCL_BR_STOP - if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - *mem_ptr = NULL; - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - /* Start at the address following the header */ - *mem_ptr = reinterpret_cast(p_hdr + 1); - *size = static_cast(p_hdr->mem_size); - } - } else { - /* When no memory map object has been created */ - /* Allocate MEMMAP_ITEM structure from heap */ - // LCOV_EXCL_BR_START 5: standard lib error - p_item = reinterpret_cast(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM))); - // LCOV_EXCL_BR_STOP - if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error - ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error - } else { - p_item->h_heap = NULL; - p_item->p_next = NULL; - p_item->p_prev = NULL; - p_item->address = 0; - _tcscpy(p_item->name, name); - p_item->h_shared_mem = NULL; - LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch - - ret_api = RET_ERROR; /* Process result initialization */ - /* Maps the shared data area to physical memory and returns its information pointer - * (Check if not found by table lookup, but other processes are already reserved) */ - h_shm_temp = OpenSharedMemory(p_item->name, sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: no branch - if (h_shm_temp != NULL) { - /* Get Accessible Address */ - p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm_temp)); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length) - if (p_hdr != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - mem_size = p_hdr->mem_size; - ret_api = RET_NORMAL; - } - CloseSharedMemory(h_shm_temp); // LCOV_EXCL_BR_LINE 200: no branch - } - - if (ret_api == RET_NORMAL) { - ret_api = RET_ERROR; /* Process result initialization */ - /* Maps the shared data area to physical memory and returns its information pointer */ - h_shm = OpenSharedMemory(p_item->name, mem_size); // LCOV_EXCL_BR_LINE 200: no branch - if (h_shm != NULL) { - p_item->h_shared_mem = h_shm; - /* Get Accessible Address */ - p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(p_item->h_shared_mem)); - if (p_hdr != NULL) { - *mem_ptr = reinterpret_cast(p_hdr + 1); /* Start at the address following the header */ - *size = static_cast(mem_size); - ret_api = RET_NORMAL; - } - } - } - - if (ret_api != RET_NORMAL) { - UnlinkFromMemMapList(p_item); /* Remove the target memory-mapped object from the memory-mapped list */ - - PbProcessHeapFree(0, p_item); // LCOV_EXCL_BR_LINE 200: no branch - p_item = NULL; - *mem_ptr = NULL; - *size = 0; - } - } - } - - /* Release Mutex */ - PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch - } else { - /* When an error occurs during parameter check */ - if (mem_ptr != NULL) { - *mem_ptr = NULL; - } - } - - return ret_api; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbDeleteShareData - * ABSTRACT : Shared data area deletion processing - * NOTE : Deletes (releases) the shared memory area allocated under the name of the shared data area. - * ARGUMENT : char* area_name Pointer to shared data area name string - * RETURN : RET_API RET_NORMAL Normal - * : RET_ERROR The specified shared data does not exist - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -PbDeleteShareData(char* area_name) // LCOV_EXCL_START 8:dead code -#else -PbDeleteShareData(TCHAR* area_name) -#endif // _CWORD64_API_DOES_NOT_USE_UNICODE -{ - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - TCHAR *p_area_name = NULL; - TCHAR name[MAX_AREA_NAME_LEN] = {0}; - MEMMAP_ITEM *p_item = NULL; -#ifdef UNDER_CE - TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0}; -#endif - - /* Parameter check */ - if (area_name == NULL) /* If the name of the shared area is NULL */ { - ret_api = RET_ERROR; - } else { -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -#ifdef UNDER_CE - if (strlen(area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } else { - mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN); - p_area_name = unicode_area_name; - } -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif -#else - p_area_name = area_name; - if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) { - ret_api = RET_ERROR; - } -#endif - if (ret_api == RET_NORMAL) { - if (p_area_name[0] == __TEXT('\0')) { - ret_api = RET_ERROR; - } - } - } - - if (ret_api == RET_NORMAL) { - /* Shared memory is allocated with the name of the shared area, or the memory map information management table is searched. */ - _tcscpy(name, p_area_name); - - /* Lock Mutex */ - PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); - - p_item = FindMemMapItemByName(name); /* Search memory map object by area name */ - if (p_item == NULL) /* If the area name is not in the memory-map information management TBL */ { - /* If the area name is not in the memory map information management TBL, it has not been created or deleted. */ - /* Release Mutex */ - PbMutexUnlock(g_p_mem_map_list->h_mutex); - ret_api = RET_ERROR; - } else { - /* If the area name is in the memory map information management TBL */ - /* Removes the memory map information from the Chain of the memory map information management table. */ - UnlinkFromMemMapList(p_item); - - /* Releases the Mutex of the memory map information management table and releases the shared memory. */ - /* Release Mutex */ - PbMutexUnlock(g_p_mem_map_list->h_mutex); - - if (p_item->h_shared_mem != NULL) { - CloseSharedMemory(p_item->h_shared_mem); - p_item->h_shared_mem = NULL; - } - - /* Frees memory-map information from the heap */ - PbProcessHeapFree(0, p_item); - - /* Deleting Shared Memory Objects */ - /*************************************************************/ - /* Note: Be sure to delete it, so Do not use DeleteShareData */ - /* if you want to link elsewhere. */ - /*************************************************************/ - DeleteSharedMemory(name); - } - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : LinkRomData - * ABSTRACT : ROM data link - * NOTE : Links data located in ROM. - * : Specifies the name of the file in which the data is to be stored, and points to the start address of the data. - * : Get pointer and data size. - * ARGUMENT : char *filename Pointer to the string of the name of the ROM data storage file - * : void **mem_ptr Pointer to the start address of the ROM data storage file - * : u_int32 *size Pointer to the size of the data portion - * RETURN : RET_API RET_NORMAL Normal status - * : RET_ERROR Specified ROM data storage file does not exist - * : File name character string width error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -RET_API LinkRomData(char* filename, void** mem_ptr, u_int32* size) // LCOV_EXCL_START 8:dead code -#else -RET_API LinkRomData(TCHAR* filename, void** mem_ptr, u_int32* size) -#endif // _CWORD64_API_DOES_NOT_USE_UNICODE -{ - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; /* Coverity CID: 18772 compliant */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbAccessPhysicalMem - * ABSTRACT : Access to Physical Memory Area Allocation Data - * NOTE : Access data allocated in the physical memory area. - * : The physical memory area is mapped to the shared memory area and mapped. - * : The start address is returned. - * ARGUMENT : u_int32 addr Start address of the physical memory area - * : void **mem_ptr Pointer to the start address of the mapped shared area - * : u_int32 size Size of the data - * : u_int32 mode Access mode - * : ACCESS_MODE_READONLY :Read Only - * : ACCESS_MODE_READWRITE:Reading and Writing - * RETURN : RET_API RET_NORMAL Normal status - * : RET_ERRPARAM Parameter error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; /* Coverity CID: 18767 compliant */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbFreePhysicalMem - * ABSTRACT : Access release processing to the physical memory area allocation data - * NOTE : Releases access to data allocated in a physical memory area - * : Releases the shared memory area Allocate by AccessPhysicalMem. - * ARGUMENT : u_int32 addr Start address of the physical memory area to be released - * : void *mem_ptr Pointer to the start address of the mapped shared area - * : u_int32 size Data size to be released - * RETURN : RET_API RET_NORMAL Normal status - * : RET_ERRPARAM Parameter error - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; /* Coverity CID: 18766 compliant */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FindMemMapItemByName - * ABSTRACT : Memory map information retrieval processing - * NOTE : Retrieves the memory map information by the specified shared data area name. - * ARGUMENT : TCHAR* name Pointer to shared data area name character string - * RETURN : MEMMAP_ITEM* !NULL Pointer to memory map information - * : NULL Memory map information does not exist - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static MEMMAP_ITEM* -FindMemMapItemByName(TCHAR* name) { - MEMMAP_ITEM* ret = NULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL - /* If the memory map information management table is not allocated, */ - /* nop */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else if (g_p_mem_map_list->num_of_items == 0) { - /* If no memory map information is allocated, */ - /* nop */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head; - /* Gets the pointer of the memory map Chain at the beginning of the file. */ - /* Loops until there is no memory map Chain */ - while (p_item != NULL) { - if (_tcscmp(p_item->name, name) == 0) { - /* If the name of the memory map information matches the name of the argument */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* Returns a pointer to the memory map information */ - ret = p_item; - break; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - p_item = p_item->p_next; /* Retrieves the pointers of the memory map data Chain next time. */ - } - } - - return(ret); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : LinkToMemMapList - * NOTE : Adding a Memory Map Object to the Memory Map List - * ARGUMENT : MEMMAP_ITEM* p_item Specify a memory-mapped object - * RETURN : Without - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static void -LinkToMemMapList(MEMMAP_ITEM* p_item) { - BOOL processing_complete = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL - // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - // LCOV_EXCL_STOP - } - - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - if ((processing_complete == FALSE) && (g_p_mem_map_list->num_of_items == 0)) { - g_p_mem_map_list->p_head = p_item; - g_p_mem_map_list->p_tail = p_item; - g_p_mem_map_list->num_of_items = 1; - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - if (processing_complete == FALSE) { - g_p_mem_map_list->p_tail->p_next = p_item; - p_item->p_prev = g_p_mem_map_list->p_tail; - p_item->p_next = NULL; - g_p_mem_map_list->p_tail = p_item; - g_p_mem_map_list->num_of_items++; - } - return; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : UnlinkFromMemMapList - * ABSTRACT : Memory map information deletion processing - * NOTE : Memory map information specified by the pointer is stored in the memory map information management table. - * : From the Chain structures.The memory map information is not released. - * ARGUMENT : MEMMAP_ITEM* p_item Pointer to the memory map information to be deleted - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static void -UnlinkFromMemMapList(MEMMAP_ITEM* p_item) { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - BOOL processing_complete = FALSE; - /* Parameter check */ - if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL - /* If the memory map information management table is not allocated, */ - /* nop */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else if (p_item == NULL) { // LCOV_EXCL_BR_LINE 200: p_item can not be NULL - /* If a pointer to memory-mapped information is not specified, */ - /* nop */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0 - /* If no memory map information is allocated, */ - /* nop */ - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } else { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* Chain detachment process when there is only one memory map data item */ - if (g_p_mem_map_list->num_of_items == 1) { - if (g_p_mem_map_list->p_head == p_item) { - /* If only one memory map is reserved */ - /* For the top memory map information of the memo map information management table */ - g_p_mem_map_list->p_head = NULL; /* Initializes the top memory map to NULL. */ - g_p_mem_map_list->p_tail = NULL; /* NULL initialization of the termination memory map data */ - g_p_mem_map_list->num_of_items = 0; /* Initializes the control memory map information count to zero. */ - } - /* Specified memory map information pointer does not exist */ - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* Memory-map-information-removal process at the top of the Chain */ - if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_head)) { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* If the specified memory map information is the first memory map information, */ - /* The leading memory map information pointer is changed to the next Chain pointer. */ - g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next; - /* Change the previous Chain source of the first memory map to NULL */ - g_p_mem_map_list->p_head->p_prev = NULL; - g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */ - p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */ - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* Memory-map data detachment process at the end of the Chain */ - if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_tail)) { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* If the pointed-to memory-map information is terminated, */ - /* Change the terminating memory-map info pointer to the previous Chain source */ - g_p_mem_map_list->p_tail = g_p_mem_map_list->p_tail->p_prev; - /* Change the Chain destination of the terminated memory map to NULL. */ - g_p_mem_map_list->p_tail->p_next = NULL; - /* Decrement the number of management memory map information */ - g_p_mem_map_list->num_of_items--; - /* The previous Chain source of the removed memory map data is NULL initialized. */ - p_item->p_prev = NULL; - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* Checking the memory map info Chain for errors */ - if ((processing_complete == FALSE) && - (g_p_mem_map_list->num_of_items <= 2)) { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - /* No more than two memory maps are possible except at the beginning and end. */ - processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - } - - /* Departure process other than the start and end of the memory map data Chain */ - if (processing_complete == FALSE) { - /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ - p_item->p_prev->p_next = p_item->p_next; /* Set the next Chain destination of the previous memory map to the next one */ - p_item->p_next->p_prev = p_item->p_prev; /* Previous Chain of one memory map before previous */ - g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */ - p_item->p_prev = NULL; /* The previous Chain source of the removed memory map data is NULL initialized. */ - p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */ - } - } - return; -} - -/** - * @brief - * Obtain dump information - * - * @param[out] p_buf Dump info - */ -void _pb_GetDebugMemoryMngTbl(void* p_buf) { // NOLINT(readability/nolint) WPF_SYSAPI.h - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t buf_tmp[256]; - uint32_t i = 0; - - if (p_buf != NULL) { - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), "Memory"); - - if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL - // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - strncat(reinterpret_cast(&buf[0]), "\n NULL", strlen("\n NULL")); - // LCOV_EXCL_STOP - } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0 - // LCOV_EXCL_START 200: num_of_items can not be 0 - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - strncat(reinterpret_cast(&buf[0]), "\n num_of_items:0", strlen("\n num_of_items:0")); - // LCOV_EXCL_STOP - } else { - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), // LCOV_EXCL_BR_LINE 5: c lib error case - "\n h_heap:%p, p_head:%s, p_tail:%s, num_of_items:%lu, h_mutex:%p", - g_p_mem_map_list->h_heap, - ((g_p_mem_map_list->p_head == NULL)?"NULL":"NOT NULL"), - ((g_p_mem_map_list->p_tail == NULL)?"NULL":"NOT NULL"), - g_p_mem_map_list->num_of_items, - g_p_mem_map_list->h_mutex); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head; - while (p_item != NULL) { - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n [%02d]h_heap:%10p, p_next:%s, p_prev:%s, name:%40s, hShrMem:%10p, adr:%lu", - i, - p_item->h_heap, - ((p_item->p_next == NULL)?"NULL ":"NOT NULL"), - ((p_item->p_prev == NULL)?"NULL ":"NOT NULL"), - p_item->name, - p_item->h_shared_mem, - p_item->address); - i++; - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - p_item = p_item->p_next; - } - } - memcpy(p_buf, &buf[0], sizeof(buf)); - } -} diff --git a/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp b/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp deleted file mode 100755 index c52b7c6..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbMisc.cpp - System name : 05 Integration Platform - Subsystem name : System common functions - Title : System API Time-of-day operations related processing group -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - -#include -#include "WPF_STD_private.h" - -/* - Declaration of constant data type -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -typedef struct { - DWORD time_on_january1_1970; /* Time on January 1, 1970 when it expressed */ - /* with the total second number from January 1, 1601 */ -} BTIME_INSTANCE; - -/* - Internal function prototype declaration -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static DWORD FileTimeToSeonds(FILETIME* p_ft); - -/* - Global Variable Definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BTIME_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : MiscInit() - * ABSTRACT : Time-related processing instance initialization processing - * NOTE : Assign and hold 1/1/1970 to FILETIME variables - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -MiscInit(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BTIME_INSTANCE *p_inst = &g_instance; - SYSTEMTIME st; - FILETIME ft; - BOOL bret; - - /* Set the system time to the default value (January 1, 1970, 00:00:00). */ - st.wYear = 1970; - st.wMonth = 1; - st.wDayOfWeek = 0; - st.wDay = 1; - st.wHour = 0; - st.wMinute = 0; - st.wSecond = 0; - st.wMilliseconds = 0; - - /* Converting System Time to File Time */ - bret = PbSystemTimeToFileTime(&st, &ft); - if (bret != TRUE) { - /* If the conversion fails, */ - p_inst->time_on_january1_1970 = 0; /* Save to instance with zero elapsed seconds */ - } else { - /* If the conversion is successful, */ - p_inst->time_on_january1_1970 = FileTimeToSeonds(&ft); /* Save File Time Elapsed Seconds to Instance */ - } - - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FileTimeToSeonds() - * ABSTRACT : File Time -> Time Conversion Processing - * NOTE : Convert the file time to seconds - * ARGUMENT : FILETIME *p_ft Pointer to the file time structure - * RETURN : DWORD Elapsing time(In seconds) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static DWORD -FileTimeToSeonds(FILETIME* p_ft) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return 0; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : MiscTerm() - * ABSTRACT : Time-related processing instance release processing - * NOTE : - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -MiscTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : Sleep() - * ABSTRACT : Sleep Processing - * NOTE : Cause the caller to sleep at the number of ticks specified by the argument - * ARGUMENT : u_int32 ticks Sleep time(Specify in ticks) - * : 0 Sleep permanently - * : 1 Discard the time slice - * RETURN : RET_API Normal completion Note: Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -Sleep(u_int32 ticks) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - DWORD milliseconds; - - switch (ticks) { - case 0: /* infinite delay. */ - { - milliseconds = INFINITE; - break; - } - case 1: /* the thread to relinquish the remainder of its time slice */ - /* to any other thread of equal priority that is ready to run. */ - /* If there are no other threads of equal priority ready to run, */ - /* the function returns immediately, and the thread continues execution. */ - { - milliseconds = 0; - break; - } - default: /* Time tranrate from per 10ms tick count to per milli second. */ - milliseconds = (DWORD)ticks * 10; - break; - } - PbMilliSecSleep(static_cast(milliseconds)); - - return(RET_NORMAL); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbMilliSecSleep() - * ABSTRACT : Sleep Processing(Units of ms) - * NOTE : Cause the caller to sleep at the number of ticks specified by the argument - * ARGUMENT : u_int32 ul_mill_time Sleep time(Specified in millimeters) - * : 0 Discard the time slice - * : INFINITE Sleep permanently - * RETURN : RET_API Normal completion Note: Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API PbMilliSecSleep(u_int32 ul_mill_time) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - switch (ul_mill_time) { - case 0: - { - /* Discard the time slice */ - sched_yield(); - break; - } - case INFINITE: - { - /* Abort processing indefinitely */ - while (1) { - sleep(INFINITE); - } - } - default: - /* Sleep for Specified Time */ - usleep(ul_mill_time * 1000); - break; - } - - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SecSleep() - * ABSTRACT : Sleep Processing(s unit) - * NOTE : Cause the caller to sleep at the number of ticks specified by the argument - * ARGUMENT : u_int32 ul_time Sleep time(Specify in seconds) - * : 0 Discard the time slice - * : INFINITE Sleep permanently - * RETURN : RET_API Normal completion Note: Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API SecSleep(u_int32 ul_time) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - switch (ul_time) { - case 0: - { - /* Discard the time slice */ - sched_yield(); - break; - } - case INFINITE: - { - /* Abort processing indefinitely */ - while (1) { - sleep(INFINITE); - } - } - default: - /* Sleep for Specified Time */ - sleep(ul_time); - break; - } - - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : _sysMisc.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ diff --git a/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp b/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp deleted file mode 100755 index 3919239..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp +++ /dev/null @@ -1,1572 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbMsg.cpp - */ - -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ -#include -#include -#include -#include "_pbEvent_Internal.h" -#include "_pbInternalProc.h" - -#include -#include "WPF_STD_private.h" -#include "tchar.h" - -/*---------------------------------------------------------------------------------* - * Define * - *---------------------------------------------------------------------------------*/ -#define MSG_MAX_NUM_CTRL_MSGQUE (32) /* Maximum number of message queues */ -#define MSG_MAX_NUM_CTRL_THREAD (16) /* Maximum number of threads/process */ - -#define FULL_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 4) /* Message control table threshold (no free) */ -#define WARN_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 10) /* Message control table threshold (warning) */ - -/*---------------------------------------------------------------------------------* - * Structure * - *---------------------------------------------------------------------------------*/ -/*! - @brief Control table for message queues -*/ -typedef struct { - PNO pno; /**< Process No. */ - char name[MAX_QUEUE_NAME_SIZE]; /**< Message Que Name */ - HANDLE h_positioningbaselibrary_sender[MSG_MAX_NUM_CTRL_THREAD]; /**< handle to the Sender */ - HANDLE h_sender; /**< handle to the Sender */ - HANDLE h_receiver; /**< handle to the Receiver */ - HANDLE h_zc_sender; /**< handle to the ZcSender */ - uint8_t msg_rcv_buf[MAX_QUEUE_MSG_SIZE]; /**< Message buffer */ -} MSG_CTRL_DETAIL_INFO; - -/*! - @brief Control table for message queues -*/ -typedef struct { - MSG_CTRL_DETAIL_INFO info[MSG_MAX_NUM_CTRL_MSGQUE]; /**< message infomation */ - uint32_t use_cnt; /**< Use Counter */ - uint32_t rsv_cnt; /**< Reserve Counter */ -} MSG_CTRL_INFO; - -/*---------------------------------------------------------------------------------* - * Grobal Value * - *---------------------------------------------------------------------------------*/ -/** - Message control table - Note: Access to this instance shall be made through the operation module. -*/ -static MSG_CTRL_INFO g_msg_ctrl_tbl; // NOLINT(readability/nolint) global Class instance - -/** Message-control-table-locking Mutex handles */ -static HANDLE g_h_mtx; - -/*---------------------------------------------------------------------------------* - * Local Function Prototype * - *---------------------------------------------------------------------------------*/ -/* Message Control Table Operation Functions */ -static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* PNO setting */ -static PNO MsgGetPnoOfCtrlTbl(u_int32 idx); /* PNO acquisition */ -static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Message queue name setting */ -static char* MsgGetNameOfCtrlTbl(u_int32 idx); /* Get Message Queue Name */ -static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message queue handle setting */ -static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx); /* Get message queue handle */ -static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */ -static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */ -/* Message send handle setting*/ -static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset); -static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset); /* Get message send handle */ -static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */ -static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */ -static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx); /* Get message receive buffer */ -static u_int32 MsgSearchEmptyOfCtrlTbl(void); /* Retrieval of free space in control table */ -static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno); /* Retrieval of control table PNO */ -static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name); /* Retrieve control table queue name */ -static void MsgIncUseCntOfCtrlTbl(void); /* Control table usage counter increment */ -static void MsgDecUseCntOfCtrlTbl(void); /* Control table usage counter increment */ -static void MsgIncRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */ -static void MsgDecRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */ - -/* Mutex handling Functions for Accessing Message Control Tables */ -static void MsgCreateMutex(void); /* Mutex generating */ -/* Message send handle setting */ -/* static void MsgDeleteMutex(void); */ // Todo:Uncomment out after completion of implementation of termination processing -static void MsgLockMutex(void); /* Mutex retrieval */ -static void MsgUnlockMutex(void); /* Mutex release */ - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Initialize the message function - * - * Message control table initialization - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error - */ -RET_API MsgInit(void) { - RET_API ret_api = RET_NORMAL; - u_int32 i; - - MsgCreateMutex(); - - /* Control table initialization */ - memset(g_msg_ctrl_tbl.info, 0x00, sizeof(g_msg_ctrl_tbl.info)); - - for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) { - /* Empty character is set for the message queue name. */ - _tcscpy(g_msg_ctrl_tbl.info[i].name, ""); - } - g_msg_ctrl_tbl.use_cnt = 0; - g_msg_ctrl_tbl.rsv_cnt = 0; - - return ret_api; -} - -/** - * @brief - * Term - * - * @return RET_NORMAL Normal completion
- * RET_ERROR ABENDs - */ -RET_API MsgTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_ERROR; - RET_API ret; - EFrameworkunifiedStatus estatus; - HANDLE handle; - u_int32 idx; - PNO pno; - - MsgLockMutex(); - - /* Release Message Transmission/Reception Handle */ - for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) { - /* Receive handle acquisition */ - pno = MsgGetPnoOfCtrlTbl(idx); - if (pno != 0) { - /* For queue information for internal threads */ - /* Delete Message Queue */ - ret = PbDeleteMsg(pno); - if (ret != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \ - "[ret:%d, pno:%d]", ret, pno); - /* The module returns OK even if it fails. */ - } - } else { - /* Other than the above(Send handle to external process) */ - /* Get send handle */ - handle = MsgGetSenderHandleOfCtrlTbl(idx); - if (handle != NULL) { - estatus = FrameworkunifiedMcClose(handle); - if (estatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedMcClose ERROR " \ - "[estatus:%d, handle:%p]", estatus, handle); - /* The module returns OK even if it fails. */ - } else { - /* Message control table update */ - MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */ - - MsgSetNameOfCtrlTbl(idx, ""); /* Name */ - } - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \ - PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - } - } - - MsgUnlockMutex(); - - /* MsgDeleteMutex(); */ // Todo:Uncomment out after completion of implementation of termination processing - - /* TODO:Delete the shared memory for the message management table */ - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create the message queue - * - * Creates a message queue. - * This function is implemented on the assumption that a thread name is assigned by prctl() and then called from that thread. - * The generated message queue name is the same as the thread name. - * - * @param[in] pno Process number - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_CreateMsg(PNO pno) { // NOLINT(readability/nolint) interface - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - u_int32 idx; - HANDLE handle = NULL; - char name[MAX_QUEUE_NAME_SIZE]; - size_t len; - - /* If PNO is invalid (0), the parameter is abnormal and processing is not performed. */ - if (pno == 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno); - ret_api = RET_ERRPARAM; - } else { - /* Get Thread Name */ - (void)prctl(PR_GET_NAME, name); - - len = _tcslen(name); - if (len >= MAX_QUEUE_NAME_SIZE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Length of thread name is too long(>=%d). " \ - "[len:%zu]", MAX_QUEUE_NAME_SIZE, len); - ret_api = RET_ERRPARAM; - } else { - MsgLockMutex(); // LCOV_EXCL_BR_LINE 200: no branch - - /* Check if the specified PNO is already registered */ - idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch - - /* When the entry is already stored */ - if (idx != MSG_MAX_NUM_CTRL_MSGQUE) { - /* No processing */ - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \ - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \ - PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } else { - /* Not registered */ - /* Search for free space */ - idx = MsgSearchEmptyOfCtrlTbl(); - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE - /* Be impossible by design */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR " \ - "[idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE - - /* don't arrive here. */ - } else { - /* Create Message Queue */ - handle = McOpenReceiver(name); // LCOV_EXCL_BR_LINE 4: nsfw error - if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* In the event of failure */ - // LCOV_EXCL_START 5: standard lib error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenReceiver ERROR " \ - "[handle:%p, name:%s]", handle, name); - _pb_Exit(); - // LCOV_EXCL_STOP - /* don't arrive here. */ - } else { - /* If successful */ - /* Message control table update */ - MsgSetPnoOfCtrlTbl(idx, pno); /* PNO */ // LCOV_EXCL_BR_LINE 200: no branch - - MsgSetReceiverHandleOfCtrlTbl(idx, handle); /* Receive handle */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - - MsgSetNameOfCtrlTbl(idx, name); /* Name */ // LCOV_EXCL_BR_LINE 200: no branch - - /* Increment Message Control Table Usage Counter */ - MsgIncUseCntOfCtrlTbl(); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \ - "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \ - "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \ - PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \ - MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - } - } - - MsgUnlockMutex(); // LCOV_EXCL_BR_LINE 200: no branch - } - } - - return ret_api; -} - -/** - * @brief - * Delete the message queue - * - * Delete a message queue. - * Deleted from the message control table even if closing of the send/receive handle fails - * - * @param[in] pno - * - * @return RET_NORMAL Normal completion - */ -RET_API PbDeleteMsg(PNO pno) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - uint32_t idx; - uint32_t i; - HANDLE handle; - EFrameworkunifiedStatus estatus; - - idx = MsgSearchPnoOfCtrlTbl(pno); - if (idx != MSG_MAX_NUM_CTRL_MSGQUE) { - /* Receive handle acquisition */ - handle = MsgGetReceiverHandleOfCtrlTbl(idx); - if (handle != NULL) { - estatus = McClose(handle); - if (estatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \ - "[estatus:%d, handle:%p]", estatus, handle); - /* The module returns OK even if the Close fails. */ - } - } - - /* Get send handle */ - handle = MsgGetSenderHandleOfCtrlTbl(idx); - if (handle != NULL) { - estatus = McClose(handle); - if (estatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \ - "[estatus:%d, handle:%p]", estatus, handle); - /* The module returns OK even if the Close fails. */ - } - } - - /* Get send handle */ - handle = MsgGetZcSenderHandleOfCtrlTbl(idx); - if (handle != NULL) { - estatus = McZcClose(handle); - if (estatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McZcClose ERROR " \ - "[estatus:%d, handle:%p]", estatus, handle); - /* The module returns OK even if the Close fails. */ - } - } - - /* Message control table update */ - MsgSetPnoOfCtrlTbl(idx, 0); /* PNO */ - - for (i = 0; i < MSG_MAX_NUM_CTRL_THREAD; i++) { - MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, NULL, i); /* Send handle */ - } - - MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */ - - MsgSetReceiverHandleOfCtrlTbl(idx, NULL); /* Receive handle */ - - MsgSetNameOfCtrlTbl(idx, ""); /* Name */ - - /* Decrement Message Control Table Usage Counter */ - MsgDecUseCntOfCtrlTbl(); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \ - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \ - PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Receive the message - * - * Receive a message for the specified PNO.If the specified PNO is invalid, an error is returned. - * If the size of the received data exceeds the size specified in the parameter, an error is returned. - * - * @param[in] pno Process number - * @param[in] size Message size - * @param[out] msgbuf Pointer to message area - * @param[in] mode Not used - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface - RET_API ret_api = RET_RCVMSG; /* Results of this Module process */ - u_int32 idx; - HANDLE h_msg_que = NULL; - char source[MAX_QUEUE_NAME_SIZE]; - u_int32 cmd_id; - EFrameworkunifiedStatus rcv_sts; - u_int8* p_msg_rcv_buf; - u_int32 msg_len = 0; - void* p_rcv_data; - - /* Null Check */ - if (msgbuf == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf); - ret_api = RET_ERRPARAM; - } else if (pno == 0) { - /* PNO-invalid Check */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno); - ret_api = RET_ERRPARAM; - } else { - /* Search if the specified PNO is registered in the control table */ - idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch - /* Not stored */ - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR " \ - "[idx:%d, pno:0x%x]", idx, pno); - ret_api = RET_ERRPARAM; - } else { - /* If it is registered */ - /* Handle acquisition */ - h_msg_que = MsgGetReceiverHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg //NOLINT(whitespace/line_length) - if (h_msg_que == NULL) { // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg - /* Be impossible by design */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Msg_getMsgQueHandleOfCtrlTbl ERROR " \ - "[h_msg_que:%p, idx:%d]", h_msg_que, idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: recv handle created in _pb_CreateMsg - - /* don't arrive here. */ - } - - /* Get Message Buffer */ - p_msg_rcv_buf = MsgGetMsgRcvBufOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch - - /* Receive message */ - // LCOV_EXCL_BR_START 4: nsfw error - rcv_sts = McReceive(h_msg_que, - source, /* app that sent this message */ - &cmd_id, /* Command ID */ - MAX_QUEUE_MSG_SIZE, - (PVOID)p_msg_rcv_buf); - // LCOV_EXCL_BR_STOP - - if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* In the event of failure */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McReceive ERROR " \ - "[rcv_sts:%d, h_msg_que:%p, source:%s, cmd_id:0x%x]", rcv_sts, h_msg_que, source, cmd_id); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } else { - /* If successful */ - /* Size check */ - msg_len = McGetLength(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error - if ((msg_len <= size) && (msg_len > 0)) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* OK */ - /* Get Message */ - p_rcv_data = McGetDataPointer(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error - if (p_rcv_data == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - rcv_sts = McGetDataOfSize(p_msg_rcv_buf, *msgbuf, msg_len); - if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* Message acquisition failure */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "McGetDataOfSize ERROR [rcv_sts:%d]", rcv_sts); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \ - "McReceive/McGetDataOfSize SUCCESS [rcv_sts:%d, h_msg_que:%p, source:%s, " \ - "cmd_id:0x%x, msg_len:%d]", rcv_sts, h_msg_que, source, cmd_id, msg_len); - } - } else { - *msgbuf = p_rcv_data; - } - } else { - /* NG */ - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McGetLength ERROR " \ - "[size:%d < msg_len:%d]", size, msg_len); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } - } - } - } - - return ret_api; -} - -/** - * @brief - * Send the message - * - * For in-process communication - * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned. - * - * @param[in] pno Process number - * @param[in] size Message size - * @param[in] msgbuf Pointer to message storage area - * @param[in] mode Not used - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - u_int32 idx; - PCSTR msg_que_name; - HANDLE handle; /* handle to the send message queue */ - EFrameworkunifiedStatus estatus; - T_APIMSG_MSGBUF_HEADER *p_msg_header; - CID cid; - - /* Null Check */ - if (msgbuf == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf); - ret_api = RET_ERRPARAM; - } else if (pno == 0) { - /* PNO-invalid Check */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno); - ret_api = RET_ERRPARAM; - } else { - MsgLockMutex(); - - /* Check if the specified PNO is registered in the message control table */ - idx = MsgSearchPnoOfCtrlTbl(pno); - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { - /* Not stored */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! " \ - "[pno=%d]", pno); - - ret_api = RET_ERRPARAM; - } else { - /* If it is registered */ - /* Acquire transmission handle from management table */ - handle = MsgGetSenderHandleOfCtrlTbl(idx); - if (handle == NULL) { - /* Get message queue name */ - msg_que_name = MsgGetNameOfCtrlTbl(idx); - - /* Get send handle */ - handle = McOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When handle acquisition fails */ - if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \ - "[handle:%p, msg_que_name:%s]", handle, msg_que_name); - - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } - - /* Message control table update */ - MsgSetSenderHandleOfCtrlTbl(idx, handle); /* Send handle */ - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \ - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \ - PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - /* When handle acquisition is successful */ - if (handle != NULL) { - p_msg_header = reinterpret_cast(msgbuf); - cid = p_msg_header->hdr.cid; - - /* Messaging */ - estatus = McSend(handle, - "", /* Sender name */ - cid, /* Command ID */ - size, - msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When transmission fails */ - if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend ERROR " \ - "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McSend SUCCESS " \ - "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size); - } - - /* Close all handles at the time of termination */ - } - } - - MsgUnlockMutex(); - } - - return ret_api; -} - -/** - * @brief - * Acquire transmission buffer for in-process communication (for non-copy API) - * Gets the buffer for sending messages to the specified PNO.If the specified PNO is invalid, an error is returned. - * Set the send data in the acquired buffer and send it with _pb_ZcSndMsg(). - * - * @param[in] pno Process number - * @param[out] p_snd_buf Transmitting buffer - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_GetZcSndBuf(PNO pno, void** p_snd_buf) { // NOLINT(readability/nolint) interface - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - u_int32 idx; - PCSTR msg_que_name; - HANDLE handle; /* handle to the send message queue */ - - /* PNO-invalid Check */ - if (pno == 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno); - ret_api = RET_ERRPARAM; - } else { - MsgLockMutex(); - - /* Check if the specified PNO is registered in the message control table */ - idx = MsgSearchPnoOfCtrlTbl(pno); - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { - /* Not stored */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno); - - ret_api = RET_ERRPARAM; - } else { - /* If it is registered */ - /* Acquire transmission handle from management table */ - handle = MsgGetZcSenderHandleOfCtrlTbl(idx); - if (handle == NULL) { - /* Get message queue name */ - msg_que_name = MsgGetNameOfCtrlTbl(idx); - - /* Get send handle */ - handle = McZcOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error - if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When handle acquisition fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \ - "[handle:%p, msg_que_name:%s]", handle, msg_que_name); - - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } - - /* Message control table update */ - MsgSetZcSenderHandleOfCtrlTbl(idx, handle); /* Send handle */ - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \ - PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - - if (handle != NULL) { - /* When handle acquisition is successful */ - /* Get message send buffer */ - *p_snd_buf = McZcGetBuf(handle); // LCOV_EXCL_BR_LINE 4: nsfw error - if (*p_snd_buf == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When buffer acquisition fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } - - /* Close all handles at the time of termination */ - } - } - - MsgUnlockMutex(); - } - - return ret_api; -} - -/** - * @brief - * Send the message - * - * For in-process communication(for non-copy API) - * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned. - * Before calling this function, send data must be set in the area acquired by _pb_GetZcSndBuf(). - * - * @param[in] pno Process number - * @param[in] size Message size - * @param[in] mode Not used - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode) { // NOLINT(readability/nolint) interface - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - u_int32 idx; - HANDLE handle; /* handle to the send message queue */ - EFrameworkunifiedStatus estatus; - T_APIMSG_MSGBUF_HEADER *p_msg_header; - CID cid; - void* p_send_data; - - /* PNO-invalid Check */ - if (pno == 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno); - ret_api = RET_ERRPARAM; - } else { - MsgLockMutex(); - - /* Check if the specified PNO is registered in the message control table */ - idx = MsgSearchPnoOfCtrlTbl(pno); - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { - /* Not stored */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno); - - ret_api = RET_ERRPARAM; - } else { - /* If it is registered */ - /* Acquire transmission handle from management table */ - handle = MsgGetZcSenderHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf - if (handle == NULL) { // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "handle ERROR " \ - "[pno=%d, idx=%d]", pno, idx); - - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 200: sender handle set in _pb_GetZcSndBuf - } - /* When handle acquisition is successful */ - if (handle != NULL) { - /* Messaging */ - /* Set the transmission data in advance. */ - p_send_data = McZcGetBuf(handle); - if (p_send_data != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - p_msg_header = reinterpret_cast(p_send_data); - cid = p_msg_header->hdr.cid; - estatus = McZcSetParam(handle, cid, size); - if (estatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - estatus = McZcSend(handle); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When transmission fails */ - if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSend ERROR " \ - "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \ - idx, handle, cid, size); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } else { - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McZcSend SUCCESS " \ - "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \ - idx, handle, cid, size); - } - } else { - /* When parameter setting fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \ - "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size); - ret_api = RET_ERROR; - } - } else { - /* When parameter buffer acquisition fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcGetBuf ERROR " \ - "[idx:%d, handle:%p, size:%d]", idx, handle, size); - ret_api = RET_ERROR; - } - - /* Close all handles at the time of termination */ - } - } - - MsgUnlockMutex(); - } - - return ret_api; -} - -/** - * @brief - * Send the message - * - * For interprocess communication - * Sends a message to the specified process.If the specified process is invalid, an error is returned. - * - * Note: Since the data sent by this function is to be received by the dispatcher, the message header - * must not be included in the send data specified by the argument. - * - * @param[in] name Destination Process Name - * @param[in] cid Command ID - * @param[in] size Message size - * @param[in] msgbuf Pointer to message storage area - * @param[in] mode Not used - * - * @return RET_NORMAL Normal completion
- * RET_ERRPARAM Parameter error
- * RET_ERROR Other errors - */ -RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, // NOLINT(readability/nolint) interface - u_int16 mode) { - RET_API ret_api = RET_NORMAL; /* Results of this Module process */ - uint32_t thread_offset; - u_int32 idx; - HANDLE h_positioningbaselibrary_service = NULL; - EFrameworkunifiedStatus estatus; - size_t len; - HANDLE h_app; - - /* Null Check */ - if ((name == NULL) || (msgbuf == NULL)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \ - "[name:%p, msgbuf:%p]", name, msgbuf); - ret_api = RET_ERRPARAM; - } else { - h_app = _pb_GetAppHandle(); - - len = _tcslen(name); - if (len >= MAX_QUEUE_NAME_SIZE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \ - "Length of thread name is too long(>=%d). [len:%zu]", MAX_QUEUE_NAME_SIZE, len); - ret_api = RET_ERRPARAM; - } else { - thread_offset = PbGetLocalTid(); - - MsgLockMutex(); - - idx = MsgSearchNameOfCtrlTbl(name); - - if (idx != MSG_MAX_NUM_CTRL_MSGQUE) { - h_positioningbaselibrary_service = MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, thread_offset); - if (h_positioningbaselibrary_service == NULL) { - h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When handle acquisition fails */ - if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \ - "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } else { - /* Message control table update */ - MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */ - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \ - "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \ - idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), \ - MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), \ - MsgGetReceiverHandleOfCtrlTbl(idx), MsgGetNameOfCtrlTbl(idx)); - } - } - } else { - /* Search for free space */ - idx = MsgSearchEmptyOfCtrlTbl(); - if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE - /* Be impossible by design */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR!! " \ - "[idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE - - /* don't arrive here. */ - } else { - /* Get send handle */ - h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When handle acquisition fails */ - if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \ - "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } else { - /* Message control table update */ - MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */ - - MsgSetNameOfCtrlTbl(idx, name); /* Name */ - - /* Increment Message Control Table Usage Counter */ - MsgIncUseCntOfCtrlTbl(); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \ - "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \ - "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \ - PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \ - MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \ - MsgGetNameOfCtrlTbl(idx)); - } - } - } - - MsgUnlockMutex(); - /* When handle acquisition is successful */ - if (h_positioningbaselibrary_service != NULL) { - /* Messaging */ - estatus = FrameworkunifiedSendMsg(h_positioningbaselibrary_service, cid, size, msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When transmission fails */ - if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg ERROR!! " \ - "[name=%s, estatus=%d, h_positioningbaselibrary_service=%p, cid=%d, size=%d]", \ - name, estatus, h_positioningbaselibrary_service, cid, size); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } else { - FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__, "Send message = " \ - "[Destination:%s][CID:0x%X]", name, cid); - } - /* Close all handles at the time of termination */ - } - } - } - - return ret_api; -} - -/*---------------------------------------------------------------------------------* - * Local Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * PNO setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] pno Process number - */ -static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, pno:%d]", idx, pno); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } else { - g_msg_ctrl_tbl.info[idx].pno = pno; - } - - return; -} - -/** - * @brief - * PNO acquisition(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] pno Process number - */ -static PNO MsgGetPnoOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].pno; -} - -/** - * @brief - * Message queue name setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] name Message queue name - */ -static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, name:%s]", idx, name); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - _tcscpy(g_msg_ctrl_tbl.info[idx].name, name); - - return; -} - -/** - * @brief - * Get Message Queue Name(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * - * @return Message queue name - */ -static char* MsgGetNameOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].name; -} - -/** - * @brief - * Message reception handle setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] handle Message queue handle - */ -static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } else { - g_msg_ctrl_tbl.info[idx].h_receiver = handle; - } - - return; -} - -/** - * @brief - * Get message reception handle(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * - * @return Message queue handle - */ -static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].h_receiver; -} - -/** - * @brief - * Message send handle setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] handle Message queue handle - */ -static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } else { - g_msg_ctrl_tbl.info[idx].h_sender = handle; - } - - return; -} - -/** - * @brief - * Get message send handle(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * - * @return Message queue handle - */ -static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].h_sender; -} - - -/** - * @brief - * Positioningbaselibrary message send handle setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] handle Message queue handle - * @param[in] offset Local thread ID - */ -static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } else { - g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset] = handle; - } - - return; -} - -/** - * @brief - * Positioningbaselibrary message send handle acquisition(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] offset Local thread ID - * - * @return Message queue handle - */ -static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset]; -} - -/** - * @brief - * Message send handle setting(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * @param[in] handle Message queue handle - */ -static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } else { - g_msg_ctrl_tbl.info[idx].h_zc_sender = handle; - } - - return; -} - -/** - * @brief - * Get message send handle(Message control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control Table Element Number - * - * @return Message queue handle - */ -static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].h_zc_sender; -} - -/** - * @brief - * Get message receive buffer(Message control table) - * - * @param[in] idx Control Table Element Number - * - * @return Pointer to message receive buffer - */ -static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx) { - /* check index */ - if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - - /* don't arrive here. */ - } - - return g_msg_ctrl_tbl.info[idx].msg_rcv_buf; -} - -/** - * @brief - * Search unused area(Message control table) - * - * Returns the index (minimum value) for accessing the unused area in the message control table.
- * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE)
- * when no unused area exists - * - * @return Index for access(Unused area exists.)
- * Maximum mutex management value(No unused area) - */ -static u_int32 MsgSearchEmptyOfCtrlTbl(void) { - int32 ret; - u_int32 idx; - - for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) { - ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, ""); - - /* For unused space */ - if (ret == 0) { - break; - } - } - - return idx; -} - -/** - * @brief - * PNO search(Message control table) - * - * Retrieves whether the specified PNO is already registered in the message control table.
- * If it is registered, the access index is returned.If it is not stored,
- * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE). - * - * @param[in] pno Process number - * - * @return Index for access(If it is registered)
- * Maximum value of message queue management(Not stored) - */ -static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno) { - u_int32 idx; - PNO lPno; - - for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) { - lPno = MsgGetPnoOfCtrlTbl(idx); - - /* If there is a match */ - if (lPno == pno) { - break; - } - } - - return idx; -} - - -/** - * @brief - * Queue name search(Message control table) - * - * Retrieves whether the specified queue name is already registered in the message control table.
- * If it is registered, the access index is returned.If it is not stored,
- * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE). - * - * @param[in] Name queue-name - * - * @return Index for access(If it is registered)
- * Maximum value of message queue management(Not stored) - */ -static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name) { - int32 ret; - u_int32 idx; - - for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) { - ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, name); - - /* If there is a match */ - if (ret == 0) { - break; - } - } - - return idx; -} - - -/** - * @brief - * Creation of Mutex for accessing the message control table - */ -static void MsgCreateMutex(void) { - g_h_mtx = _pb_CreateMutex(NULL, 0, "Msg_Mutex"); - if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL - // LCOV_EXCL_START 200: can not be not NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx); - _pb_Exit(); - // LCOV_EXCL_STOP - - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Acquire Mutex for accessing the message control table - */ -static void MsgLockMutex(void) { - DWORD ret; - ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed - if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \ - "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed - - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Releasing the Mutex for accessing the message control table - */ -static void MsgUnlockMutex(void) { - BOOL ret; - ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed - if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \ - "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed - - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Obtain dump information - * - * @param[out] pBuf Dump info - * @param[in/out] pLen Buffer size - */ -void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen) { - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufPositioningbaselibrarySender[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufTmp[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufMsg[DEBUG_DUMP_MAX_SIZE]; - uint32_t i; - uint32_t e; - uint8_t cnt = 0; - - if ((pBuf != NULL) && (pLen != NULL)) { - memset(&buf[0], 0x00, sizeof(buf)); - memset(&bufMsg[0], 0x00, sizeof(bufMsg)); - for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) { - memset(&bufPositioningbaselibrarySender[0], 0x00, sizeof(bufPositioningbaselibrarySender)); - for (e = 0; e < MSG_MAX_NUM_CTRL_THREAD; e++) { - memset(&bufTmp[0], 0x00, sizeof(bufTmp)); - snprintf(reinterpret_cast(&bufTmp[0]), sizeof(bufTmp), - "[%02d]%10p ", e, g_msg_ctrl_tbl.info[i].h_positioningbaselibrary_sender[e]); - strncat(reinterpret_cast(&bufPositioningbaselibrarySender[0]), reinterpret_cast(&bufTmp[0]), \ - strlen(reinterpret_cast(&bufTmp[0]))); - } - memset(&bufTmp[0], 0x00, sizeof(bufTmp)); - snprintf(reinterpret_cast(&bufTmp[0]), sizeof(bufTmp), - "\n [%02d] pno:0x%04x, name:%16s, hSnd:%10p, hRcv:%10p, hPSnd:%s", - i, - g_msg_ctrl_tbl.info[i].pno, - g_msg_ctrl_tbl.info[i].name, - g_msg_ctrl_tbl.info[i].h_sender, - g_msg_ctrl_tbl.info[i].h_receiver, - &bufPositioningbaselibrarySender[0]); - strncat(reinterpret_cast(&bufMsg[0]), reinterpret_cast(&bufTmp[0]), \ - strlen(reinterpret_cast(&bufTmp[0]))); - if (((i+1) % 8) == 0) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Message-%d%s", - cnt, - &bufMsg[0]); - memcpy(pBuf, &buf[0], sizeof(buf)); - pBuf = reinterpret_cast((reinterpret_cast(pBuf)) + sizeof(buf)); - memset(&bufMsg[0], 0x00, sizeof(bufMsg)); - if (cnt >= *pLen) { - break; - } - } - } - if (cnt < *pLen) { - if (bufMsg[0] != 0x00) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Message-%d%s", - cnt, - &bufMsg[0]); - memcpy(pBuf, &buf[0], sizeof(buf)); - } - *pLen = cnt; - } - } -} - -/** - * @brief - * Message Control Table Usage Counter Increment - * - * @param[in] none - */ -static void MsgIncUseCntOfCtrlTbl(void) { - g_msg_ctrl_tbl.use_cnt++; - return; -} - -/** - * @brief - * Message control table usage counter decrement - * - * @param[in] none - */ -static void MsgDecUseCntOfCtrlTbl(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - g_msg_ctrl_tbl.use_cnt--; - return; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Message Control Table Reserved Counter Increment - * - * @param[in] none - */ -static void MsgIncRsvCntOfCtrlTbl(void) { - g_msg_ctrl_tbl.rsv_cnt++; - return; -} - -/** - * @brief - * Message Control Table Reserved Counter Decrement - * - * @param[in] none - */ -static void MsgDecRsvCntOfCtrlTbl(void) { - g_msg_ctrl_tbl.rsv_cnt--; - return; -} - -/** - * @brief - * Resource Acquisition Decision(Message control table) - * - * @param[in] none - * - * @return BOOL - * @retval TRUE : Normal - * @retval FALSE : Anomaly (Resource shortage) - */ -BOOL _pb_GetMsgResource(void) { - BOOL ret = TRUE; - uint32_t cnt; - - MsgLockMutex(); - - /* Increment Message Control Table Reservation Counter */ - MsgIncRsvCntOfCtrlTbl(); - - cnt = g_msg_ctrl_tbl.use_cnt + g_msg_ctrl_tbl.rsv_cnt; - if (cnt >= FULL_MSG_NUM_CTRL_MSGQUE) { - ret = FALSE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \ - "[FATAL][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt); - } else if (cnt >= WARN_MSG_NUM_CTRL_MSGQUE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \ - "[WARN][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt); - } - - MsgUnlockMutex(); - - return ret; -} - -/** - * @brief - * Resource release(Message control table) - * - * @param[in] none - * - * @return none - */ -void _pb_ReleaseMsgResource(void) { - MsgLockMutex(); - - /* Decrement Message Control Table Reservation Counter */ - MsgDecRsvCntOfCtrlTbl(); - - MsgUnlockMutex(); - - return; -} diff --git a/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp b/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp deleted file mode 100755 index 06254ab..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp +++ /dev/null @@ -1,1423 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbMutex.cpp - */ - -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ - -#ifndef PT_PB_MUTEX_STUB__CWORD71_ - -#include -#include "_pbInternalProc.h" -#include -#include -#include "WPF_STD_private.h" -#include "tchar.h" - -/*---------------------------------------------------------------------------------* - * Define * - *---------------------------------------------------------------------------------*/ -/* Mutex control table name (Shared Memory) */ -#define MUTEX_CTRL_TBL_NAME __TEXT("POS_BASE_MUTEX_TABLE") - -/* - Max. available Lock ID - Note : Lock ID application is 1 (for BaseAPI initialization) + 1 (for Mutex function control) + 30 (for provision) = 32 -*/ -#define MAX_CTRL_MUTEX_NUM (30) - -#define FULL_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 4) /** Mutex control data threshold (no free) */ -#define WARN_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 10) /** Mutex control data threshold (warning) */ - -/* - ID needs to be aplicated - - If you increase or decrease the IDs, define maximum number of managed LOCK IDs and - the default setting of "Lock ID Resource List" must also be changed. -*/ -#define MUTEX_LOCK_ID_0 LOCK_POS_MTX_2 /* Mutex management-information-exclusive control */ -#define MUTEX_LOCK_ID_1 LOCK_POS_MTX_3 -#define MUTEX_LOCK_ID_2 LOCK_POS_MTX_4 -#define MUTEX_LOCK_ID_3 LOCK_POS_MTX_5 -#define MUTEX_LOCK_ID_4 LOCK_POS_MTX_6 -#define MUTEX_LOCK_ID_5 LOCK_POS_MTX_7 -#define MUTEX_LOCK_ID_6 LOCK_POS_MTX_8 -#define MUTEX_LOCK_ID_7 LOCK_POS_MTX_9 -#define MUTEX_LOCK_ID_8 LOCK_POS_MTX_10 -#define MUTEX_LOCK_ID_9 LOCK_POS_MTX_11 -#define MUTEX_LOCK_ID_10 LOCK_POS_MTX_12 -#define MUTEX_LOCK_ID_11 LOCK_POS_MTX_13 -#define MUTEX_LOCK_ID_12 LOCK_POS_MTX_14 -#define MUTEX_LOCK_ID_13 LOCK_POS_MTX_15 -#define MUTEX_LOCK_ID_14 LOCK_POS_MTX_16 -#define MUTEX_LOCK_ID_15 LOCK_POS_MTX_17 -#define MUTEX_LOCK_ID_16 LOCK_POS_MTX_18 -#define MUTEX_LOCK_ID_17 LOCK_POS_MTX_19 -#define MUTEX_LOCK_ID_18 LOCK_POS_MTX_20 -#define MUTEX_LOCK_ID_19 LOCK_POS_MTX_21 -#define MUTEX_LOCK_ID_20 LOCK_POS_MTX_22 -#define MUTEX_LOCK_ID_21 LOCK_POS_MTX_23 -#define MUTEX_LOCK_ID_22 LOCK_POS_MTX_24 -#define MUTEX_LOCK_ID_23 LOCK_POS_MTX_25 -#define MUTEX_LOCK_ID_24 LOCK_POS_MTX_26 -#define MUTEX_LOCK_ID_25 LOCK_POS_MTX_27 -#define MUTEX_LOCK_ID_26 LOCK_POS_MTX_28 -#define MUTEX_LOCK_ID_27 LOCK_POS_MTX_29 -#define MUTEX_LOCK_ID_28 LOCK_POS_MTX_30 -#define MUTEX_LOCK_ID_29 LOCK_POS_MTX_31 -#define MUTEX_LOCK_ID_30 LOCK_POS_MTX_32 - -typedef int32 LOCK_ID; - -/*---------------------------------------------------------------------------------* - * Structure * - *---------------------------------------------------------------------------------*/ -/*! - @brief Mutex control information(Interprocess common-details) - */ -typedef struct { - LOCK_ID lock_id; /**< Lock ID */ - TCHAR name[NAME_MAX]; /**< Mutex Name */ - int32 ref_cnt; /**< Reference Counter */ - uint32_t thread_id; /**< Thread IDs while Lock is being acquired (Initial value:0) Note: For debugging */ - BOOL is_rel_fail; /**< Release failure information (Failed:TRUE) Note: For debugging */ - BOOL is_forbid_access; /**< Deletion occurred during Lock acquisition (Deletion occurred:TRUE) Note: For debugging */ -} MUTEX_CTRL_SHARED_DETAIL; - -/*! - @brief Mutex control information (Interprocess common) - */ -typedef struct { - MUTEX_CTRL_SHARED_DETAIL detail[MAX_CTRL_MUTEX_NUM]; /**< Common Infomation */ - uint32_t use_cnt; /**< Use Counter */ - uint32_t rsv_cnt; /**< Reserve Counter */ -} MUTEX_CTRL_SHARED_INFO; - -/*! - @brief Mutex control information -*/ -typedef struct { - HANDLE handle[MAX_CTRL_MUTEX_NUM]; /**< Mutex Handle */ - int32 ref_cnt[MAX_CTRL_MUTEX_NUM]; /**< Reference Counter */ - MUTEX_CTRL_SHARED_INFO* info; /**< Common Infomation */ -} MUTEX_CTRL_INFO; - -/*---------------------------------------------------------------------------------* - * Grobal Value * - *---------------------------------------------------------------------------------*/ -/** - Mutex control table pointer (Partial shared memory) - Note: Access to this instance shall be made through the operation module. - */ -static MUTEX_CTRL_INFO g_mutex_ctrl_tbl; // NOLINT(readability/nolint) global class instance - -static HANDLE g_h_mtx; /** Mutex control-information-locking Mutex handle */ -static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18788 compliant - - -/** Lock ID Resource List */ -static const LOCK_ID kLockIdList[MAX_CTRL_MUTEX_NUM] = { - MUTEX_LOCK_ID_1, - MUTEX_LOCK_ID_2, - MUTEX_LOCK_ID_3, - MUTEX_LOCK_ID_4, - MUTEX_LOCK_ID_5, - MUTEX_LOCK_ID_6, - MUTEX_LOCK_ID_7, - MUTEX_LOCK_ID_8, - MUTEX_LOCK_ID_9, - MUTEX_LOCK_ID_10, - MUTEX_LOCK_ID_11, - MUTEX_LOCK_ID_12, - MUTEX_LOCK_ID_13, - MUTEX_LOCK_ID_14, - MUTEX_LOCK_ID_15, - MUTEX_LOCK_ID_16, - MUTEX_LOCK_ID_17, - MUTEX_LOCK_ID_18, - MUTEX_LOCK_ID_19, - MUTEX_LOCK_ID_20, - MUTEX_LOCK_ID_21, - MUTEX_LOCK_ID_22, - MUTEX_LOCK_ID_23, - MUTEX_LOCK_ID_24, - MUTEX_LOCK_ID_25, - MUTEX_LOCK_ID_26, - MUTEX_LOCK_ID_27, - MUTEX_LOCK_ID_28, - MUTEX_LOCK_ID_29, - MUTEX_LOCK_ID_30, -}; - -/* - Mutex property information (Information for each process) - _pb_CreateMutex calls -> 1 - DeleteMutex calls -> 0 - Only "1" can be used in the process. - */ -BOOL g_is_mutex_owner_tbl[MAX_CTRL_MUTEX_NUM]; - -/*---------------------------------------------------------------------------------* - * Local Function Prototype * - *---------------------------------------------------------------------------------*/ -/* Mutex Control Table Manipulation Functions */ -static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id); /* Set Lock ID */ -static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx); /* Get Lock ID */ -static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Set Mutex name */ -static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set Mutex handle */ -static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx); /* Get Mutex Handle */ -static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid); /* Set thread ID while Lock is being acquired */ -static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx); /* Get thread ID while Lock is being acquired */ -static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag); /* Set release failure information */ -static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag); /* Set deletion occurrence while Lock is being acquired */ -static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex); /* Get index for access */ -static void MutexIncRefCntOfCtrlTbl(u_int32 idx); /* Increment Mutex reference counter */ -static void MutexDecRefCntOfCtrlTbl(u_int32 idx); /* Decrement Mutex reference counter */ -static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx); /* Get Mutex reference counter */ -static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx); /* Get mutex reference counter (in-process) */ -static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name); /* Search mutex name */ -static u_int32 MutexSearchEmptyOfCtrlTbl(void); /* Search unused area */ -static void MutexIncUseCntOfCtrlInfo(void); /* Increment Mutex using counter */ -static void MutexDecUseCntOfCtrlInfo(void); /* Decrement Mutex using counter */ -static void MutexIncRsvCntOfCtrlInfo(void); /* Increment Mutex reserved counter */ -static void MutexDecRsvCntOfCtrlInfo(void); /* Decrement Mutex reserved counter */ - -/* Mutex ownership-information manipulation functions */ -static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag); /* Set ownership-information */ -static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx); /* Get ownership-information */ - -/* Mutex manipulation functions for accessing Mutex control tables */ -static void MutexCreateMutex(void); /* Create Mutex */ -static void MutexLockMutex(void); /* Get Mutex */ -static void MutexUnlockMutex(void); /* Release Mutex */ -static void MutexDeleteMutex(void); /* Delete Mutex */ - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Initialize the mutex function - * - * Call the in-process initialization API for locking between processes that provide CLS.
- * Create shared memory for a Mutex control table.
- * Create a mutex for accessing Mutex control info.
- * If an error occurs during internal processing of this API, subsequent normal operations cannot be performed, so call _pb_Exit(). - * - * @return RET_NORMAL - */ -RET_API MutexInit(void) { - RET_API ret_api = RET_NORMAL; - MUTEX_CTRL_SHARED_INFO **pp_tbl; - u_int32 idx; - - memset(g_mutex_ctrl_tbl.handle, 0, sizeof(g_mutex_ctrl_tbl.handle)); - memset(g_mutex_ctrl_tbl.ref_cnt, 0, sizeof(g_mutex_ctrl_tbl.ref_cnt)); - - /* Set pointer to Mutex control table */ - pp_tbl = &(g_mutex_ctrl_tbl.info); - - MutexCreateMutex(); /* Create Mutex for accessing Mutex control info */ - - MutexLockMutex(); /* Get Mutex for accessing Mutex control info */ - - /* Open the Mutex control table shared memory */ - g_h_shm = OpenSharedMemory((TCHAR*)(MUTEX_CTRL_TBL_NAME), // NOLINT(readability/casting) - sizeof(MUTEX_CTRL_SHARED_INFO)); - - /* If called for the first time within all processes, an error occurs and the following processing is performed. */ - if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be other val - /* Create shared memory for Mutex control table */ - // LCOV_EXCL_BR_LINE 200: can not return NULL - g_h_shm = CreateSharedMemory((TCHAR*)MUTEX_CTRL_TBL_NAME, // NOLINT(readability/casting) - sizeof(MUTEX_CTRL_SHARED_INFO)); - if (g_h_shm == NULL) /* In case of an error */ { // LCOV_EXCL_BR_LINE 200: can not return NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR [hShm:%p]", g_h_shm); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: cannot return NULL - /* don't arrive here. */ - } - } - - MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */ - - /* Set addresses of the acquired shared memory as a pointer of the Mutex control table. */ - *pp_tbl = reinterpret_cast(GetSharedMemoryPtr(g_h_shm)); - - /* Initialize various information of control table */ - for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) { - /* Set Lock ID in Mutex control table(Overwrite from the second process onwards) */ - MutexSetLockIdOfCtrlTbl(idx, kLockIdList[idx]); - - MutexSetFlagOfOwnerTbl(idx, FALSE); - } - - return ret_api; -} - -/** - * @brief - * Terminate - */ -RET_API MutexTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - - CloseSharedMemory(g_h_shm); - - MutexDeleteMutex(); - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create Mutex - * - * Create a named mutex that can be locked between processes. - * - * @param[in] lp_mutex_attributes Security descriptor(Unused) - * @param[in] b_initial_owner Initial owner flag(Unused) - * @param[in] lp_name Mutex name - * - * @return Except NULL Handle of the created mutex (Management information pointer)
- * NULL ABEND - */ -HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lp_mutex_attributes, // NOLINT(readability/nolint) WPF_SYSAPI.h API - BOOL b_initial_owner, LPCTSTR lp_name) { - int32 idx; /* For accessing Mutex control table */ - HANDLE h_mutex = NULL; /* Mutex handle */ - void *p_addr; - int32 errno; - LOCK_ID lock_id; - size_t len; - - /* Null check */ - if (lp_name == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!!"); - } else { - len = _tcslen(lp_name); - if (len >= NAME_MAX) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \ - "Length of mutex name is too long(>=%d). [len:%zu]", NAME_MAX, len); - } else { - MutexLockMutex(); /* Get Mutex for accessing Mutex control info */ - - /* Retrieve whether the specified mutex name exists in the Mutex control table */ - idx = MutexSearchNameOfCtrlTbl(lp_name); - - /* Already assigned */ - if (idx != MAX_CTRL_MUTEX_NUM) { - /* Get mutex handle from Mutex control table */ - h_mutex = MutexGetMutexHandleOfCtrlTbl(idx); - - /* First-time creation within a process */ - if (h_mutex == NULL) { - /* Get Lock ID */ - lock_id = MutexGetLockIdOfCtrlTbl(idx); - - /* Lock information mapping (CLS) */ - p_addr = CL_LockMap(lock_id); // LCOV_EXCL_BR_LINE 4: nsfw error - /* In case of an error */ - if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* Output an error log and return an error value */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockMap ERROR!! [p_addr:%p, errno:%d]", p_addr, errno); - } else { - /* Successful allocation */ - /* Set Mutex handle in the mutex management table */ - MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr); - - h_mutex = (HANDLE)p_addr; - } - } - - if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: h_mutex can not be NULL - /* Increment Mutex reference counter */ - MutexIncRefCntOfCtrlTbl(idx); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, - "### MUTEX TABLE INFORMATION # (+) idx:%d HANDLE:%p, " \ - "ref_cnt:%d, LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d", - idx, - g_mutex_ctrl_tbl.handle[idx], - g_mutex_ctrl_tbl.ref_cnt[idx], - g_mutex_ctrl_tbl.info->detail[idx].lock_id, - g_mutex_ctrl_tbl.info->detail[idx].name, - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt, - g_mutex_ctrl_tbl.info->detail[idx].thread_id, - g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail, - g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access); - } - } else { - /* For a new assignment */ - /* Get the free space in the mutex management table. */ - idx = MutexSearchEmptyOfCtrlTbl(); - - /* Get Lock ID */ - lock_id = MutexGetLockIdOfCtrlTbl(idx); - - /* Lock information mapping (CLS) */ - p_addr = CL_LockMap(lock_id); - - /* In case of an error */ - if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* Output an error log and return an error value. */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR!! " \ - "[p_addr:%p, errno:%d] In _pb_CreateMutex", p_addr, errno); - } else { - /* Successful allocation */ - /* Set Mutex Hanlde in the mutex management table */ - MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr); - - /* Set the mutex name in the mutex management table */ - MutexSetMutexNameOfCtrlTbl(idx, lp_name); - - /* Increment Mutex reference counter */ - MutexIncRefCntOfCtrlTbl(idx); - - /* Increment mutex using counter */ - MutexIncUseCntOfCtrlInfo(); - - h_mutex = (HANDLE)p_addr; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, - "### MUTEX TABLE INFORMATION # (++) idx:%d HANDLE:%p, ref_cnt:%d, " \ - "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d", - idx, - g_mutex_ctrl_tbl.handle[idx], - g_mutex_ctrl_tbl.ref_cnt[idx], - g_mutex_ctrl_tbl.info->detail[idx].lock_id, - g_mutex_ctrl_tbl.info->detail[idx].name, - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt, - g_mutex_ctrl_tbl.info->detail[idx].thread_id, - g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail, - g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access); - } - } - - if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - /* Update Mutex ownership */ - MutexSetFlagOfOwnerTbl(idx, TRUE); - } - - /* Release the Mutex for accessing Mutex control info */ - MutexUnlockMutex(); - } - } - - return h_mutex; -} - -/** - * @brief - * Delete the mutex - * - * Decrement the Mutex reference counter and delete it when it reaches zero. - * - * @param[in] h_mutex Mutex handle (CreateMutex return value) - * - * @return WAIT_OBJECT_0 Normal completion
- * WAIT_FAILED ABEND - */ -DWORD PbDeleteMutex(HANDLE h_mutex) { - DWORD lret = WAIT_OBJECT_0; - u_int32 idx; - int32 ref_cnt; - int32 ret; - BOOL is_owner; - uint32_t tid; - - /* Null check */ - if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL - } else { - MutexLockMutex(); /* Get Mutex for accessing Mutex control info */ - - /* Retrieve the index of the management table containing the Mutex handles */ - idx = MutexGetIdxOfCtrlTbl(h_mutex); - /* When the specified Mutex handle is not registered */ - if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "Argment ERROR [h_mutex:%p]", h_mutex); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM - } else { - /* If it is registered */ - /* Determinate its ownership */ - is_owner = MutexGetFlagOfOwnerTbl(idx); - if (is_owner == TRUE) { - /* Get Mutex reference counter */ - ref_cnt = MutexGetRefCntOfCtrlTbl(idx); - - /* No clients are using the specified Mutex. */ - if ((ref_cnt - 1) <= 0) { - /* Lock information unmapping (CLS) */ - ret = CL_LockUnmap(reinterpret_cast(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error - /* When an error occurs */ - if (ret == -1) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error - } else { - /* If successful */ - /* Remove Mutex hanlde from Mutex control table */ - MutexSetMutexHandleOfCtrlTbl(idx, NULL); - - /* Delete the mutex name from the Mutex control table */ - MutexSetMutexNameOfCtrlTbl(idx, ""); - - /* Update Mutex ownership */ - MutexSetFlagOfOwnerTbl(idx, FALSE); - - /* Decrement Mutex reference counter */ - MutexDecRefCntOfCtrlTbl(idx); - - /* Decrement mutex using counter */ - MutexDecUseCntOfCtrlInfo(); - - tid = MutexGetTidOfCtrlTbl(idx); - if (tid != 0) { // LCOV_EXCL_BR_LINE 200: tid can not be 0 - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - MutexSetIsForbidAccessOfCtrlTbl(idx, TRUE); // LCOV_EXCL_LINE 200: tid can not be 0 - } - - /* Initialize debug information */ - MutexSetTidOfCtrlTbl(idx, 0); - MutexSetIsRelFailOfCtrlTbl(idx, FALSE); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, - "### MUTEX TABLE INFORMATION # (--) idx:%d HANDLE:%p, ref_cnt(local):%d, " \ - "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d", - idx, - g_mutex_ctrl_tbl.handle[idx], - g_mutex_ctrl_tbl.ref_cnt[idx], - g_mutex_ctrl_tbl.info->detail[idx].lock_id, - g_mutex_ctrl_tbl.info->detail[idx].name, - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt, - g_mutex_ctrl_tbl.info->detail[idx].thread_id, - g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail, - g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access); - } - } else { - /* If exists */ - /* Determine if any clients are referencing in the process */ - ref_cnt = MutexGetRefCntLocalOfCtrlTbl(idx); - if ((ref_cnt - 1) <= 0) { // LCOV_EXCL_BR_LINE 200: ref_cnt can not bigger than 1 - // LCOV_EXCL_START 200: ref_cnt can not bigger than 1 - //AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Lock information unmapping (CLS) */ - ret = CL_LockUnmap(reinterpret_cast(h_mutex)); - /* When an error occurs */ - if (ret == -1) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR"); - lret = WAIT_FAILED; /* ABEND */ - } else { - /* If successful */ - /* Remove Mutex Hanlde from the Mutex control table */ - MutexSetMutexHandleOfCtrlTbl(idx, NULL); - - /* Update Mutex ownership */ - MutexSetFlagOfOwnerTbl(idx, FALSE); - } - // LCOV_EXCL_STOP - } - - if (lret == WAIT_OBJECT_0) { - /* Decrement Mutex refernce counter */ - MutexDecRefCntOfCtrlTbl(idx); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, - "### MUTEX TABLE INFORMATION # (-) idx:%d HANDLE:%p, ref_cnt(local):%d, " \ - "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d", - idx, - g_mutex_ctrl_tbl.handle[idx], - g_mutex_ctrl_tbl.ref_cnt[idx], - g_mutex_ctrl_tbl.info->detail[idx].lock_id, - g_mutex_ctrl_tbl.info->detail[idx].name, - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt, - g_mutex_ctrl_tbl.info->detail[idx].thread_id, - g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail, - g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access); - } - } - - } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE - /* If it is not the owner */ - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE - } - } - - MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */ - } - - return lret; -} - -/** - * @brief - * Mutex Lock - * - * Take ownership of the mutex and start locking. - * - * @param[in] h_mutex Mutex handle(CreateMutex return value) - * @param[in] timeout Timeout (Millisecond) - * - * @return WAIT_OBJECT_0 Succeeded to get ownership
- * WAIT_TIMEOUT Failed to get ownership (Timeout)
- * WAIT_FAILED Failed to get ownership (Error) - */ -DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout) { - DWORD lret = WAIT_OBJECT_0; - int32 ret; - DWORD time_out_cnt = 0; - u_int32 idx; - BOOL is_owner; - uint32_t tid; - - /* Null check */ - if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL - } else { - /* Retrieve the index of the management table containing the Mutex handles */ - idx = MutexGetIdxOfCtrlTbl(h_mutex); - /* When the specified Mutex handle is not registered */ - if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [h_mutex:%p, idx:%d]", \ - h_mutex, idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM - } else { - /* If it is registered */ - /* Determinate ownership */ - is_owner = MutexGetFlagOfOwnerTbl(idx); - if (is_owner == TRUE) { - tid = PbGetTid(); - - /* No timeout specified */ - if (timeout == INFINITE) { // LCOV_EXCL_BR_LINE 6: timeout will not be other case - /* Get Lock (CLS) */ - ret = CL_LockGet(reinterpret_cast(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) /* In case of ABEND */ { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error - } else { - /* Set thread ID during lock */ - MutexSetTidOfCtrlTbl(idx, tid); - } - } else { - // LCOV_EXCL_START 6: timeout will not be other case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Timeout specified */ - while (1) { - /* Get Lock (CLS) */ - ret = CL_LockNowait(reinterpret_cast(h_mutex)); - if (ret != 0) /* In case of ABEND */ { - /* Invalid parameter */ - if (ret != EBUSY) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret); - lret = WAIT_FAILED; /* ABEND */ - break; - } - - time_out_cnt++; - if (time_out_cnt <= timeout) { - usleep(1000); - } else { - /* Timeout error */ - lret = WAIT_TIMEOUT; - break; - } - } else { - /* Successful acquisition */ - /* Set thread ID during lock */ - MutexSetTidOfCtrlTbl(idx, tid); - - break; - } - } - // LCOV_EXCL_STOP - } - } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE - /* If it is not the owner */ - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE - } - } - } - - return lret; -} - -/** - * @brief - * Mutex Unlock - * - * Release the mutex ownership and terminate the lock. - * - * @param[in] h_mutex Mutex handle(CreateMutex return value) - * - * @return TURE Normal
- * FALSE Error - */ -BOOL PbMutexUnlock(HANDLE h_mutex) { - BOOL bret = FALSE; - int32 ret; - u_int32 idx; - BOOL is_owner; - uint32_t tid; - - /* Null check */ - if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex can not be NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR"); - } else { - /* Retrieve the index of the management table containing the Mutex handle */ - idx = MutexGetIdxOfCtrlTbl(h_mutex); - /* When the specified Mutex handle is not registered */ - if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_MUTEX_NUM - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "MutexGetIdxOfCtrlTbl ERROR [h_mutex:%p, idx:%d]", h_mutex, idx); - } else { - /* If it is registered */ - /* Determinate ownership */ - is_owner = MutexGetFlagOfOwnerTbl(idx); - if (is_owner == TRUE) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* Release thread ID setting during lock */ - MutexSetTidOfCtrlTbl(idx, 0); - - /* Release the Lock */ - ret = CL_LockRelease(reinterpret_cast(h_mutex)); - if (ret == 0) /* If successful */ { // LCOV_EXCL_BR_LINE 4: nsfw error - bret = TRUE; - - } else { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Failed */ - tid = PbGetTid(); - - /* Retry to set the thread ID during lock */ - MutexSetTidOfCtrlTbl(idx, tid); - - /* Add the release failure information */ - MutexSetIsRelFailOfCtrlTbl(idx, TRUE); - - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockRelease ERROR [h_mutex:%p, ret:%d]", h_mutex, ret); - // LCOV_EXCL_STOP - } - } - } - } - - return bret; -} - -/*---------------------------------------------------------------------------------* - * Local Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Set the Lock ID (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * @param[in] l_id Lock ID - */ -static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, l_id:%d]", idx, l_id); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_mutex_ctrl_tbl.info->detail[idx].lock_id = l_id; - } - - return; -} - -/** - * @brief - * Get the Lock ID (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - */ -static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_mutex_ctrl_tbl.info->detail[idx].lock_id; -} - -/** - * @brief - * Set the Mutex name (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * @param[in] name Mutex name - */ -static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - _tcscpy(g_mutex_ctrl_tbl.info->detail[idx].name, name); - } - - return; -} - -/** - * @brief - * Set the Mutex handle (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * @param[in] handle Mutex handle - */ -static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_mutex_ctrl_tbl.handle[idx] = handle; - } - - return; -} - -/** - * @brief - * Get the Mutex handle (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * - * @return Mutex handle - */ -static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx) { - HANDLE handle = NULL; - - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - handle = g_mutex_ctrl_tbl.handle[idx]; - } - - return handle; -} - -/** - * @brief - * Set the thread ID during lock acquisition (Mutex control table) - * - * @param[in] idx Control table accessor - * @param[in] tid Thread ID - * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - */ -static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_mutex_ctrl_tbl.info->detail[idx].thread_id = tid; - } - - return; -} - - -/** - * @brief - * Get the thread ID during lock acquisition (Mutex control table) - * - * @param[in] idx Control table accessor - * - * @return Thread ID - * - * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - */ -static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx) { - uint32_t tid = 0; - - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - tid = g_mutex_ctrl_tbl.info->detail[idx].thread_id; - } - - return tid; -} - - -/** - * @brief - * Set the release failure information (Mutex control table) - * - * @param[in] idx Control table accessor - * @param[in] flag Failed to release:TURE - * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - */ -static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail = flag; - } - - return; -} - -/** - * @brief - * Set deletion-occurrence information during Lock acquisition (Mutex control table) - * - * @param[in] idx Control table accessor - * @param[in] flag When deletion occurs while Lock is being acquired:TRUE - * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - */ -static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access = flag; - } - - return; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Get index for access (Mutex control table) - * - * Return the index for accessing the area of the Mutex control table in which
- * the specified mutex handle is registered. If the specified handle is not
- * registered, the maximum number of mutex management (MAX_MUTEX_CTRL_NUM) is returned. - * - * @param[in] h_mutex Mutex handle - * - * @return Index for access (Specified handle is already registered)
- * Maximum mutex management value (Specified handle is not registered) - */ -static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex) { - u_int32 idx; - HANDLE handle; - - for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) { - /* Get handle from Mutex control table */ - handle = MutexGetMutexHandleOfCtrlTbl(idx); - - if (handle == h_mutex) { - break; - } - } - - return idx; -} - -/** - * @brief - * Increment the Mutex reference counter (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - */ -static void MutexIncRefCntOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt++; - g_mutex_ctrl_tbl.ref_cnt[idx]++; - - return; -} - -/** - * @brief - * Decrement the Mutex reference counter (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - */ -static void MutexDecRefCntOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - g_mutex_ctrl_tbl.info->detail[idx].ref_cnt--; - g_mutex_ctrl_tbl.ref_cnt[idx]--; - - return; -} - -/** - * @brief - * Get the Mutex Reference Counter (Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * - * @return Reference counter value - */ -static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx) { - int32 ret = 0; - - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - ret = g_mutex_ctrl_tbl.info->detail[idx].ref_cnt; - } - - return ret; -} - -/** - * @brief - * Get mutex reference counter (in-process)(Mutex control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * - * @return Reference counter value - */ -static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_mutex_ctrl_tbl.ref_cnt[idx]; -} - -/** - * @brief - * Search mutex name (Mutex control table) - * - * Retrieve whether the specified mutex is already registered in the Mutex control table.
- * If it is registered, the access index is returned.If it is not registered,
- * return the maximum mutex management value(MAX_CTRL_MUTEX_NUM). - * - * @param[in] name Mutex name - * - * @return Index for access(If it is registered)
- * Maximum mutex management value (Not registered) - */ -static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name) { - int32 ret; - u_int32 idx; - - for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) { - ret = _tcscmp(g_mutex_ctrl_tbl.info->detail[idx].name, name); - - /* If there is a match */ - if (ret == 0) { - break; - } - } - - return idx; -} - -/** - * @brief - * Search unused area (Mutex control table) - * - * Return the lowest-numbered index for accessing unused space in the Mutex control table.
- * Return the maximum value((MAX_CTRL_MUTEX_NUM)) of message queue management
- * when no unused area exists. - * - * @return Index for access (Unused area exists)
- * Maximum mutex management value (No unused area) - */ -static u_int32 MutexSearchEmptyOfCtrlTbl(void) { - u_int32 idx; - - idx = MutexSearchNameOfCtrlTbl(""); - - return idx; -} - -/** - * @brief - * Set the Mutex ownership flag (Ownership-information table) - * - * @param[in] idx Control table accessor - * @param[in] flag ownership-information - */ -static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag) { - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, flag:%d]", idx, flag); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_is_mutex_owner_tbl[idx] = flag; - } - - return; -} - -/** - * @brief - * Get the Mutex ownership flag (Ownership-information table) - * - * @param[in] idx Control table accessor - * - * @return TRUE Owned - * FALSE Not owned - */ -static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx) { - BOOL bret = FALSE; - - /* check index */ - if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - bret = g_is_mutex_owner_tbl[idx]; - } - - return bret; -} - -/** - * @brief - * Create Mutex for accessing the Mutex control table - */ -static void MutexCreateMutex(void) { - g_h_mtx = (HANDLE)CL_LockMap(MUTEX_LOCK_ID_0); // LCOV_EXCL_BR_LINE 4: nsfw error - if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Delete Mutex for accessing Mutex control table - */ -static void MutexDeleteMutex(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 ret; - - ret = CL_LockUnmap(g_h_mtx); - if (ret != 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockUnmap ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Get Mutex for accessing Mutex control table - */ -static void MutexLockMutex(void) { - int32 ret; - - ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Release Mutex for accessing Mutex control table - */ -static void MutexUnlockMutex(void) { - int32 ret; - - ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error - if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Get dump information - * - * @param[out] p_buf Dump info - * @param[in/out] p_len Buffer size - */ -void _pb_GetDebugMutexMngTbl(void* p_buf, uint8_t* p_len) { - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t buf_tmp[512]; - static uint8_t buf_info[DEBUG_DUMP_MAX_SIZE]; - uint32_t i; - uint8_t cnt = 0; - - if ((p_buf != NULL) && (p_len != NULL)) { - memset(&buf[0], 0x00, sizeof(buf)); - memset(&buf_info[0], 0x00, sizeof(buf_info)); - for (i = 0; i < MAX_CTRL_MUTEX_NUM; i++) { - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n [%02d]id:%10d, nm:%40s, ref_cnt:%10d, tid:%03d, fail:%01d, " \ - "forbid:%01d, handle:%10p, ref_cnt(local):%10d", - i, - g_mutex_ctrl_tbl.info->detail[i].lock_id, - g_mutex_ctrl_tbl.info->detail[i].name, - g_mutex_ctrl_tbl.info->detail[i].ref_cnt, - g_mutex_ctrl_tbl.info->detail[i].thread_id, - g_mutex_ctrl_tbl.info->detail[i].is_rel_fail, - g_mutex_ctrl_tbl.info->detail[i].is_forbid_access, - g_mutex_ctrl_tbl.handle[i], - g_mutex_ctrl_tbl.ref_cnt[i]); - strncat(reinterpret_cast(&buf_info[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - if (((i + 1) % 10) == 0) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Mutex-%d%s", - cnt, - &buf_info[0]); - memcpy(p_buf, &buf[0], sizeof(buf)); - p_buf = reinterpret_cast((reinterpret_cast(p_buf)) + sizeof(buf)); - memset(&buf_info[0], 0x00, sizeof(buf_info)); - if (cnt >= *p_len) { - break; - } - } - } - if (cnt < *p_len) { - if (buf_info[0] != 0x00) { - cnt++; - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), - "Mutex-%d%s", - cnt, - &buf_info[0]); - memcpy(p_buf, &buf[0], sizeof(buf)); - } - *p_len = cnt; - } - } -} - -/** - * @brief - * Increment the Mutex using counter - * - * @param[in] none - */ -static void MutexIncUseCntOfCtrlInfo(void) { - g_mutex_ctrl_tbl.info->use_cnt++; - return; -} - -/** - * @brief - * Decrement Mutex using counter - * - * @param[in] none - */ -static void MutexDecUseCntOfCtrlInfo(void) { - g_mutex_ctrl_tbl.info->use_cnt--; - return; -} - -/** - * @brief - * Increment Mutex reserved counter - * - * @param[in] none - */ -static void MutexIncRsvCntOfCtrlInfo(void) { - g_mutex_ctrl_tbl.info->rsv_cnt++; - return; -} - -/** - * @brief - * Decrement Mutex reserved counter - * - * @param[in] none - */ -static void MutexDecRsvCntOfCtrlInfo(void) { - g_mutex_ctrl_tbl.info->rsv_cnt--; - return; -} - -/** - * @brief - * Determine resources ready (Mutex control data) - * - * @param[in] none - * - * @return BOOL - * @retval TRUE : Normal - * @retval FALSE : Error (Resource shortage) - */ -BOOL _pb_GetMutexResource(void) { - BOOL ret = TRUE; - uint32_t cnt; - - MutexLockMutex(); - - /* Increment Mutex reserved counter */ - MutexIncRsvCntOfCtrlInfo(); - - cnt = g_mutex_ctrl_tbl.info->use_cnt + g_mutex_ctrl_tbl.info->rsv_cnt; - if (cnt >= FULL_CTRL_MUTEX_NUM) { - ret = FALSE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "Lack of resources [FATAL][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \ - g_mutex_ctrl_tbl.info->rsv_cnt); - } else if (cnt >= WARN_CTRL_MUTEX_NUM) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "Lack of resources [WARN][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \ - g_mutex_ctrl_tbl.info->rsv_cnt); - } - - MutexUnlockMutex(); - - return ret; -} - -/** - * @brief - * Release resources (Mutex control data) - * - * @param[in] none - * - * @return none - */ -void _pb_ReleaseMutexResource(void) { - MutexLockMutex(); - - /* Decrement Mutex reserved counter */ - MutexDecRsvCntOfCtrlInfo(); - - MutexUnlockMutex(); - - return; -} -#endif /* PT_PB_MUTEX_STUB__CWORD71_ */ diff --git a/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp b/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp deleted file mode 100755 index c38016a..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbOSCtrl.cpp - System name : - Subsystem name : - Title : -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include -#include -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" -#include "_pbSerial.h" -/* For CreateFile--> */ -#include -#include -#include -#include -/* For CreateFile <-- */ - -#define GPS_FUNC_DEBUG_MSG__CWORD71__FILE 0 - -#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE -#define FILE_OUT_LINE 50 -static u_int8 file_buf[FILE_OUT_LINE][1024]; -static u_int16 line_size_buf[FILE_OUT_LINE]; - -/* Log destination selection (Activate the one you want to output.) */ -#define POS_GPS_R_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_read_data.txt" -#define POS_GPS_W_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_write_data.txt" - -#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */ - -/* For CreateFile--> */ -#define BAUDRATE B9600 -#define MODEMDEVICE "/dev/tty.gps" -/* For CreateFile <-- */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : ClearCommError -* ABSTRACT : Get the communication error information and report the current status of the communication device. -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Wait for replacement */ -BOOL ClearCommError(HANDLE h_file, LPDWORD lp_errors, LPCOMSTAT lp_stat) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return 0; -// LCOV_EXCL_STOP -} - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : GetCommState -* ABSTRACT : Store the current control settings of the specified communication device in the device control block (DCB struct). -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Wait for replacement */ /* TODO IHFLOW OHFLOW declarations are missing */ -BOOL GetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return 1; -// LCOV_EXCL_STOP -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : GetCommTimeouts -* ABSTRACT : Get the timeout parameters for all read and write operations performed on the specified communication device. -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -BOOL GetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#if 1 /* GPF */ - BOOL bret = FALSE; - DWORD dw_read = 0; - DWORD dw_write = 0; - - if ((INVALID_HANDLE_VALUE != h_file) && (NULL != lp_comm_timeouts)) { - /* Initialization */ - memset(lp_comm_timeouts, 0, sizeof(COMMTIMEOUTS)); - bret = SerialObjectTimeoutGet(h_file, &dw_read, &dw_write); - if (TRUE == bret) { - lp_comm_timeouts->write_total_timeout_constant = dw_write; - if (0 == dw_read) { - /* Return as 0? or return this setting? */ - lp_comm_timeouts->read_interval_timeout = INFINITE; - lp_comm_timeouts->read_total_timeout_constant = 0; - lp_comm_timeouts->read_total_timeout_multiplier = 0; - } else { - lp_comm_timeouts->read_total_timeout_constant = dw_read; - } - } else { - /* not exist in the list */ - lp_comm_timeouts->write_total_timeout_constant = INFINITE; - lp_comm_timeouts->read_total_timeout_constant = INFINITE; - bret = TRUE; - } - } - - return bret; - -#endif /* GPF */ -} -// LCOV_EXCL_STOP - -/** - * @brief - * Clear Communication Buffer - * - * Discard all characters in the output buffer or input buffer of the specified resource - * - * - * @param[in] h_file Handle of the communication resource - * @param[in] dw_flags Operation to perform - * - * @return Processing result - * @retval TRUE processing succeeded - * @retval FALSE Processing failed - */ -BOOL PurgeComm(HANDLE h_file, DWORD dw_flags) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL ret = 0; - int res = -1; - /* h_file is FD, and less than INT_MAX(0x7fffffff) */ - /* Flush received but unreceived data */ - res = tcflush(static_cast((long)h_file), TCIFLUSH); // NOLINT(runtime/int) - if (res != -1) { - ret = 1; - } - return ret; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : SetCommMask -* ABSTRACT : Specify a set of events to monitor for a specific communication device. -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -BOOL SetCommMask(HANDLE h_file, DWORD dw_evt_mask) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#if 1 /* GPF */ - BOOL bret = FALSE; - - bret = SerialObjectWaitmaskAdd(h_file, dw_evt_mask); - return bret; -#endif /* GPF */ -} -// LCOV_EXCL_STOP - -/** - * @brief - * - * Communication setting - * - * Set the serial communication according to the setting information. - * - * @param[in] h_file Communication handle - * @param[in] lp_dcb Serial port setting information - * - * @return Processing result - * @retval TRUE processing succeeded - * @retval FALSE Processing failed - */ -BOOL SetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - struct termios newtio; -#if 1 - bzero(&newtio, sizeof(newtio)); - cfmakeraw(&newtio); /* RAW mode */ - newtio.c_cflag |= (BAUDRATE | CS8 | CLOCAL | CREAD);/*Baud:9600*/ - newtio.c_lflag &= ~ECHO; -#endif - /* h_file is FD, and less than INT_MAX(0x7fffffff) */ - tcflush(static_cast((long)h_file), TCIFLUSH); // NOLINT(runtime/int) - tcsetattr(static_cast((long)h_file), TCSANOW, &newtio); // NOLINT(runtime/int) - - return 1; -} -// LCOV_EXCL_STOP - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : SetCommTimeouts -* ABSTRACT : Set the timeout parameter for all read and write operations performed on the specified communication device. -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -BOOL SetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#if 1 /* GPF */ - BOOL bret = FALSE; - DWORD dw_read_timeout = INFINITE; - DWORD dw_write_timeout = INFINITE; - - /* Calculate timeout time */ - if ((INFINITE == lp_comm_timeouts->read_interval_timeout) - && (0 == lp_comm_timeouts->read_total_timeout_constant) - && (0 == lp_comm_timeouts->read_total_timeout_multiplier)) { - /* Set without waiting */ - dw_read_timeout = 0; - } else { - dw_read_timeout = lp_comm_timeouts->read_total_timeout_constant; - } - - - dw_write_timeout = lp_comm_timeouts->write_total_timeout_constant; - - bret = SerialObjectTimeoutAdd(h_file, dw_read_timeout, dw_write_timeout); - - return bret; -#endif /* GPF */ -} -// LCOV_EXCL_STOP - -/** - * @brief - * - * Waiting for communication event - * - * Wait for an event to be generated for a specified handle - * Note : Continue to wait indefinitely until data reception/error occurs - * - * @param[in] h_file Communication handle - * @param[out] lp_evt_mask Pointer to the variable to receive the event - * @param[in] lp_overlapped OVERLAPPED Pointer to a struct[Note:Not used] - * - * @return Processing result - * @retval TRUE Processing succeeded - * @retval FALSE Processing failed - */ -BOOL WaitCommEvent(HANDLE h_file, LPDWORD lp_evt_mask, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL ret = 0; - int res = -1; - int fd; - fd_set fds_set_err; - fd_set fds_set; // Set of file descriptor - - struct timeval tv; - - /* Monitor for 0.5 seconds */ - tv.tv_sec = 1; - tv.tv_usec = 0; - /* h_file is FD, and less than INT_MAX(0x7fffffff) */ - fd = static_cast((long)h_file); // NOLINT(runtime/int) - - /* Initialization */ - FD_ZERO(&fds_set); - FD_ZERO(&fds_set_err); - - FD_SET(fd, &fds_set); - FD_SET(fd, &fds_set_err); - - res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv); - - if (res > 0) { - if (FD_ISSET(fd, &fds_set)) { - *lp_evt_mask = EV_RXCHAR; - ret = 1; - - } else { - *lp_evt_mask = EV_ERROR; - ret = 0; - } - } else { - ret = 0; - } - return ret; -} -// LCOV_EXCL_STOP - -/** - * @brief - * - * Create file - * - * Create or open an object and return a handle which can be used to access the object - * - * @param lp_file_name Not used - * @param dw_desired_access Not used - * @param dw_share_mode Not used - * @param lp_security_attributes Not used - * @param dw_creation_disposition Not used - * @param dw_flags_and_attributes Not used - * @param h_template_file Not used - * - * @return Handle - */ -HANDLE CreateFile(LPCTSTR lp_file_name, DWORD dw_desired_access, DWORD dw_share_mode, LPSECURITY_ATTRIBUTES lp_security_attributes, DWORD dw_creation_disposition, DWORD dw_flags_and_attributes, HANDLE h_template_file) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int fd; - int loop = 1; - - while (loop == 1) { - fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY); - if (fd != -1) { - break; - } - sleep(1); - } - /* fd is FD, and less than INT_MAX(0x7fffffff) and the return data type is HANDLE. */ - return (HANDLE)((long)(fd)); // NOLINT(runtime/int) -} -// LCOV_EXCL_STOP - -/** - * @brief - * - * Close file - * - * Close an open file - * - * @param[in] h_object Handle - * - * @return Processing result - * @retval TRUE Processing succeeded - * @retval FALSE Processing failed - */ -BOOL CloseFile(HANDLE h_object) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if (h_object != reinterpret_cast(-1)) { - /* h_object is FD, and less than INT_MAX(0x7fffffff) */ - close(static_cast((long)h_object)); // NOLINT(runtime/int) - } else { - /* nop */ - } - return 0; -} -// LCOV_EXCL_STOP - -/** - * @brief - * - * Write File - * - * Writing Data to a File - * - * @param[in] h_file Handle - * @param[in] lp_buffer buffer to write - * @param[out] n_number_of_bytes_to_write Maximum writing size - * @param[out] lpNumberOfBytesWrite Writing size - * @param lp_overlapped Not used - * - * @return Processing result - * @retval TRUE Processing succeeded - * @retval FALSE Processing failed - */ -BOOL WriteFile(HANDLE h_file, LPCVOID lp_buffer, DWORD n_number_of_bytes_to_write, LPDWORD lp_number_of_bytes_written, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int res = -1; - BOOL ret = 0; - int fd; - fd_set fds_set; /* Set of file descriptors */ - fd_set fds_set_err; - - struct timeval tv; - -#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE - static FILE* fp = NULL; /* For debugging */ - int i; -#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */ - - /* monitor for 2 seconds.*/ - tv.tv_sec = 2; - tv.tv_usec = 0; - /* h_file is FD, and less than INT_MAX(0x7fffffff) */ - fd = static_cast((long)h_file); // NOLINT(runtime/int) - - /* Initialization */ - FD_ZERO(&fds_set); - FD_ZERO(&fds_set_err); - - FD_SET(fd, &fds_set); - FD_SET(fd, &fds_set_err); - - res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv); - if (res > 0) { - if (FD_ISSET(fd, &fds_set)) { - /* h_file is FD, and less than INT_MAX(0x7fffffff) */ - res = static_cast(write(static_cast((long)h_file), lp_buffer, // NOLINT(runtime/int) - n_number_of_bytes_to_write)); - *lp_number_of_bytes_written = res; - -#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE - if (fp == NULL) { - /* File initialization */ - fp = fopen(POS_GPS_W_LOGFILE_PATH, "w+"); - } else { - fp = fopen(POS_GPS_W_LOGFILE_PATH, "a+"); - } - for (i = 0; i < n_number_of_bytes_to_write; i++) { - fprintf(fp, "%02x ", *(reinterpret_cast(lp_buffer) + i)); - } - fprintf(fp, "\n"); - fclose(fp); -#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */ - } - } else { - } - - if (res != -1) { - ret = 1; - } - - return ret; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : Wsprintf -* ABSTRACT : Format a string and store the value in a buffer. If any of the arguments are passed, -* Format according to the corresponding format specifier in the format control string and copies it to the output buffer. -* NOTE : -* ARGUMENT : -* RETURN : int defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int Wsprintf(LPTSTR lp_out, LPCTSTR lp_fmt, ...) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -#if 1 /* GPF */ - int rtn; - va_list args; - - va_start(args, lp_fmt); - /* Seems to be occured problems because the buffer size is not known. */ - rtn = vswprintf(reinterpret_cast(lp_out), 256, reinterpret_cast(lp_fmt), args); - va_end(args); - - return rtn; -#endif /* GPF */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* MODULE : PbSystemTimeToFileTime -* ABSTRACT : Convert the system date and time to 64-bit format file time. -* NOTE : -* ARGUMENT : -* RETURN : BOOL defined -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BOOL PbSystemTimeToFileTime(const SYSTEMTIME* lp_system_time, LPFILETIME lp_file_time) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return FALSE; -} -// LCOV_EXCL_STOP - -/** - * Function name : MunmapDeviceIo
- * Register unmapping
- * - * Overview : Remove the mapping of a register to memory.
- * - * -# Release the mapping of the specified register to memory. - * - * @param h_dev [I]Handle to the device object - * @param map_size [I]Size of mapped device I/O memory - * - * @return RET_API Processing result - * @retval RET_NORMAL Processing succeeded - * @retval RET_ERROR Processing failed - */ -/* Wait for replacement */ -RET_API MunmapDeviceIo(HANDLE h_dev, u_int32 map_size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; -// LCOV_EXCL_STOP -} - -/** - * Function name : MmapDeviceIo
- * Register mapping
- * - * Overview : Map registers to memory.
- * - * -# Map the specified register to memory. - * - * @param map_size [I]Size of mapped device I/O memory - * @param map_addr [I]Mapped physical address - * - * @return HANDLE Processing result - * @retval Except NULL Handle - * @retval NULL Processing failed - */ -/* Wait for replacement */ -HANDLE MmapDeviceIo(u_int32 map_size, u_int32 map_addr) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; -// LCOV_EXCL_STOP -} - -/** - * @brief - * - * Kill - * - * Exit program - * - * @param[in] p_func Calling function - * @param[in] line Number of caller rows - */ -void _pb_Exit_d(const char* p_func, int line) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int ret = -1; - - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FORBIDDEN ERROR [Called by:%s, Line:%d]", p_func, line); - exit(ret); - - return; -} -// LCOV_EXCL_STOP - - -/* GPF001_sample_ttaka add end */ - diff --git a/vehicleservice/positioning_base_library/library/src/_pbOther.cpp b/vehicleservice/positioning_base_library/library/src/_pbOther.cpp deleted file mode 100755 index 73ff300..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbOther.cpp +++ /dev/null @@ -1,799 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbOther.cpp - */ - -#include -#include -#include -#include - -#include -#include "_pbInternalProc.h" -#include -#include "WPF_STD_private.h" -#include "tchar.h" - - - -/*---------------------------------------------------------------------------------* - * Define * - *---------------------------------------------------------------------------------*/ -/* Shared memory */ -#define POS_BASE_OTHER_PROC_ID "POS_BASE_OTHER_PROC_ID" - -#define MAX_OTHER_PROC_NUM (32) /** Maximum number of the management information to translate the process name to PNO */ -#define MAX_NUM_CTRL_TID (16) /** Maximum number of tje TID management for thread in Process */ - -#define OTHER_PNO_BASE (0x9000) /** Base number of local process */ - -#define THREAD_NAME_LEN_MAX (32) - -#define FULL_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 4) /** Threshold of the management information to translate the process name to PNO (no free) */ -#define WARN_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 10) /** Threshold of the management information to translate the process name to PNO (warning) */ - -typedef void* (*_CWORD64_PROCMNG_START_ROUTINE)(void*); - -/*---------------------------------------------------------------------------------* - * Structure * - *---------------------------------------------------------------------------------*/ -/*! - @brief Process identification information - */ -typedef struct { - PNO pno; /**< Process number */ - char name[THREAD_NAME_LEN_MAX]; /**< Process name */ -} PROC_ID; - -/*! - @brief Process information - */ -typedef struct { - PROC_ID id[MAX_OTHER_PROC_NUM]; /**< Process identification information */ - uint32_t use_cnt; /**< Used number */ - uint32_t rsv_cnt; /**< Reserved number */ -} PROC_INFO; - -/*---------------------------------------------------------------------------------* - * Grobal Value * - *---------------------------------------------------------------------------------*/ -static HANDLE g_h_app[MAX_NUM_CTRL_TID]; /** Application handle */ -static HANDLE g_h_mtx; /** Shared-information-locking Mutex handle */ -static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18787 compliant - -static PROC_INFO* g_p_proc_id_tbl; /** Process Name-PNO Translation Table */ - -/*---------------------------------------------------------------------------------* - * Internal Function Prototype * - *---------------------------------------------------------------------------------*/ -/* Process number to PNO translation table manipulation functions */ -static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno); -static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name); -static PNO OtherGetPnoOfCnvTbl(u_int32 idx); -static PCSTR OtherGetNameOfCnvTbl(u_int32 idx); -static u_int32 OtherSearchPnoOfCnvTbl(PNO pno); -static u_int32 OtherSearchNameOfCnvTbl(PCSTR name); -static void OtherIncUseCntOfCnvTbl(void); -static void OtherIncRsvCntOfCnvTbl(void); -static void OtherDecRsvCntOfCnvTbl(void); - -static void OtherCreateMutex(void); -static void OtherDeleteMutex(void); -static void OtherLockMutex(void); -static void OtherUnlockMutex(void); - -/** - * @brief - * Initialize other funtion - * - * @return RET_NORMAL Normal completion - */ -RET_API ErrTrapInit(void) { - RET_API ret_api = RET_NORMAL; - PROC_INFO **pp_tbl; - u_int16 idx; - - pp_tbl = &g_p_proc_id_tbl; /* Set a pointer to a table to translate the process name to PNO */ - - OtherCreateMutex(); /* Create Mutex for accessing shared info */ - OtherLockMutex(); /* Acquire Mutex for accessing shared info */ - - /* Open shared memory for a table to translate the process name to PNO */ - g_h_shm = OpenSharedMemory(const_cast(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO)); - - /* If called for the first time within all processes, an error occurs and the following processing is performed. */ - if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL - /* Create shared memory for a table to translate the name to PNO */ - g_h_shm = CreateSharedMemory(const_cast(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO)); - /* In case of an error */ - if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR " \ - "[g_h_shm:%p]", g_h_shm); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // // LCOV_EXCL_LINE 200: can not be NULL - /* don't arrive here. */ - } - } - - OtherUnlockMutex(); /* Release Mutex for accessing shared info */ - - /* Set the acquired shared memory address as a pointer for a table to translate the process name to PNO */ - *pp_tbl = reinterpret_cast(GetSharedMemoryPtr(g_h_shm)); - - /* Table initialization */ - for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) { - /* Set PNO into the table to translate the process name to PNO (Overwrite from the second process onwards) */ - OtherSetPnoOfCnvTbl(idx, static_cast(OTHER_PNO_BASE + idx)); - } - - return ret_api; -} - -/** - * @brief - * Terminate other function - */ -void ErrTrapTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - CloseSharedMemory(g_h_shm); - - OtherDeleteMutex(); -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create Thread - * - * @param[in] lp_thread_attributes Not used - * @param[in] dw_stack_size Initial stack size - * @param[in] lp_start_address Address of the effective function of the thread - * @param[in] lp_parameter Thread arguments - * @param[in] dw_creation_flags Not used - * @param[in] lp_thread_id Thread identifier - * @param[in] pno PNO - * @param[in] priority Thread priority - * - * @return Non-zero:Normal status, 0:When an error occurs - */ -HANDLE _pb_CreateThread(LPSECURITY_ATTRIBUTES lp_thread_attributes, DWORD dw_stack_size, LPTHREAD_START_ROUTINE lp_start_address, LPVOID lp_parameter, DWORD dw_creation_flags, LPDWORD lp_thread_id, PNO pno, int32 priority) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - pthread_attr_t st_thread_attr; - pthread_t ul_thread_id = 0; - sched_param st_thread_param = {0}; - HANDLE handle = NULL; - int32 lret = EOK; - BOOL bret = FALSE; - - /* null check */ - if (lp_thread_id == NULL) { - // no op - } else { - /* Initializing Attributes */ - lret = pthread_attr_init(&st_thread_attr); - - /* When the attribute initialization is successful */ - if (lret == EOK) { - /* Do not inherit parent scheduling policies */ - lret = pthread_attr_setinheritsched(&st_thread_attr, PTHREAD_EXPLICIT_SCHED); - } - - /* If you successfully configure policy inheritance */ - if (lret == EOK) { - /* Scheduling settings */ - lret = pthread_attr_setschedpolicy(&st_thread_attr, SCHED_RR); - } - - /* Successful Scheduling settings */ - if (lret == EOK) { - /* Create a thread with the lowest priority so that the spawned thread */ - /* do not run until they are ready for processing */ - st_thread_param.sched_priority = 1; - lret = pthread_attr_setschedparam(&st_thread_attr, &st_thread_param); - } - - /* If the priority setting is successful */ - if (lret == EOK) { - lret = pthread_create(&ul_thread_id, - NULL, - (_CWORD64_PROCMNG_START_ROUTINE)lp_start_address, - lp_parameter); - } - - /* Successful pthread_create */ - if (lret == EOK) { - bret = TRUE; - } - } - - /* When priority setting is successful */ - if (bret != FALSE) { - /* Return value setting */ - handle = (HANDLE)ul_thread_id; - *lp_thread_id = ul_thread_id; - } else { - /* Error log output */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%d]", lret); - } - - return handle; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Get the thread ID - * - * @return Thread ID - */ -uint32_t PbGetTid(void) { - uint32_t ul_tid; - - ul_tid = (uint32_t)syscall(__NR_gettid); - - return ul_tid; -} - -/** - * @brief - * Get the local thread ID - * - * Local thread ID = [0, 1, 2, ...]
- * The local thread ID is unique in the process, and dynamically assigned in the order in which
- * this API was called during the process execution.
- * - * @return Local thread ID - */ -uint32_t PbGetLocalTid(void) { - static uint32_t g_tid[MAX_NUM_CTRL_TID] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF - }; /** In-process thread ID management table */ - - uint32_t ul_tid; - uint32_t ul_idx; - uint32_t ul_local_tid = 0xFFFFFFFF; - - ul_tid = PbGetTid(); - - OtherLockMutex(); /* Get Mutex for accessing shared info */ - - for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) { - if (g_tid[ul_idx] == ul_tid) { - ul_local_tid = ul_idx; - } - } - - if (ul_local_tid == 0xFFFFFFFF) { - for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) { - if (g_tid[ul_idx] == 0xFFFFFFFF) { - g_tid[ul_idx] = ul_tid; - ul_local_tid = ul_idx; - - break; - } - } - - if (ul_local_tid == 0xFFFFFFFF) { - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Local Tid buffer is overfull!!"); - _pb_Exit(); - - /* don't arrive here. */ - } - } - - OtherUnlockMutex(); /* Release Mutex for accessing shared info */ - - return ul_local_tid; -} - - -/** - * @brief - * Get Application Handle - * - * Get the application handle of the invoking thread. - * - * @return Non-zero:Normal status, 0:When an error occurs - */ -HANDLE _pb_GetAppHandle(void) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - const uint32_t offset = PbGetLocalTid(); - - return g_h_app[offset]; -} - - -/** - * @brief - * Set Application Handle - * - * Set the application handle of the invoking thread. - * - * @param[in] name Process name - */ -void _pb_SetAppHandle(HANDLE h_app) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - const uint32_t offset = PbGetLocalTid(); - - OtherLockMutex(); /* Get Mutex for accessing shared info */ - - g_h_app[offset] = h_app; - - OtherUnlockMutex(); /* Release Mutex for accessing shared info */ - - return; -} - - -/** - * @brief - * Convert process name to pno - * - * Translate process name to PNO.
- * If the process name specified in the argument is the first name to
- * be translated by this API, a new PNO is assigned and returned.
- * If NULL is specified, 0 is returned. - * - * @param[in] name Process name - * - * @return Process number - */ -PNO _pb_CnvName2Pno(PCSTR name) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - u_int32 idx; - PNO pno = 0; - size_t len; - - /* null check */ - if (name == NULL) { - pno = 0; - } else { - len = _tcslen(name); - if (len >= THREAD_NAME_LEN_MAX) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \ - "Length of thread name is too long(>=%d). [len:%zu]", THREAD_NAME_LEN_MAX, len); - } else { - OtherLockMutex(); - - idx = OtherSearchNameOfCnvTbl(name); - - if (idx != MAX_OTHER_PROC_NUM) { - pno = OtherGetPnoOfCnvTbl(idx); - } else { - idx = OtherSearchNameOfCnvTbl(""); - OtherSetNameOfCnvTbl(idx, name); - /* Increment using-counter */ - OtherIncUseCntOfCnvTbl(); - pno = OtherGetPnoOfCnvTbl(idx); - } - - OtherUnlockMutex(); - } - } - - return pno; -} - -/** - * @brief - * Convert pno to process name - * - * Translate PNO to the process name. - * Return the process name set by _pb_CnvName2Pno to the PNO argument. - * If a non-PNO value is given by _pb_CnvName2Pno is specified, - * NULL is returned. - * - * @param[in] pno Process number - * - * @return Process name - */ -PCSTR _pb_CnvPno2Name(PNO pno) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - u_int32 idx; - PCSTR name = NULL; - - OtherLockMutex(); - - idx = OtherSearchPnoOfCnvTbl(pno); - - if (idx != MAX_OTHER_PROC_NUM) { - name = OtherGetNameOfCnvTbl(idx); - } - - OtherUnlockMutex(); - - return name; -} - - -/** - * @brief - * Get environment variables - * - * @param[in] Environment variable name - * @param[in] Pointer to environment variable value - */ -void GetEnv(const char* p_env_str, char* p_env_buff) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - VP_GetEnv(p_env_str, p_env_buff); - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VP_GetEnv:%s=%s", p_env_str, p_env_buff); - - return; -} -// LCOV_EXCL_STOP - -/*---------------------------------------------------------------------------------* - * Local Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * PNO setting(The table to translate the process name to PNO) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] u_int32 idx Table accessor - * @param[in] PNO pno Process number - * - * @return none - */ -static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno) { - /* check index */ - if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, pno:%d]", idx, pno); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - g_p_proc_id_tbl->id[idx].pno = pno; - - return; -} - -/** - * @brief - * Set process name (The table to translate the process name to PNO) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] u_int32 idx Table accessor - * @param[in] PCSTR name Process name - * - * @return none - */ -static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name) { - /* check index */ - if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - _tcscpy(g_p_proc_id_tbl->id[idx].name, name); - } - - return; -} - -/** - * @brief - * Get PNO (The table to translate the process name to PNO) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] u_int32 idx Table accessor - * - * @return PNO - */ -static PNO OtherGetPnoOfCnvTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_p_proc_id_tbl->id[idx].pno; -} - -/** - * @brief - * Get process name (The table to translate the process name to PNO) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] u_int32 idx Table accessor - * - * @return PCSTR - */ -static PCSTR OtherGetNameOfCnvTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_p_proc_id_tbl->id[idx].name; -} - -/** - * @brief - * Retrieve PNO (The table to translate the process name to PNO) - * - * If the PNO specified in the argument exists in the table, return the index for access. - * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM). - * - * @param[in] PNO pno Process number - * - * @return u_int32 Table accessor - */ -static u_int32 OtherSearchPnoOfCnvTbl(PNO pno) { - u_int32 idx; - PNO lPno; - - for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) { - lPno = OtherGetPnoOfCnvTbl(idx); - - if (lPno == pno) { - break; - } - } - - return idx; -} - -/** - * @brief - * Retrieve process name (The table to translate the process name to PNO) - * - * If the process specified by the argument exists in the table, return the index for access. - * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM). - * - * @param[in] PCSTR name Process name - * - * @return u_int32 Table accessor - */ -static u_int32 OtherSearchNameOfCnvTbl(PCSTR name) { - int32 ret; - u_int32 idx; - - for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) { - ret = _tcscmp(g_p_proc_id_tbl->id[idx].name, name); - - /* If there is a match */ - if (ret == 0) { - break; - } - } - - return idx; -} - - -/** - * @brief - * Create Mutex for accessing shared info - * - * @param[in] none - * - * @return none - */ -static void OtherCreateMutex(void) { - g_h_mtx = _pb_CreateMutex(NULL, 0, "Other_Mutex"); - if (g_h_mtx == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Delete Mutex for accessing shared info - * - * @param[in] none - * - * @return none - */ -static void OtherDeleteMutex(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - DWORD ret; - ret = PbDeleteMutex(g_h_mtx); - if (ret != WAIT_OBJECT_0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \ - "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Get Mutex for accessing shared info - * - * @param[in] none - * - * @return none - */ -static void OtherLockMutex(void) { - DWORD ret; - ret = PbMutexLock(g_h_mtx, INFINITE); - if (ret != WAIT_OBJECT_0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \ - "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Open Mutex for Accessing Shared Info - * - * @param[in] none - * - * @return none - */ -static void OtherUnlockMutex(void) { - BOOL ret; - ret = PbMutexUnlock(g_h_mtx); - if (ret != TRUE) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \ - "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Get dump information - * - * @param[out] pBuf Dump info - */ -void _pb_GetDebugOtherMngTbl(void* pBuf) { - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t bufTmp[64]; - uint32_t i; - - if (pBuf != NULL) { - memset(&buf[0], 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&buf[0]), sizeof(buf), "Other"); - if (g_p_proc_id_tbl == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_proc_id_tbl can not be NULL - // LCOV_EXCL_START 200: g_p_proc_id_tbl can not be NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - strncat(reinterpret_cast(&buf[0]), "\n NULL", strlen("\n NULL")); - // LCOV_EXCL_STOP - } else { - for (i = 0; i < MAX_OTHER_PROC_NUM; i++) { - memset(&bufTmp[0], 0x00, sizeof(bufTmp)); - snprintf(reinterpret_cast(&bufTmp[0]), sizeof(bufTmp), - "\n [%02d] pno:0x%04x, name:%s", - i, - g_p_proc_id_tbl->id[i].pno, - g_p_proc_id_tbl->id[i].name); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&bufTmp[0]), \ - strlen(reinterpret_cast(&bufTmp[0]))); - } - } - memcpy(pBuf, &buf[0], sizeof(buf)); - } -} - -/** - * @brief - * Increment the usage counter of the table to translate process name to PNO - * - * @param[in] none - */ -static void OtherIncUseCntOfCnvTbl(void) { - g_p_proc_id_tbl->use_cnt++; - return; -} - -/** - * @brief - * Increment the counter to reserve the table to translate the process name to PNO - * - * @param[in] none - */ -static void OtherIncRsvCntOfCnvTbl(void) { - g_p_proc_id_tbl->rsv_cnt++; - return; -} - -/** - * @brief - * Decrement the counter to reserve the table to translate the process name to PNO - * - * @param[in] none - */ -static void OtherDecRsvCntOfCnvTbl(void) { - g_p_proc_id_tbl->rsv_cnt--; - return; -} - -/** - * @brief - * Determine resources ready (The table to translate the process name to PNO) - * - * @param[in] none - * - * @return BOOL - * @retval TRUE : Normal - * @retval FALSE : Error (Resource shortage) - */ -BOOL _pb_GetOtherResource(void) { - BOOL ret = TRUE; - uint32_t cnt; - - OtherLockMutex(); - - /* Increment reserved counter */ - OtherIncRsvCntOfCnvTbl(); - - cnt = g_p_proc_id_tbl->use_cnt + g_p_proc_id_tbl->rsv_cnt; - if (cnt >= FULL_OTHER_PROC_NUM) { - ret = FALSE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \ - "[FATAL][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt); - } else if (cnt >= WARN_OTHER_PROC_NUM) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \ - "[WARN][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt); - } - - OtherUnlockMutex(); - - return ret; -} - -/** - * @brief - * Release resources (The table to translate process name to PNO) - * - * @param[in] none - * - * @return none - */ -void _pb_ReleaseOtherResource(void) { - OtherLockMutex(); - - /* Decrement reserved counter */ - OtherDecRsvCntOfCnvTbl(); - - OtherUnlockMutex(); - - return; -} diff --git a/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp b/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp deleted file mode 100755 index e8d9601..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbProcMng.cpp - System name : - Subsystem name : - Title : -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" -#include "_pbWaitforsingleobject.h" - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : ExitProcess - * ABSTRACT : Terminate one process and all threads belonging to that process. - * NOTE : - * ARGUMENT : - * RETURN : VOID defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID ExitProcess(UINT u_exit_code) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - exit(u_exit_code); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetCurrentProcess - * ABSTRACT : Get a pseudo handle for the current process. - * NOTE : - * ARGUMENT : - * RETURN : HANDLE defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* QAC 3460 */ -HANDLE GetCurrentProcess(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return reinterpret_cast(getpid()); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetCurrentProcessId - * ABSTRACT : Get the process identifier of the calling process. - * NOTE : - * ARGUMENT : - * RETURN : DWORD defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* QAC 3460 */ -DWORD GetCurrentProcessId(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return (DWORD)getpid(); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : _pb_ExitThread - * ABSTRACT : Terminate a thread - * NOTE : - * ARGUMENT : - * RETURN : VOID defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -VOID _pb_ExitThread(DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* Delete handle type */ - WaitObjectDel(reinterpret_cast(pthread_self())); - - return pthread_exit (reinterpret_cast(dw_exit_code)); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : TerminateThread - * ABSTRACT : Terminate a thread - * NOTE : - * ARGUMENT : - * RETURN : BOOL defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BOOL TerminateThread(HANDLE h_thread, DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int32 lret = EOK; - BOOL bret = TRUE; - - /* Delete handle type */ - WaitObjectDel(h_thread); - - /* When an error occurs */ - if (lret == EOK) { - bret = FALSE; - } - - return bret; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetExitCodeThread - * ABSTRACT : Get the exit status of the specified thread. - * NOTE : - * ARGUMENT : - * RETURN : BOOL defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BOOL GetExitCodeThread(HANDLE h_thread, LPDWORD lp_exit_code) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return TRUE; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : WaitExitThread - * ABSTRACT : Wait for the thread to terminate. - * NOTE : It can only be used for a thread in the same process according to PosixBasedOS001. - * ARGUMENT : - * RETURN : BOOL defined - * RET_NORMAL : Normal completion - * RET_ERROR : ABEND - * RET_ERRTIMEOUT : Timeout occurred - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API WaitExitThread(HANDLE h_handle, u_int32 ul_mill_seconds, u_int32* pul_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return RET_NORMAL; /* Coverity CID: 18759 compliant */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetCurrentThread - * ABSTRACT : Get a pseudo handle for the current thread. - * NOTE : - * ARGUMENT : - * RETURN : HANDLE defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* QAC 3460 */ -HANDLE GetCurrentThread(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return (HANDLE)pthread_self(); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetCurrentThreadId - * ABSTRACT : Get the thread identifier of the calling thread. - * NOTE : - * ARGUMENT : - * RETURN : DWORD defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* QAC 3460 */ -DWORD GetCurrentThreadId(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return (DWORD)pthread_self(); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : GetThreadTimes - * ABSTRACT : Get time information about the specified thread. - * NOTE : - * ARGUMENT : - * RETURN : BOOL defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -BOOL GetThreadTimes(HANDLE h_process, HANDLE h_thread, LPFILETIME lp_creation_time, LPFILETIME lp_exit_time, LPFILETIME lp_kernel_time, LPFILETIME lp_user_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return TRUE; /* Coverity CID: 18765 compliant */ -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : ResumeThread - * ABSTRACT : Decrease the thread suspend count by 1. - * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001. - * ARGUMENT : - * RETURN : DWORD defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -DWORD ResumeThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return 0; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SuspendThread - * ABSTRACT : Suspend execution of the specified thread. - * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001. - * ARGUMENT : - * RETURN : DWORD defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -DWORD SuspendThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return 0; -} -// LCOV_EXCL_STOP - diff --git a/vehicleservice/positioning_base_library/library/src/_pbSem.cpp b/vehicleservice/positioning_base_library/library/src/_pbSem.cpp deleted file mode 100755 index 1264d79..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbSem.cpp +++ /dev/null @@ -1,780 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbSem.cpp - */ - -#include -#include "_pbInternalProc.h" -#include "WPF_STD_private.h" -#include "tchar.h" - -/* - Constants and structure definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define MAX_PB_SEMAPHORES 256 -#define MAX_SEMAPHORE_NAME_LEN 32 -#define MAX_PB_SEMAPHORES_INPROC 16 - -/* Name storage table */ -typedef struct { - TCHAR semaphore_name[MAX_SEMAPHORE_NAME_LEN + 1]; /* Semaphore name(Specified name of the user APP) */ - DWORD ref_counter; /* Reference Counter (Currently unused, always 1) */ -} PB_SEMAPHORE; - -/* Control information storage table */ -typedef struct { - HANDLE h_heap; /* Handle of the heap area allocated for expanding the self TBL (control-information-storage TBL) */ - PB_SEMAPHORE* p_sys_semaphore; /* Address where the self name in the name storage table is stored (Top address of self name) */ - DWORD index; /* Semaphore ID that is equal to the index of self TBL (control information strage TBL:p_handle_table) + 1 */ - HANDLE h_semaphore; /* Semaphore handle (Semaphore or Mutex according to the above DEBUG defines) */ - HANDLE h_mutex; /* Mutex handle for locking when updating the self TBL (control information storage TBL) */ -} PB_SEMAPHORE_OPEN_HANDLE; - -/* Semaphore information management table */ -typedef struct { - PB_SEMAPHORE_OPEN_HANDLE* p_handle_table[MAX_PB_SEMAPHORES]; /* Pointer to control information storage table */ - HANDLE h_shared_memory; /* Handle of shared memory allocated for name storage table to expand */ - HANDLE h_mutex; /* Mutex handle to lock when updating the name storage table */ - PB_SEMAPHORE* p_semaphore_table; /* Pointer to the name storage table (Allocate as many areas as the maximum number of registrations in shared memory)*/ -} PB_SEMAPHORE_INSTANCE; - -typedef struct /* In-process semaphore management table */ { - char semaphore_name[MAX_SEMAPHORE_NAME_LEN]; /* Semaphore name (Specified name of the user APP) */ - HANDLE h_heap; /* Heap handle of critical section structure area */ - CRITICAL_SECTION *p_cs; /* Critical section pointer(Semaphore ID) */ -} PB_SEM_INPROC; - -/* - Internal function prototype declarations -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static DWORD FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex); -static DWORD AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex); -static void FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex); - -/* - Global variable definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static PB_SEMAPHORE_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance -/* CS for exclusive control of in-process semaphore management table */ -CRITICAL_SECTION g_sem_in_proc_tbl_mng_cs; -/* Pointer to the in-process semaphore management table */ -PB_SEM_INPROC *g_p_sem_in_proc_mng = NULL; - -/* - * Inline functions. - */ -inline void -MakeSemaphoreName(TCHAR* name, DWORD index) { - wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_SEM%05d"), static_cast(index)); -} -inline void -MakeMutexName(TCHAR* name, DWORD index) { - wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX%05d"), static_cast(index)); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SemaphoreInit - * ABSTRACT : Semaphore initialization processing - * NOTE : This function is called when _CWORD64_api.dll is ATTACH from processes - * : and initializes the process. - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Normal completion - * RET_ERRINIT ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SemaphoreInit(void) { - RET_API ret_api = RET_NORMAL; - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - TCHAR name[32] = {0}; - DWORD semaphore_table_size = 0; - int32 n = 0; - PB_SEMAPHORE *p_semaphore_table = NULL; - BOOL b_create = FALSE; - - /* Initialize the semaphore information management table */ - for (n = 0; n < MAX_PB_SEMAPHORES; n++) { - p_inst->p_handle_table[n] = NULL; /* NULL initialize the control data storage table */ - } - - /* Initialize the semaphore name storage table */ - _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_TABLE")); - semaphore_table_size = sizeof(PB_SEMAPHORE) * MAX_PB_SEMAPHORES; - /* Open shared memory with the name _CWORD64__SEMAPHORE_TABLE */ - p_inst->h_shared_memory = OpenSharedMemory(name, semaphore_table_size); - if (p_inst->h_shared_memory == NULL) /* If shared memory does not exist */ { - /* Create a shared memory with the name _CWORD64__SEMAPHORE_TABLE */ - p_inst->h_shared_memory = CreateSharedMemory(name, semaphore_table_size); - if (p_inst->h_shared_memory == NULL) /* If shared memory creation fails */ { - ret_api = RET_ERRINIT; /* Ends in error */ - } else { - b_create = TRUE; /* Create shared memory */ - - /* Allocate the created shared memory to the semaphore name storage table and initialize it. */ - // LCOV_EXCL_BR_START 200: cannot be null - p_semaphore_table = reinterpret_cast(GetSharedMemoryPtr(p_inst->h_shared_memory)); - // LCOV_EXCL_BR_STOP - if (p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null - // LCOV_EXCL_START 200: cannot be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - CloseSharedMemory(p_inst->h_shared_memory); - DeleteSharedMemory(name); - ret_api = RET_ERRINIT; /* Ends in error */ - // LCOV_EXCL_STOP - } else { - for (n = 0; n < MAX_PB_SEMAPHORES; n++) { - p_semaphore_table[n].semaphore_name[0] = __TEXT('\0'); /* Initialize name */ - p_semaphore_table[n].ref_counter = 0; /* Initialize reference counter */ - } - } - } - } - - if (ret_api == RET_NORMAL) { - /* Save the address of the shared memory to the name storage table pointer of the semaphore information management table. */ - // LCOV_EXCL_BR_START 200: cannot be null - p_inst->p_semaphore_table = reinterpret_cast(GetSharedMemoryPtr(p_inst->h_shared_memory)); - // LCOV_EXCL_BR_STOP - if (p_inst->p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null - // LCOV_EXCL_START 200: cannot be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - CloseSharedMemory(p_inst->h_shared_memory); - if (b_create != FALSE) { - DeleteSharedMemory(name); - } - ret_api = RET_ERRINIT; /* Ends in error */ - // LCOV_EXCL_STOP - } else { - /* Mutex creation process for semaphore-information-management table */ - _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX")); - /* Save the handle of the created Mutex in the Mutex handles for semaphore-information-management-table */ - p_inst->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: can not be null - if (p_inst->h_mutex == NULL) { /* Failed to create a Mutex. */ // LCOV_EXCL_BR_LINE 200: can not be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \ - "In SemaphoreInit\r\n", LTEXT(__FILE__), __LINE__); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name); - _pb_Exit(); - // LCOV_EXCL_STOP - } - } - } - - return ret_api; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SemaphoreTerm - * ABSTRACT : Semaphore function termination processing - * NOTE : Called when the process ATTACH to _CWORD64_api.dll terminates, and then terminated. - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Always this value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SemaphoreTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - - if (p_inst->h_mutex != NULL) { - PbDeleteMutex(p_inst->h_mutex); - p_inst->h_mutex = NULL; - } - - if (p_inst->h_shared_memory != NULL) { - CloseSharedMemory(p_inst->h_shared_memory); - p_inst->h_shared_memory = NULL; - } - - return RET_NORMAL; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Create Semaphore - * - * Create a semaphore and return a semaphore ID.
- * For a semaphore that has already been created, return the same value of the semaphore ID when it has been created. - * - * @param[in] *sem_name Pointer to the semaphore name string to be created (NULL termination) - * - * @return Semaphore ID created other than 0
- * 0 ABEND to create semaphore - */ -#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE -SemID _pb_CreateSemaphore(char* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API -#else -SemID _pb_CreateSemaphore(TCHAR* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API -#endif // _CWORD64_API_DOES_NOT_USE_UNICODE -{ - SemID ret_sem_id = 0; - TCHAR *p_semaphore_name = NULL; - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - TCHAR name[MAX_SEMAPHORE_NAME_LEN + 1] = {0}; - PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL; - DWORD index = 0; - - /* Check if the semaphore name is NULL */ - if (sem_name == NULL) { - } else { - p_semaphore_name = sem_name; - - /* Check if the semaphore name is specified */ - if (p_semaphore_name[0] == __TEXT('\0')) { - } else if (_tcslen(p_semaphore_name) > MAX_SEMAPHORE_NAME_LEN) { - /* Check whether the semaphore name is less than or equal to the maximum number of characters */ - } else { - /* Allocate Heap control information storage table area to create a semaphore */ - p_semaphore_open = reinterpret_cast(PbProcessHeapAlloc(0, \ - sizeof(PB_SEMAPHORE_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: no branch - } - - if (p_semaphore_open != NULL) { - PbMutexLock(p_inst->h_mutex, INFINITE); /* Mutex Lock from here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - - /* Retrieve the name storage table expanded in the shared memory with the user-specified name. */ - index = FindSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex); - if (index != ((DWORD) - 1)) { - /* The semaphore name specified for the user already exists. */ - /* Check if the control information storage table exists */ - if (p_inst->p_handle_table[index] != NULL) { - /* If the control information storage TBL exists,(If it has already been created by this process) */ - /* release the previously allocated Heap because it is not needed. */ - PbProcessHeapFree(0, p_semaphore_open); // LCOV_EXCL_BR_LINE 200: no branch - /* Retrieve the pointer to the TBL storing the existing control information. */ - p_semaphore_open = p_inst->p_handle_table[index]; - PbMutexUnlock(p_inst->h_mutex); /* Mutex release */ // LCOV_EXCL_BR_LINE 200: no branch - /* Convert from an index of array to a semaphore ID and return (If it has already been created in this process) */ - ret_sem_id = static_cast(index + 1); - } else { - // LCOV_EXCL_START 200: p_handle_table can not be NULL - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* If a semaphore with the established name exists but the control information table does not exist, link to it or create it in the following processing. */ - /* (A semaphore was created by another process or the created process was terminated.) */ - /* Store the assigned semaphore ID in the control information storage table. */ - p_semaphore_open->index = index; - /* Store the start address of the name storage table */ - p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index]; - /* Store the address of the control information TBL (Heap) into the semaphore information management TBL. */ - p_inst->p_handle_table[index] = p_semaphore_open; - - /* Create the object name of the semaphore from the position (index of array) of the control information storage TBL. */ - /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */ - MakeSemaphoreName(name, index); - - /* Create a semaphore object using Mutex and store its handle into the control information storage TBL. */ - p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name); - if (p_semaphore_open->h_semaphore == NULL) { - /* If the semaphore object creation failed, */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \ - "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name); - _pb_Exit(); /* Make reset */ - } - - /* Create a Mutex name for locking the control information storage TBL from the position (index of array) of the control information storage TBL */ - /* "_CWORD64__SEMAPHORE_MUTEXxxxxx" : xxxxx is expanded with five-digit array index */ - MakeMutexName(name, index); - /* Create a Mutex for locking the control information storage TBL and store its handle into the control information storage TBL */ - p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name); - if (p_semaphore_open->h_mutex == NULL) { - /* If the creation of a Mutex for locking the control data storage TBL fails, */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \ - "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name); - _pb_Exit(); - } - /* Semaphore Lock for updating semaphore information control TBL */ - PbMutexLock(p_semaphore_open->h_mutex, INFINITE); - p_semaphore_open->p_sys_semaphore->ref_counter = 1; - /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */ - PbMutexUnlock(p_semaphore_open->h_mutex); - /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */ - PbMutexUnlock(p_inst->h_mutex); - - ret_sem_id = static_cast(index + 1); /* Convert from an index of array to a semaphore ID and return */ - /* (A semaphore was created by another process or the created process was terminated.) */ - // LCOV_EXCL_STOP - } - } else { - /* If the semaphore name specified by the user does not exist, it is newly created in the following processing. */ - /* Free-space retrieval processing for the name storage table */ - index = AllocNewSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex); - if (index == ((DWORD) - 1)) { // LCOV_EXCL_BR_LINE 200: table buffer is enough, can not failed - /* If there is no free space in the name storage table */ - /* Initialize the name storage TBL pointer of the control information storage TBL. (it may be No meaning due to release heap area in the following processing?) */ - // LCOV_EXCL_START 200: table buffer is enough, can not failed - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - p_semaphore_open->p_sys_semaphore = NULL; - /* Free the Heap area allocated for control information storage TBL */ - PbProcessHeapFree(0, p_semaphore_open); - /* Semaphore UnLock to recover from errors */ - PbMutexUnlock(p_inst->h_mutex); - // LCOV_EXCL_STOP - } else { - /* Store the assigned semaphore ID in the control information storage table. */ - p_semaphore_open->index = index; - /* Store this start address of the name storage table */ - p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index]; - p_semaphore_open->p_sys_semaphore->ref_counter = 1; /* Reset reference counter. */ - /* Store the control information TBL (Heap) address in the semaphore information management TBL. */ - p_inst->p_handle_table[index] = p_semaphore_open; - - /* Create the object name of the semaphore from the position (array index) of the control information storage TBL. */ - /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */ - MakeSemaphoreName(name, index); - p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length) - if (p_semaphore_open->h_semaphore == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \ - "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name); - _pb_Exit(); - // LCOV_EXCL_STOP - } - - MakeMutexName(name, index); - p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length) - if (p_semaphore_open->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null - // LCOV_EXCL_START 200: can not be null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \ - "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name); - _pb_Exit(); - // LCOV_EXCL_STOP - } - /* Semaphore name registration */ - _tcscpy(p_semaphore_open->p_sys_semaphore->semaphore_name, p_semaphore_name); - - PbMutexUnlock(p_inst->h_mutex); /* Mutex lock to new create semaphore ends here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - - ret_sem_id = static_cast(index + 1); /* Convert from an array index to a semaphore ID and return */ - } - } - } - } - - return ret_sem_id; /* Return the allocated semaphore ID. */ -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbDeleteSemaphore - * ABSTRACT : Semaphore deletion processing - * NOTE : Delete the semaphore specified by semaphore ID - * ARGUMENT : SemID sem_id Semaphore ID to be deleted - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_OSERROR ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbDeleteSemaphore(SemID sem_id) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - int index = 0; - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL; - DWORD dw_ret_sts = 0; - DWORD ref_counter = 0; - - /* Parameter check */ - if (sem_id == 0) { - /* Error if specified semaphore ID is zero */ - ret_api = RET_OSERROR; - } - - if (ret_api == RET_NORMAL) { - index = static_cast(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */ - if (index >= MAX_PB_SEMAPHORES) { - /* If the specified semaphore ID is out of range */ - ret_api = RET_OSERROR; - } - } - - if (ret_api == RET_NORMAL) { - PbMutexLock(p_inst->h_mutex, INFINITE); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */ - p_semaphore_open = p_inst->p_handle_table[index]; - PbMutexUnlock(p_inst->h_mutex); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */ - if (p_semaphore_open == NULL) /* If the specified semaphore ID is not registered in the table */ { - ret_api = RET_OSERROR; - } - } - - if (ret_api == RET_NORMAL) { - /* Return an error if the semaphore is locked */ - dw_ret_sts = PbMutexLock(p_semaphore_open->h_semaphore, 0); - if (dw_ret_sts == WAIT_TIMEOUT) { - ret_api = RET_OSERROR; - } - } - - if (ret_api == RET_NORMAL) { - PbMutexUnlock(p_semaphore_open->h_semaphore); - - PbMutexLock(p_semaphore_open->h_mutex, INFINITE); - if (p_semaphore_open->p_sys_semaphore->ref_counter > 0) { - p_semaphore_open->p_sys_semaphore->ref_counter--; - } - - ref_counter = p_semaphore_open->p_sys_semaphore->ref_counter; - PbMutexUnlock(p_semaphore_open->h_mutex); - - if (ref_counter == 0) { - PbMutexLock(p_inst->h_mutex, INFINITE); /* Get Mutex */ - - FreeSemaphoreTable(p_inst->p_semaphore_table, index, p_inst->h_mutex); - p_semaphore_open->p_sys_semaphore = NULL; - if (p_semaphore_open->h_semaphore != NULL) { - PbDeleteMutex(p_semaphore_open->h_semaphore); - p_semaphore_open->h_semaphore = NULL; - } - - if (p_semaphore_open->h_mutex != NULL) { - PbDeleteMutex(p_semaphore_open->h_mutex); - p_semaphore_open->h_mutex = NULL; - } - - PbProcessHeapFree(0, p_semaphore_open); - - p_inst->p_handle_table[index] = NULL; - PbMutexUnlock(p_inst->h_mutex); /* Release Mutex */ - } - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Semaphore Lock - * - * Get the semaphore with the specified semaphore ID. Do not return from this function until it is acquired. - * - * @param[in] sem_id Semaphore ID of the semaphore to be acquired - * - * @return RET_NORMAL Normal completion
- * RET_OSERROR ABEND - */ -RET_API _pb_SemLock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - RET_API ret_api = RET_OSERROR; - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL; - int index = 0; - DWORD result = 0; - - /* Parameter check */ - if (sem_id != 0) { - /* The specified semaphore ID is non-zero */ - index = static_cast(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */ - if (index >= MAX_PB_SEMAPHORES) { - /* If the specified semaphore ID is out of range */ - } else { - p_semaphore_open = p_inst->p_handle_table[index]; - if (p_semaphore_open != NULL) { - /* If the specified semaphore ID is already registered in the table, */ - ret_api = RET_NORMAL; - } - } - } - - if (ret_api == RET_NORMAL) { - /* Wait forever until a semaphore is acquired */ - result = PbMutexLock(p_semaphore_open->h_semaphore, INFINITE); - - switch (result) { - case WAIT_OBJECT_0: { - ret_api = RET_NORMAL; - break; - } - case WAIT_ABANDONED: { // LCOV_EXCL_BR_LINE 200: function do not return this - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: function do not return this - break; // LCOV_EXCL_LINE 200: function do not return this - } - case WAIT_TIMEOUT: { // LCOV_EXCL_BR_LINE 200: parameter INFINITE not return this - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: parameter INFINITE not return this - break; // LCOV_EXCL_LINE 200: parameter INFINITE not return this - } - default: - ret_api = RET_OSERROR; - break; - } - } - - return ret_api; -} - -/** - * @brief - * Semaphore Unlock - * - * Release the semaphore specified by semaphore ID. - * - * @param[in] sem_id Semaphore ID of the semaphore to be released - * - * @return RET_NORMAL Normal completion
- * RET_OSERROR ABEND - */ -RET_API _pb_SemUnlock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API - RET_API ret_api = RET_OSERROR; - int index = 0; - PB_SEMAPHORE_INSTANCE *p_inst = &g_instance; - PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL; - BOOL ok = FALSE; - - /* Parameter check */ - if (sem_id != 0) { - /* The specified semaphore ID is non-zero */ - index = static_cast(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */ - if (index >= MAX_PB_SEMAPHORES) { - /* If the specified semaphore ID is out of range */ - } else { - p_semaphore_open = p_inst->p_handle_table[index]; - if (p_semaphore_open != NULL) { - /* If the specified semaphore ID is already registered in the table, */ - ret_api = RET_NORMAL; - } - } - } - - if (ret_api == RET_NORMAL) { - ok = PbMutexUnlock(p_semaphore_open->h_semaphore); // LCOV_EXCL_BR_LINE 200: unlock can not failed - if (ok == FALSE) { // LCOV_EXCL_BR_LINE 200: unlock can not failed - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: unlock can not failed - } - } - - return ret_api; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : InitSemaphoreInProcess - * ABSTRACT : Semaphore initialization processing - * NOTE : Initialize to use semaphore that is valid only within a process - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_OSERROR ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -InitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - DWORD pid; /* Process ID */ - TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */ - char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */ - char *cp_addr = NULL; /* For returning the start address of the shared data area */ - u_int32 dummy_size; /* For returning the size of shared data area */ - - pid = getpid(); /* Get process ID */ - - memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name)); - memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name)); -#ifdef UNDER_CE - /* Create the name of shared data area for in-process semaphore management table */ - wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid); - wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name)); -#else - /* Create the name of shared data area for in-process semaphore management table */ - wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast(pid)); -#endif - - /* Link to shared data area for semaphore management table in process */ - ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast(&cp_addr), &dummy_size); - if (ret_api == RET_NORMAL) { - /* Successful completion because _pb_InitSemaphoreInProcess has already been executed. */ - } else { - /* Create shared data area for in-process semaphore management table */ - ret_api = _pb_CreateShareData(&mbs_share_data_name[0], - static_cast(sizeof(PB_SEM_INPROC) * MAX_PB_SEMAPHORES_INPROC), \ - reinterpret_cast(&cp_addr)); - if (ret_api == RET_NORMAL) { - /* Save top address of in-process semaphore management table */ - g_p_sem_in_proc_mng = reinterpret_cast(cp_addr); - - /* Initialization processing of the critical section object for in-process semaphore management table lock */ - PbInitializeCriticalSection(&g_sem_in_proc_tbl_mng_cs); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \ - "ERROR:InitSemaphoreInProcess --> _pb_CreateShareData ##\r\n", LTEXT(__FILE__), __LINE__); - ret_api = RET_OSERROR; - } - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DeinitSemaphoreInProcess - * ABSTRACT : Semaphore function termination processing - * NOTE : Terminate semaphore function that is valid only within a process - * ARGUMENT : None - * RETURN : RET_API RET_NORMAL Normal completion - * : RET_OSERROR ABEND - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DeinitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - PB_SEM_INPROC *p_sem_in_proc; /* Pointer to the in-process semaphore management table */ - DWORD pid; /* Process ID */ - TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */ - char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */ - char *cp_addr = NULL; /* For returning the start address of the shared data area */ - u_int32 dummy_size; /* For returning the size of the shared data area */ - int i; - - pid = getpid(); /* Get process ID */ - - memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name)); - memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name)); -#ifdef UNDER_CE - /* Create the name of shared data area for in-process semaphore management table */ - wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid); - wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name)); -#else/* Create the name of shared data area for in-process semaphore management table */ - wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast(pid)); -#endif - - /* Link to shared data area for in-process semaphore management table */ - ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast(&cp_addr), &dummy_size); - if (ret_api != RET_NORMAL) { - ret_api = RET_NORMAL; /* If the link fails, it is assumed to have been deleted and it completes normally. */ - } else { - /* Get CS for exclusive control of in-process semaphore management table */ - PbEnterCriticalSection(&g_sem_in_proc_tbl_mng_cs); - - p_sem_in_proc = g_p_sem_in_proc_mng; /* Get start address of in-process semaphore management table */ - if (p_sem_in_proc == NULL) { - ret_api = RET_OSERROR; - } else { - /* Search in-process semaphore management table (delete all semaphores) */ - for (i = 0; i < MAX_PB_SEMAPHORES_INPROC; i++, p_sem_in_proc++) { - if (p_sem_in_proc->p_cs != 0) { - PbDeleteCriticalSection(p_sem_in_proc->p_cs); /* Delete critical section */ - /* Release the Heap area allocated as the critical section structured area */ - PbProcessHeapFree(0, p_sem_in_proc->p_cs); - } - } - - ret_api = PbDeleteShareData(&mbs_share_data_name[0]); /* Delete shared data area */ - if (ret_api != RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \ - "ERROR:DeinitSemaphoreInProcess --> PbDeleteShareData ##\r\n", LTEXT(__FILE__), __LINE__); - ret_api = RET_OSERROR; - } else { - g_p_sem_in_proc_mng = NULL; - } - } - - PbLeaveCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Release CS for exclusive control of in-process semaphore management table */ - - if (ret_api == RET_NORMAL) { - /* When the process is completed normally up to this point */ - PbDeleteCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Delete critical section */ - } - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/***** Internal functions *****/ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FindSemaphoreTable - * ABSTRACT : Name storage table retrieval processing - * NOTE : Retrieve the specified name storage table with the specified name, - * : and return its array index if the specified name exists in the table. - * : The specified Mutex is locked during this table retrieval processing. - * ARGUMENT : PB_SEMAPHORE* p_semaphore_table Pointer to the name storage TBL - * TCHAR* name Pointer to the name to be retrieved - * HANDLE h_mutex Handle of the name storage TBL-locking Mutex - * RETURN : DWORD othe than -1 Array index of containing the name string to be retrieved - * : -1 Specified name does not exist - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static DWORD -FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) { - DWORD ret = (DWORD) - 1; - /* Loop up to the maximum number of entries and search the name storage table. */ - for (int n = 0; n < MAX_PB_SEMAPHORES; n++) { - /* If there is a matching name, */ - if (_tcscmp(p_semaphore_table[n].semaphore_name, name) == 0) { - ret = n; /* Return the index of the array in which the given name existed */ - break; - } - } - /* UnLock the lock Mutex because the search for the name storage table has been completed. */ - /* PbMutexUnlock(h_mutex); */ - - return ret; /* Since no search name exists, an error value of-1 is returned. */ -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : AllocNewSemaphoreTable - * ABSTRACT : Name storage table free space retrieval processing - * NOTE : Retrieve the specified name storage table from the beginning, - * : return the array index of any free space. - * : [Note] Because the Mutex part inside this function has been deleted - * : to fix a bug caused by Mutex leaks, the whole function must be - * : locked by Mutex from the outside when this function is used. - * ARGUMENT : PB_SEMAPHORE *p_semaphore_table - * TCHAR *name - * HANDLE h_mutex - * RETURN : DWORD - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static DWORD -AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) { - DWORD ret = (DWORD) - 1; - /* Loop up to the maximum number of entries and search the name storage table. */ - for (int n = 0; n < MAX_PB_SEMAPHORES; n++) { - /* If there is free space */ - if (p_semaphore_table[n].semaphore_name[0] == __TEXT('\0')) { - ret = n; - break; - } - } - - return ret; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : FreeSemaphoreTable - * ABSTRACT : - * NOTE : - * ARGUMENT : PB_SEMAPHORE* p_semaphore_table - * int index - * HANDLE h_mutex - * RETURN : None - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -static void -FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - p_semaphore_table[index].semaphore_name[0] = __TEXT('\0'); -} -// LCOV_EXCL_STOP - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : _sysSem.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ diff --git a/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp b/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp deleted file mode 100755 index c6044af..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "_pbSerial.h" -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" - -typedef struct SerialTable { - HANDLE h_handle; /* Registration handle */ - DWORD dw_wait_mask; /* SetMask */ - DWORD dw_read_timeout; /* milisec */ - DWORD dw_write_timeout; /* milisec */ - struct SerialTable *next; -} SERIAL_TABLE; - -static SERIAL_TABLE *g_pst_serial_table = NULL; -static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */ - -/* Prototype declarations */ -static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj); -static BOOL AddList(SERIAL_TABLE *p_add_list); -static BOOL DelList(SERIAL_TABLE *h_del_obj); -static BOOL FunctionLock(void); -static BOOL FunctionUnlock(void); - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* _sys internal public APIs -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/**************************************************************************** -@brief SerialTableInit
- Initialize each process -@outline SerialTableInit
- Initialize each process -@type Completion return type - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialTableInit(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* do nothing at this time */ - return TRUE; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialTableTerm
- termination processing for each process -@outline SerialTableTerm
- termination processing for each process -@type Completion return type - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialTableTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if (NULL != g_pst_serial_table) { - /* delete the list? */ - } - return TRUE; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialObjectTimeoutAdd
- Set read/write timeout -@outline SerialObjectTimeoutAdd
- Set read/write timeout -@type Completion return type - -@param[in] HANDLE h_obj : Handle to set the timeout -@param[in] DWORD dw_read_timeout : Timeout to read (Millisecond) -@param[in] DWORD dw_write_timeout : Timeout to write (Millisecond) - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *p_list = NULL; - BOOL bret = FALSE; - - if (NULL != h_obj) { - FunctionLock(); - bret = FindList(&p_list, h_obj); - if (TRUE == bret) { - /* Already exists in the list */ - if (NULL != p_list) { - p_list->dw_read_timeout = dw_read_timeout; - p_list->dw_write_timeout = dw_write_timeout; - bret = TRUE; - } else { - /* The list pointer is expected to be in the list but cannot be retrieved. */ - bret = FALSE; - } - } else { - /* Not exist in the list */ - p_list = reinterpret_cast(malloc(sizeof(SERIAL_TABLE))); - if (NULL != p_list) { - p_list->next = NULL; - p_list->dw_wait_mask = 0; - p_list->h_handle = h_obj; - p_list->dw_read_timeout = dw_read_timeout; - p_list->dw_write_timeout = dw_write_timeout; - bret = AddList(p_list); - if (FALSE == bret) { - /* Registration failure */ - free(p_list); - bret = FALSE; - } else { - /* Registration success */ - bret = TRUE; - } - } else { - /* Falied to get memory */ - bret = FALSE; - } - } - FunctionUnlock(); - } else { - /* Parameter error */ - bret = FALSE; - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialObjectTimeoutGet
- Get read/write timeout -@outline SerialObjectTimeoutGet
- Get read/write timeout -@type Completion return type - -@param[in] HANDLE h_obj : Handle for getting the timeout -@param[out] DWORD* dw_read_timeout : Timeout to read (Millisecond) -@param[out] DWORD* dw_write_timeout : Timeout to write (Millisecond) - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD *dw_read_timeout, DWORD *dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *p_list = NULL; - BOOL bret = FALSE; - - if ((NULL != h_obj) && (NULL != dw_read_timeout) && (NULL != dw_write_timeout)) { - FunctionLock(); - bret = FindList(&p_list, h_obj); - if (TRUE == bret) { - /* Exists in the list */ - if (NULL != p_list) { - *dw_read_timeout = p_list->dw_read_timeout; - *dw_write_timeout = p_list->dw_write_timeout; - bret = TRUE; - } else { - /* The list pointer is expected to be in the list but cannot be retrieved. */ - bret = FALSE; - } - } else { - /* Not exist in the list */ - bret = FALSE; - } - FunctionUnlock(); - } else { - /* Parameter error */ - bret = FALSE; - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialObjectWaitmaskAdd
- Set the mask of event wait factor -@outline SerialObjectWaitmaskAdd
- Set the mask of event wait factor -@type Completion return type - -@param[in] HANDLE h_obj : Handle to set the mask -@param[in] DWORD dw_mask : Value of mask - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *p_list = NULL; - BOOL bret = FALSE; - - if (NULL != h_obj) { - FunctionLock(); - bret = FindList(&p_list, h_obj); - if (TRUE == bret) { - /* already exists in the list */ - if (NULL != p_list) { - /* Clear unused flags */ - p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR)); - bret = TRUE; - } else { - /* The list pointer is expected to be in the list but cannot be retrieved. */ - bret = FALSE; - } - } else { - /* Not exist in the list */ - p_list = reinterpret_cast(malloc(sizeof(SERIAL_TABLE))); - if (NULL != p_list) { - p_list->next = NULL; - p_list->h_handle = h_obj; - p_list->dw_read_timeout = INFINITE; /* Infinity wait as initial value */ - p_list->dw_write_timeout = INFINITE; /* Infinity wait as initial value */ - /* Clear unused flags */ - p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR)); - bret = AddList(p_list); - if (FALSE == bret) { - /* Registration failure */ - free(p_list); - bret = FALSE; - } else { - /* registration success */ - bret = TRUE; - } - } else { - /* Failed to get memory */ - bret = FALSE; - } - } - FunctionUnlock(); - } else { - /* Parameter error */ - bret = FALSE; - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialObjectWaitmaskGet
- Get the set mask value from a handle -@outline SerialObjectWaitmaskGet
- Get the set mask value from a handle -@type Completion return type - -@param[in] HANDLE h_obj : Handle from which the mask is to be acquired -@param[out] DWORD* dw_mask : mask value - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD *dw_mask) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *p_list = NULL; - BOOL bret = FALSE; - - if ((NULL != h_obj) && (NULL != dw_mask)) { - *dw_mask = 0; - FunctionLock(); - bret = FindList(&p_list, h_obj); - if (TRUE == bret) { - /* Exists in the list */ - if (NULL != p_list) { - *dw_mask = p_list->dw_wait_mask; - bret = TRUE; - } else { - /* The list pointer is expected to be in the list but cannot be retrieved. */ - bret = FALSE; - } - } else { - /* Not exist in the list */ - bret = FALSE; - } - FunctionUnlock(); - } else { - /* Parameter error */ - bret = FALSE; - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief SerialObjectDel
- Delete Timeout and Mask Setting -@outline SerialObjectDel
- Delete Timeout and Mask Setting -@type Completion return type - -@param[in] HANDLE h_obj : Handle from which the setting is to be deleted - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL SerialObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *p_list = NULL; - BOOL bret = FALSE; - - if (NULL != h_obj) { - FunctionLock(); - bret = FindList(&p_list, h_obj); - if (TRUE == bret) { - /* Already exists in the list */ - if (NULL != p_list) { - bret = DelList(p_list); - if (TRUE == bret) { - free(p_list); - } else { - /* Failed to delete */ - } - } else { - /* The list pointer is expected to be in the list but cannot be retrieved. */ - bret = FALSE; - } - } else { - /* Not exist in the list */ - } - FunctionUnlock(); - } else { - /* Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Private APIs -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/**************************************************************************** -@brief FindList
- Searching for a Handle in the List -@outline FindList
- Searching for a Handle in the List -@type Completion return type - -@param[out] SERIAL_TABLE** p_list : Found list pointer -@param[in] HANDLE h_obj : Handle to look for - -@return BOOL -@retval TRUE : Normal (p_list != NULL) -@retval FALSE : Error (p_list == NULL) -*****************************************************************************/ -static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *pNow = NULL; - BOOL bret = FALSE; - - if ((NULL != h_obj) && (NULL != p_list)) { - /* Search list */ - pNow = g_pst_serial_table; - while (NULL != pNow) { - /* h_obj and pNow->h_handle are pointer type.*/ - if ((int64_t)h_obj == (int64_t)pNow->h_handle) { - *p_list = pNow; - bret = TRUE; - break; - } - pNow = pNow->next; - } - } else { - bret = FALSE; /* Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief AddList
- Append data to the end of the list -@outline AddList
- Append data to the end of the list -@type Completion return type - -@param[in] SERIAL_TABLE* p_list : Data to add - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL AddList(SERIAL_TABLE *p_add_list) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *pNow = NULL; - BOOL bret = FALSE; - - if (NULL != p_add_list) { - /* Add unregistered data */ - if (NULL == g_pst_serial_table) { - g_pst_serial_table = p_add_list; - bret = TRUE; - } else { - /* Add to end of list */ - pNow = g_pst_serial_table; - while (NULL != pNow) { - if (NULL == pNow->next) { - pNow->next = p_add_list; - bret = TRUE; - break; - } - pNow = pNow->next; - } - } - } else { - bret = FALSE; /* Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief DelList
- Remove Specified Data from a List -@outline DelList
- Remove Specified Data from a List -@type Completion return type - -@param[in,out] SERIAL_TABLE* h_del_obj : - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL DelList(SERIAL_TABLE *h_del_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SERIAL_TABLE *pNow = NULL; - SERIAL_TABLE *pBef = NULL; - BOOL bret = FALSE; - - if (NULL != h_del_obj) { - /* Add to end of list */ - pNow = g_pst_serial_table; - while (NULL != pNow) { - if (h_del_obj == pNow) { - if (NULL == pBef) { - /* Delete first data */ - g_pst_serial_table = pNow->next; - } else { - /* Others */ - pBef->next = h_del_obj->next; - } - bret = TRUE; - break; - } - pBef = pNow; - pNow = pNow->next; - } - } else { - bret = FALSE; /* Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief FunctionLock
- Start locking g_pst_serial_table -@outline FunctionLock
- Start locking g_pst_serial_table -@type Completion return type - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) { - bret = TRUE; - } - return bret; -} -// LCOV_EXCL_STOP - -/*************************************************************************** -@brief FunctionUnlock
- Terminate locking of g_pst_serial_table -@outline FunctionUnlock
- Terminate locking of g_pst_serial_table -@type Completion return type - -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) { - bret = TRUE; - } - return bret; -} -// LCOV_EXCL_STOP - diff --git a/vehicleservice/positioning_base_library/library/src/_pbSram.cpp b/vehicleservice/positioning_base_library/library/src/_pbSram.cpp deleted file mode 100755 index f31e16f..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbSram.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbSram.cpp - System name : 05 Integration Platform - Subsystem name : System common functions - Title : System APIs -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - -#include -#include "WPF_STD_private.h" - - -#ifdef __cplusplus -extern "C" { -#endif - /* - Function prototype declarations - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - RET_API SramDMWt(u_int32 mode); - RET_API SramDMWrkWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size); - RET_API SramDMWrkRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size); - -#ifdef __cplusplus -} -#endif - -/* - External function prototype declarations -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -extern RET_API CreateAsyncWtThread(void); - -/* - Global Variable Definitions -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -extern int g_n_api_set_id; /* ID variable for PSL registration */ -extern void *g_adr_diagmem_wrktop; /* Diag memory temporary work area top address */ - -#ifdef CEPC_EM /* Physical area (pseudo area) setting for CEPC and EM */ - -/* Allocation size of temporary work for diagnosis memory */ -#define SIZE_DIAGMEM_WRK 0x00001000 - -#endif - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramSetup - * ABSTRACT : SRAM Access-Initialization Process - * NOTE : When called by _sys_SramInit when _CWORD64_api.dll is attached, the SRAM physical area - * is mapped to the shared area so that the SRAM physical area can be accessed. - * The first call after system startup checks the result of the previous SRAM write processing. - * If the power is off during system startup, the system performs continuous write processing. - * (Before the _CWORD100_ modularization of SRAM access functions, - * they were used to open ports, but now they do not need to be opened.) - * ARGUMENT : u_int32 mount_flg HDD mount status flag - * u_int32 *mount_sts HDD mount status return pointer - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramSetup(u_int32 mount_flg, u_int32 *mount_sts) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramWt - * ABSTRACT : SRAM write process - * NOTE : Write the content of the buffer to the offset-position of the area of the specified SRAM ID. - * Temporary buffer is used for SRAM writing, and recovery from writing is considered. - * Therefore, the transfer data size must be less than or equal to the temporary buffer size. - * ARGUMENT : u_int8 id SRAM area id - * void *pbuf Source buffer pointer - * u_int32 off Destination SRAM offsets (bytes) - * u_int16 size Transfer data size (bytes) - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramFil - * ABSTRACT : SRAM memory-fill process - * NOTE : Fill with the specified patterns from the offset position of - * the area of the specified SRAM ID. - * Temporary buffer is used for SRAM writing, and recovery from writing is considered. - * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size. - * ARGUMENT : u_int8 id SRAM area id - * u_int32 off Fill destination SRAM offset (bytes) - * u_int8 pat Fill pattern - * u_int16 size Fill size (bytes) - * - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramFil(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - - ret_sts = PbSramFil32(id, off, pat, (u_int32)size); - - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbSramFil32 - * ABSTRACT : SRAM memory-fill process - * NOTE : Fill with the specified patterns from the offset position of - * the area of the specified SRAM ID. - * Temporary buffer is used for SRAM writing, and recovery from writing is considered. - * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size. - * ARGUMENT : u_int8 id SRAM area id - * u_int32 off Fill destination SRAM offset (bytes) - * u_int8 pat Fill pattern - * u_int32 size Fill size (bytes) - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramRd - * ABSTRACT : SRAM read process - * NOTE : Write content in the area specified SRAM ID and offset position to buffer. - * ARGUMENT : u_int8 id SRAM area ID - * u_int32 off Source SRAM Offset (bytes) - * void *pbuf Destination buffer pointer - * u_int16 size Transfer data size (bytes) - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - - ret_sts = PbSramRd32(id, off, pbuf, (u_int32)size); - - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbSramRd32 - * ABSTRACT : SRAM read process - * NOTE : Write content in the area specified SRAM ID and offset position to buffer. - * ARGUMENT : u_int8 id SRAM area ID - * u_int32 off Source SRAM Offset (bytes) - * void *pbuf Destination buffer pointer - * u_int32 size Transfer data size(bytes) - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramSz - * ABSTRACT : Acquisition of SRAM ID size - * NOTE : Get the effective area size of the specified SRAM ID. - * ARGUMENT : u_int8 id SRAM area ID - * u_int16 *psize Size (bytes) - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - u_int32 size32 = 0; - - ret_sts = PbSramSz32(id, &size32); - if (ret_sts == RET_NORMAL) { - if (size32 <= 0x0000FFFF) { - *psize = (u_int16)size32; - } else { - /* When the size of the specified ID is u_int16 or greater */ - ret_sts = RET_ERRPARAM; - } - } - - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : PbSramSz32 - * ABSTRACT : Acquisition of SRAM ID size - * NOTE : Get the effective area size of the specified SRAM ID. - * ARGUMENT : u_int8 id SRAM area ID - * u_int32 *psize Size (bytes) - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -PbSramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramRWChk - * ABSTRACT : SRAM read/write check processing - * NOTE : Checking whether SRAM can be read/written correctly - * ARGUMENT : None - * RETURN : RET_API - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramRWChk(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_NORMAL; /* Result */ - return ret_sts; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : AsyncFWt - * ABSTRACT : Asynchronous Data HDD Backup Processing - * NOTE : - * ARGUMENT : void - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API AsyncFWt(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - /* _CWORD121_ compliant ret_sts = Backup_AsyncForcibleWrite(); */ - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramWtAccOff - * ABSTRACT : Asynchronous Data HDD Backup Process at ACC-OFF - * NOTE : Saving Asynchronous Data to Hard Drives at ACC-OFF - * ARGUMENT : void - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API SramWtAccOff(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - /* _CWORD121_ compliant ret_sts = Backup_AccOffNotify(); */ - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : DataWtWaitHDDSpinup - * ABSTRACT : HDD spin-up completion wait data save processing - * NOTE : Save to the HDD - * ARGUMENT : u_int16 para Startup Identification Value - * RETURN : RET_API defined - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -DataWtWaitHDDSpinup(u_int16 para) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_NORMAL; /* Result */ - return ret_sts; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : SramLoadFromExtDev - * ABSTRACT : SRAM recovery processing - * NOTE : Restore Static data stored as a file on an externally attached device - * and the registry data to the HDD. - * ARGUMENT : u_int32 device Device where the file to be restored resides - * SD card:EXTDEV_STRAGECARD - * PC card:EXTDEV_PCCARD - * RET_API *err Error code - * RETURN : Return only RET_ERROR (Just perform reset without returning of this function when normal end) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -RET_API -SramLoadFromExtDev(ANA_RET_API *err) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_sts = RET_OSERROR; - return(ret_sts); -} -// LCOV_EXCL_STOP - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : _pbSram.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - diff --git a/vehicleservice/positioning_base_library/library/src/_pbSum.cpp b/vehicleservice/positioning_base_library/library/src/_pbSum.cpp deleted file mode 100755 index 2964db7..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbSum.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - File name : _pbSum.cpp - System name : - Subsystem name : System common functions - Title : System APIs Asynchronous Data HDD Backup Processing - -------------------------------------------------------------------------------------- -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -/* - Function prototype declarations -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * MODULE : Sum() - * ABSTRACT : SUM calculation process - * NOTE : Calculate the SUM value for the specified size from the SUM calculation start address. - * ARGUMENT : void *p SUM calculation start address - * int32 size Size (bytes) - * u_int8 type Calculation width Byte :sizeof(u_char) - * Word :sizeof(u_int16) - * Long-word:sizeof(u_int32) - * NOTE : Calculate the SUM value from the SUM calculation start address by the size specified by the calculation width. - * RETURN : u_int32 SUM value - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -u_int32 Sum(void *p, int32 size, u_int8 type) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - u_int32 sum = 0; /* SUM value */ - u_int32 loop_cnt; /* Loop counter */ - u_int32 loop_num; /* Number of loops */ - - /* Pointer size check */ - if ((p == NULL) || (size == 0)) { - /* nop */ - } else { - /* When the calculation width is "Long word" */ - if (type == sizeof(int32)) { - u_int32 * ptr32 = reinterpret_cast(p); /* Long word pointer */ - - /* Calculate the number of processes and loop for the number of Times to compute the Sum value. */ - loop_num = static_cast(size / sizeof(u_int32)); - for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) { - sum += *ptr32; - ptr32++; - } - } else if (type == sizeof(int16)) { - /* For "Word" */ - u_int16 * ptr16 = reinterpret_cast(p); /* Word pointer */ - - loop_num = static_cast(size / sizeof(u_int16)); - for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) { - sum += *ptr16; - ptr16++; - } - } else if (type == sizeof(char)) { - /* For "Byte" */ - u_char * ptr8 = reinterpret_cast(p); /* Byte pointer */ - - loop_num = static_cast(size / sizeof(u_char)); - for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) { - sum += *ptr8; - ptr8++; - } - } else { - /* For other than above */ - /* No processing */ - } - } - return sum; -} -// LCOV_EXCL_STOP - -/* -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - End of File : Sum.cpp -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -*/ - diff --git a/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp b/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp deleted file mode 100755 index f36711f..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp +++ /dev/null @@ -1,1115 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * _pbTimer.cpp - */ -/*---------------------------------------------------------------------------------* - * Include Files * - *---------------------------------------------------------------------------------*/ -#include - -#include - -#include -#include "TimerEntryDrv_If.h" -#include "DEV_TimerEntryDrv_if.h" - -#include -#include "WPF_STD_private.h" - - -/*---------------------------------------------------------------------------------* - * Define * - *---------------------------------------------------------------------------------*/ -#define MAX_CTRL_TIMER_NUM (8) - -#define CID_TIMER_1 (0x1000) -#define CID_TIMER_2 (0x1001) -#define CID_TIMER_3 (0x1002) -#define CID_TIMER_4 (0x1003) -#define CID_TIMER_5 (0x1004) -#define CID_TIMER_6 (0x1005) -#define CID_TIMER_7 (0x1006) -#define CID_TIMER_8 (0x1007) - -#define TIMER_MAKE_DEFAULT_MESSAGE(x) \ - (x)->Header.signo = 0; \ - (x)->Header.hdr.sndpno = 0; \ - (x)->Header.hdr.respno = 0; \ - (x)->Header.hdr.cid = CID_TIMER_TOUT; \ - (x)->Header.hdr.msgbodysize = \ - static_cast(sizeof(TimerToutMsg) - sizeof(T_APIMSG_MSGBUF_HEADER)); \ - (x)->Header.hdr.rid = 0; \ - (x)->Header.hdr.reserve = 0; \ - (x)->TimerSeq = 0; - -/*---------------------------------------------------------------------------------* - * Structure * - *---------------------------------------------------------------------------------*/ -/*! - @brief Timer control information -*/ -typedef struct { - CID cid; /**< Command ID */ - HANDLE h_timer; /**< Timer handle */ - TimerToutMsg msg_buf; /**< Message buffer */ - uint16_t size; /**< Message size */ - PNO pno; /**< Process number */ - uint16_t seq_no; /**< Timer Sequence Number */ - uint8_t type; /**< Timer type */ - uint32_t time_out; /**< Timeout */ -} TIMER_CTRL_INFO; - -/*---------------------------------------------------------------------------------* - * Local Function Prototype * - *---------------------------------------------------------------------------------*/ -/* Timer control table manipulation functions */ -static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid); /* Set timer CID */ -static CID TimerGetCidOfCtrlTbl(u_int32 idx); /* Get timer CID */ -static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* Set PNO */ -static PNO TimerGetPnoOfCtrlTbl(u_int32 idx); /* Get PNO */ -static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size); /* Set message size */ -static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx); /* Get message buffer */ -static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set timer handle */ -static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx); /* Get timer handle */ -static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type); /* Set timer type */ -static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx); /* Get timer type */ -static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no); /* Set timer Sequence Number */ -static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx); /* Get timer sequence number */ -static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out); /* Set timeout */ -static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx); /* Get timeout */ -static u_int32 TimerSearchEmptyOfCtrlTbl(void); /* Search unused area */ -static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 timer_seq, u_int8 time_type); /* Search specified timer */ -static void TimerClearSettingOfCtrlTbl(u_int32 idx); /* Clear timer information */ - -/* Mutex handling Functions for accessing Timer Control Table */ -static void TimerCreateMutex(void); /* Create Mutex */ -static void TimerDeleteMutex(void); /* Delete Mutex */ -static void TimerLockMutex(void); /* Get Mutex */ -static void TimerUnlockMutex(void); /* Release Mutex */ - -/* Callback function resources */ -static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app); -static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app); - -static void TimerCallbackComProc(const uint8_t id); - -/*---------------------------------------------------------------------------------* - * Grobal Values * - *---------------------------------------------------------------------------------*/ -/** - Timer control table - Note : Access to this instance shall be made through the operation module. -*/ -static TIMER_CTRL_INFO g_timer_ctrl_tbl[MAX_CTRL_TIMER_NUM]; // NOLINT(readability/nolint) global class instance - -/** Timer control table lock Mutex handle */ -static HANDLE g_h_mtx = NULL; - -/** Timer event destination handle */ -static HANDLE g_h_service; - - -/** Dispatcher Registration Callback Table */ -static const FrameworkunifiedProtocolCallbackHandler kTimerPcbhs[] = { - {CID_TIMER_1, &TimerCallback1 }, - {CID_TIMER_2, &TimerCallback2 }, - {CID_TIMER_3, &TimerCallback3 }, - {CID_TIMER_4, &TimerCallback4 }, - {CID_TIMER_5, &TimerCallback5 }, - {CID_TIMER_6, &TimerCallback6 }, - {CID_TIMER_7, &TimerCallback7 }, - {CID_TIMER_8, &TimerCallback8 }, -}; // LCOV_EXCL_BR_LINE 11:unexpected branch - -/*---------------------------------------------------------------------------------* - * Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Timer function initialization - * - * @return RET_NORMAL Normal completion - * @return RET_ERROR ABEND - */ -RET_API TimerInit(HANDLE h_app) { - RET_API ret_api = RET_NORMAL; - u_int32 idx; - HANDLE h_timer; - EFrameworkunifiedStatus estatus; - NSTimerInfo timer_info; - HANDLE* p_h_service = &g_h_service; - - if (h_app == NULL) { // LCOV_EXCL_BR_LINE 6: h_app cannot be Null - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! [h_app=%p]", h_app); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: h_app cannot be Null - } else { - memset(&timer_info, 0x00, sizeof(timer_info)); - - /* Create Mutex */ - TimerCreateMutex(); // LCOV_EXCL_BR_LINE 200: no branch - - /* Register callback function for timer control */ - // LCOV_EXCL_BR_LINE 4: nsfw error - estatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, "NS_ANY_SRC", kTimerPcbhs, _countof(kTimerPcbhs)); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length) - if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - /* When registration fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "FrameworkunifiedAttachCallbacksToDispatcher ERROR [status:%d]", estatus); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error - } - - /* Initialization of timer control table */ - for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) { - TimerSetCidOfCtrlTbl(idx, static_cast(kTimerPcbhs[idx].iCmd)); /* Set timer control CID */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length) - - /* Initialize timeout */ - TimerSetTimeOutOfCtrlTbl(idx, 0); // LCOV_EXCL_BR_LINE 200: no branch - - *p_h_service = McOpenSender("Positioning"); /* Be intended for use only in Positioning */ // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length) - - /* Create Timer Resource */ - timer_info.iCmd = TimerGetCidOfCtrlTbl(idx); /* Only CID needs to be set. */ // LCOV_EXCL_BR_LINE 200: no branch - h_timer = NS_TimerCreate(timer_info, CALLBACK_MESSAGE, (HANDLE)*p_h_service); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length) - if (h_timer == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When an error occurs */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "NS_TimerCreate ERROR [h_timer:%p, hService:%p]", h_timer, *p_h_service); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - /* If successful */ - /* Set Handle information */ - TimerSetTimerHandleOfCtrlTbl(idx, h_timer); // LCOV_EXCL_BR_LINE 200: no branch - } - } - } - - return ret_api; -} - -/** - * @brief - * Terminate timer function - * - * @return Normal completion - */ -RET_API TimerTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret_api = RET_NORMAL; - u_int32 idx; - HANDLE h_timer; - EFrameworkunifiedStatus estatus; - HANDLE* p_h_service = &g_h_service; - - /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */ - if (g_h_mtx == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!"); - ret_api = RET_ERROR; - } else { - /* Delete timer control information */ - for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) { - h_timer = TimerGetTimerHandleOfCtrlTbl(idx); - if (h_timer != NULL) { - /* Delete timer */ - estatus = NS_TimerDelete(h_timer); - if (estatus != eFrameworkunifiedStatusOK) { - /* When an error occurs */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \ - "NS_TimerDelete ERROR [estatus:%d, h_timer:%p]", estatus, h_timer); - } - TimerSetTimerHandleOfCtrlTbl(idx, NULL); - } - - TimerClearSettingOfCtrlTbl(idx); - } - - /* Mutex deletion */ - TimerDeleteMutex(); - } - - /* Delete transmission handle */ - estatus = McClose(*p_h_service); - if (estatus != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McClose ERROR [estatus:%d, hService:%p]", \ - estatus, *p_h_service); - } - - return ret_api; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Fixed period/asynchronous timer start instruction - * - * @param[in] snd_pno Requesting process number - * @param[in] timer_seq Timer sequence number - * @param[in] TimerType Timer type - * @param[in] time_out Timeout value [10ms] - * - * @return RET_NORMAL Normal completion
- * RET_ERROR Message transmission error
- * RET_ERRPARAM Parameter error - */ -RET_API _pb_ReqTimerStart(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API - u_int8 time_type, u_int32 time_out) { - RET_API ret_api = RET_NORMAL; /* Return value of this module */ - u_int32 idx; - TimerToutMsg *p_msg; - EFrameworkunifiedStatus estatus; - HANDLE h_timer; - NSTimerInfo timer_info; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */ - if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be null - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be null - } else { - /* Parameter study */ - if ((time_type != TIMER_TYPE_SYN) && (time_type != TIMER_TYPE_USN)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_type:%d]", time_type); - ret_api = RET_ERRPARAM; /* Timer type error */ - } - - if (time_out == 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_out:%d]", time_out); - ret_api = RET_ERRPARAM; /* Timer setting value error */ - } - - /* When a timer of the same process number, sequence number, or type is already registered, creation of the timer is not allowed. */ - idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type); - if (idx != MAX_CTRL_TIMER_NUM) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchTimerOfCtrlTbl ERROR!! " \ - "[snd_pno:%d, timer_seq:%d, TimeType:%d]", snd_pno, timer_seq, time_type); - ret_api = RET_ERRPARAM; /* Invalid timer value */ - } - - /* Parameter normal */ - if (ret_api == RET_NORMAL) { - TimerLockMutex(); /* Get Mutex */ - - /* Get free space in timer control table */ - idx = TimerSearchEmptyOfCtrlTbl(); // LCOV_EXCL_BR_LINE 200: no branch - if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM - // LCOV_EXCL_START 200: idx can not be MAX_CTRL_TIMER_NUM - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When there is no free space */ - /* Be impossible by design */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchEmptyCtrlTbl ERROR!! " \ - "[idx = %d]", idx); - _pb_Exit(); - /* don't arrive here. */ - // LCOV_EXCL_STOP - } - - /* Get message buffer address */ - p_msg = TimerGetMsgBufOfCtrlTbl(idx); - - TIMER_MAKE_DEFAULT_MESSAGE(p_msg); /* Set message data to be send */ - p_msg->TimerSeq = timer_seq; /* Timer sequence number */ - - /* Set callback function information in timer control table */ - TimerSetPnoOfCtrlTbl(idx, snd_pno); // LCOV_EXCL_BR_LINE 200: no branch - TimerSetSizeOfCtrlTbl(idx, sizeof(TimerToutMsg)); // LCOV_EXCL_BR_LINE 200: no branch - TimerSetTypeOfCtrlTbl(idx, time_type); // LCOV_EXCL_BR_LINE 200: no branch - TimerSetSeqNoOfCtrlTbl(idx, timer_seq); // LCOV_EXCL_BR_LINE 200: no branch - TimerSetTimeOutOfCtrlTbl(idx, time_out); // LCOV_EXCL_BR_LINE 200: no branch - - /* Set timer value */ - timer_info.t_sec = (uint32_t)((10 * time_out) / 1000); - /* Coverity CID: 21979 compliant */ - timer_info.t_nsec = ((10 * (uint64_t)time_out) - ((uint64_t)(timer_info.t_sec) * 1000)) * 1000 * 1000; - timer_info.iCmd = TimerGetCidOfCtrlTbl(idx); - timer_info.rpt_sec = 0; - timer_info.rpt_nsec = 0; - if (time_type == TIMER_TYPE_SYN) { - timer_info.rpt_sec = timer_info.t_sec; - timer_info.rpt_nsec = timer_info.t_nsec; - } - - h_timer = TimerGetTimerHandleOfCtrlTbl(idx); - - /* Start timer */ - estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error - if ((h_timer == NULL) || (estatus != eFrameworkunifiedStatusOK)) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When an error occurs */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \ - "[estatus:%d, h_timer:%p]", estatus, h_timer); - - TimerClearSettingOfCtrlTbl(idx); /* Clear timer information */ - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - /* If successful */ - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \ - "(++) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \ - idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \ - g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out); - } - - TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return ret_api; -} - -/** - * @brief - * Timer stop instruction - * - * @param[in] snd_pno Requesting process number - * @param[in] timer_seq Timer sequence number - * @param[in] time_r_type Timer type
- * TIMER_TYPE_SYN Fixed-period timer
- * TIMER_TYPE_USN Asynchronous timer
- * TIMER_TYPE_ALM Alerm with specified time
- * - * @return RET_NORMAL Normal completion
- * RET_ERROR Message transmission error
- * RET_ERRPARAM Parameter error - */ -RET_API _pb_TimerStop(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API - u_int8 time_type) { - RET_API ret_api = RET_NORMAL; /* Return value of this module */ - u_int32 idx; - EFrameworkunifiedStatus estatus; - HANDLE h_timer; - const NSTimerInfo timer_info = {0}; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */ - if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be NULL - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be NULL - } else { - TimerLockMutex(); /* Get Mutex */ // LCOV_EXCL_BR_LINE 200: no branch - - idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type); - if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM - /* When the specified timer is not set */ - /* nop */ - } else { - h_timer = TimerGetTimerHandleOfCtrlTbl(idx); - - /* Stop timer */ - estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error - if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - /* When deletion fails */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \ - "[estatus:%d, h_timer:%p]", estatus, h_timer); - ret_api = RET_ERROR; - // LCOV_EXCL_STOP - } else { - /* If successful */ - /* Clear timer information */ - TimerClearSettingOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \ - "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \ - idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \ - g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out); - } - } - - TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return ret_api; -} - -/*---------------------------------------------------------------------------------* - * Local Function * - *---------------------------------------------------------------------------------*/ -/** - * @brief - * Timer CID setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Control table accessor - * @param[in] cid Command ID - */ -static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].cid = cid; - } - - return; -} - -/** - * @brief - * Timer CID acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * - * @return Command ID - */ -static CID TimerGetCidOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].cid; -} - -/** - * @brief - * PNO setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * @param[in] pno Process number - */ -static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \ - "[idx:%d, pno:%d]", idx, pno); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].pno = pno; - } - - return; -} - -/** - * @brief - * PNO acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * - * @return Process number - */ -static PNO TimerGetPnoOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].pno; -} - -/** - * @brief - * Message size setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * @param[in] size Message size - */ -static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \ - "[idx:%d, size:%d]", idx, size); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].size = size; - } - - return; -} - -/** - * @brief - * Message buffer acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * - * @return Pointer to message storage area - */ -static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return &(g_timer_ctrl_tbl[idx].msg_buf); -} - -/** - * @brief - * Timer handle setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * @param[in] handle Timer handle - */ -static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \ - "[idx:%d, handle:%p]", idx, handle); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].h_timer = handle; - } - - return; -} - -/** - * @brief - * Timer handle acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * - * @return Timer handle - */ -static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].h_timer; -} - -/** - * @brief - * Timer type setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * @param[in] type Timer type - */ -static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \ - "[idx:%d, type:%d]", idx, type); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].type = type; - } - - return; -} - -/** - * @brief - * Timer type acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * - * @return Timer handle - */ -static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].type; -} - -/** - * @brief - * Timer sequence number setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - * @param[in] seq_no Timer Sequence Number - */ -static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \ - "[idx:%d, seq_no:%d]", idx, seq_no); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].seq_no = seq_no; - } - - return; -} - -/** - * @brief - * Timer sequence number acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table accessor - */ -static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].seq_no; -} - -/** - * @brief - * Timeout setting (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table access Index - * @param[in] time_out Timeout - */ -static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, " \ - "time_out:%d]", idx, time_out); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater - /* don't arrive here. */ - } else { - g_timer_ctrl_tbl[idx].time_out = time_out; - } - - return; -} - -/** - * @brief - * Timeout acquisition (Timer control table) - * - * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit(). - * - * @param[in] idx Timer control table access Index - * - * @return Timeout value - */ -static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx) { - /* check index */ - if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater - /* forbidden */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 6:idx cannot greater - /* don't arrive here. */ - } - - return g_timer_ctrl_tbl[idx].time_out; -} - -/** - * @brief - * Retreaval of unused area in the timer control table (Timer control table) - * - * Return the lowest-numbered index for accessing unused space in the Timer control table. - * If the mutex is not registered, the maximum timer management value (MAX_CTRL_MUTEX_NUM) - * is returned. - * - * @return Table accessor - */ -static u_int32 TimerSearchEmptyOfCtrlTbl(void) { - u_int32 idx; - u_int32 time_out; - - for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) { - time_out = TimerGetTimeOutOfCtrlTbl(idx); - - /* For unused space */ - if (time_out == 0) { - break; - } - } - - return idx; -} - -/** - * @brief - * Retrieval of specified timer for in the timer control table (Timer control table) - * - * Retrieve whether the specified timer is already registered in the timer control table. - * If it is registered, the access index is returned. If it is not registered, - * Return the maximum value of timer management (MAX_CTRL_TIMER_NUM). - * - * @param[in] snd_pno Process number - * @param[in] TimerSeq Timer sequence number - * @param[in] TimeType Timer type - * - * @return Index for access(If it is registered)
- * Maximum mutex management value (Not registered) - */ -static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 TimerSeq, u_int8 TimeType) { - u_int32 idx; - PNO pno; - u_int16 seq_no; - u_int8 type; - - for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) { - pno = TimerGetPnoOfCtrlTbl(idx); - seq_no = TimerGetSeqNoOfCtrlTbl(idx); - type = TimerGetTypeOfCtrlTbl(idx); - - /* If there is a match */ - if ((pno == snd_pno) && (seq_no == TimerSeq) && (type == TimeType)) { - break; - } - } - - return idx; -} - -/** - * @brief - * Clear timer setting information - * - * @param[in] idx Timer control table accessor - */ -static void TimerClearSettingOfCtrlTbl(u_int32 idx) { - void *p_msg; - - /* Delete timer information */ - TimerSetPnoOfCtrlTbl(idx, 0); - TimerSetSizeOfCtrlTbl(idx, 0); - TimerSetTypeOfCtrlTbl(idx, 0); - TimerSetSeqNoOfCtrlTbl(idx, 0); - TimerSetTimeOutOfCtrlTbl(idx, 0); - p_msg = TimerGetMsgBufOfCtrlTbl(idx); - memset(p_msg, 0x00, sizeof(TimerToutMsg)); - - return; -} - -/** - * @brief - * Create Mutex for accessing the timer control table - */ -static void TimerCreateMutex(void) { - g_h_mtx = _pb_CreateMutex(NULL, 0, "Timer_Mutex"); - if (g_h_mtx == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR " \ - "[g_h_mtx:%p]", g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Delete Mutex for accessing timer control table - */ -static void TimerDeleteMutex(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - DWORD ret; - - ret = PbDeleteMutex(g_h_mtx); - if (ret != WAIT_OBJECT_0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \ - "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx); - _pb_Exit(); - /* don't arrive here. */ - } - - return; -} -// LCOV_EXCL_STOP - -/** - * @brief - * Get Mutex for accessing timer control table - */ -static void TimerLockMutex(void) { - DWORD ret; - - ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: lock will not failed - if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: lock will not failed - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \ - "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: lock will not failed - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Release Mutex for accessing timer control table - */ -static void TimerUnlockMutex(void) { - BOOL ret; - - ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: unlock will not failed - if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: unlock will not failed - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \ - "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - _pb_Exit(); // LCOV_EXCL_LINE 200: unlock will not failed - /* don't arrive here. */ - } - - return; -} - -/** - * @brief - * Timer Expiration Callback Functions - * - * For setting the timer creation function (NS_TimerCreate)
- * TimerCallback1 ... TimerCallback8 - * - * @param[in] h_app Application handle - * - * @return eFrameworkunifiedStatusOK Normal completion - */ -static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app) { - static const u_int8 ID = 0; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app) { - static const u_int8 ID = 1; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app) { - static const u_int8 ID = 2; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app) { - static const u_int8 ID = 3; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app) { - static const u_int8 ID = 4; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app) { - static const u_int8 ID = 5; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app) { - static const u_int8 ID = 6; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app) { - static const u_int8 ID = 7; - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+"); - - TimerCallbackComProc(ID); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-"); - - return eFrameworkunifiedStatusOK; -} - -static void TimerCallbackComProc(const uint8_t id) { - uint8_t type; - - TimerLockMutex(); /* Get Mutex */ - - /* Message is sent to the thread specified when the timer is created. */ - (void)_pb_SndMsg(g_timer_ctrl_tbl[id].pno, g_timer_ctrl_tbl[id].size, &(g_timer_ctrl_tbl[id].msg_buf), 0); - - type = TimerGetTypeOfCtrlTbl(id); - if (type == TIMER_TYPE_USN) { - /* One-shot timer */ - /* Clear timer information */ - TimerClearSettingOfCtrlTbl(id); - - FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \ - "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \ - id, g_timer_ctrl_tbl[id].cid, g_timer_ctrl_tbl[id].h_timer, g_timer_ctrl_tbl[id].pno, \ - g_timer_ctrl_tbl[id].seq_no, g_timer_ctrl_tbl[id].type, g_timer_ctrl_tbl[id].time_out); - } - - TimerUnlockMutex(); /* Release Mutex */ - - return; -} - -/** - * @brief - * Get dump information - * - * @param[out] p_buf Dump info - */ -void _pb_GetDebugTimerMngTbl(void* p_buf) { - static uint8_t buf[DEBUG_DUMP_MAX_SIZE]; - static uint8_t buf_tmp[256]; - uint32_t i; - - if (p_buf != NULL) { - memset(&buf, 0x00, sizeof(buf)); - snprintf(reinterpret_cast(&(buf)), sizeof(buf), "Timer"); - for (i = 0; i < MAX_CTRL_TIMER_NUM; i++) { - memset(&buf_tmp[0], 0x00, sizeof(buf_tmp)); - snprintf(reinterpret_cast(&buf_tmp[0]), sizeof(buf_tmp), - "\n [%d] cid:%05d, hTim:%10p, sz:%05d, pno:0x%04x, seq:0x%04x, typ:%03d, tOut:%10d", - i, - g_timer_ctrl_tbl[i].cid, - g_timer_ctrl_tbl[i].h_timer, - g_timer_ctrl_tbl[i].size, - g_timer_ctrl_tbl[i].pno, - g_timer_ctrl_tbl[i].seq_no, - g_timer_ctrl_tbl[i].type, - g_timer_ctrl_tbl[i].time_out); - strncat(reinterpret_cast(&buf[0]), reinterpret_cast(&buf_tmp[0]), \ - strlen(reinterpret_cast(&buf_tmp[0]))); - } - memcpy(p_buf, &buf[0], sizeof(buf)); - } -} // LCOV_EXCL_BR_LINE 10:The final line diff --git a/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp b/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp deleted file mode 100755 index 2111b3a..0000000 --- a/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -@file waitforsingleobject.cpp -@detail Functions that implement waitforsingleobject in PosixBasedOS001
- Functions to register/delete a table to determine the handle and its type -*****************************************************************************/ - -#include "_pbWaitforsingleobject.h" -#include -#include "WPF_STD_private.h" -#include "_pbInternalProc.h" - -typedef struct HandleTypeTable { - HANDLE h_handle; /* Registration handle */ - HANDLE_KIND l_kind; /* Type of Mutex/Semaphre/Event... */ - struct HandleTypeTable *next; -} HANDLE_TYPE; - -static HANDLE_TYPE *g_pst_handle_kind_table = NULL; -static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */ - -/* Prototype declarations */ -static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj); -static BOOL AddList(HANDLE_TYPE *p_add_list); -static BOOL DelList(HANDLE_TYPE *h_del_obj); -static BOOL FunctionLock(void); -static BOOL FunctionUnlock(void); - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Public APIs -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* _sys Internally Used APIs -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/**************************************************************************** -@brief WaitObjectInit
- Initialization processing for each process -@outline WaitObjectInit
- Initialization processing for each process -@type Completion return type -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL WaitObjectInit(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - g_pst_handle_kind_table = NULL; - return TRUE; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief WaitObjectTerm
- Termination processing for each process -@outline WaitObjectTerm
- Termination processing for each process -@type Completion return type -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -BOOL WaitObjectTerm(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if (NULL != g_pst_handle_kind_table) { - /* Should be Deleted a List? */ - } - return TRUE; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief WaitObjectAdd
- Register a handle and a handle-type in a list -@outline WaitObjectAdd
- Register a handle and a handle-type in a list -@type Completion return type -@param[in] HANDLE h_obj : Handle to register -@param[in] HANDLE_KIND l_kind : Handle type - -@return BOOL -@retval TRUE : Normal - FALSE : Error -*****************************************************************************/ -BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - HANDLE_TYPE *p_add_list = NULL; - - if ((NULL != h_obj) - && (PB_HANDLE_INVAL < l_kind) - && (PB_HANDLE_KIND_MAX > l_kind)) { - FunctionLock(); - bret = FindList(&p_add_list, h_obj); - if (TRUE == bret) { - /* Handle already registered */ - if (l_kind == p_add_list->l_kind) { - /* re-register the same item */ - bret = TRUE; - } else { - /* An attempt was made to re-register the same handle with different type */ - bret = FALSE; /** Consider whether to win or not later */ - } - } else { - p_add_list = reinterpret_cast(malloc(sizeof(HANDLE_TYPE))); - if (NULL == p_add_list) { - /* Memory acquisition failed */ - bret = FALSE; - } else { - memset(p_add_list, 0, sizeof(HANDLE_TYPE)); - p_add_list->h_handle = h_obj; - p_add_list->l_kind = l_kind; - p_add_list->next = NULL; - bret = AddList(p_add_list); - if (FALSE == bret) { - /* Registration failure */ - free(p_add_list); - bret = FALSE; - } else { - bret = TRUE; - } - } - } - - FunctionUnlock(); - - } else { - bret = FALSE; /** Parameter error */ - } - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief WaitObjectDel
- Remove handle and handle-type from the list -@outline WaitObjectDel
- Remove handle and handle-type from the list -@type Completion return type -@param[in] HANDLE h_obj : Handle to delete - -@return BOOL -@retval TRUE : Normal - FALSE : Error -*****************************************************************************/ -BOOL WaitObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - HANDLE_TYPE *p_del_list = NULL; - - if (NULL != h_obj) { - FunctionLock(); - bret = FindList(&p_del_list, h_obj); - if (TRUE == bret) { - /* handle already registered */ - if (TRUE == DelList(p_del_list)) { - free(p_del_list); - bret = TRUE; - } else { - bret = FALSE; - } - } else { - bret = FALSE; /* no handles */ - } - - FunctionUnlock(); - - } else { - bret = FALSE; /* Parameter error */ - } - return bret; -} -// LCOV_EXCL_STOP - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Private API -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/**************************************************************************** -@brief FindList
- Searching for a Handle in the List -@outline FindList
- Searching for a Handle in the List -@type Completion return type -@param[out] HANDLE_TYPE** p_list : Found list pointer -@param[in] HANDLE h_obj : Handle to look for - -@return BOOL -@retval TRUE : Normal (p_list != NULL) - FALSE : Error (p_list == NULL) -*****************************************************************************/ -static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - HANDLE_TYPE *p_now = NULL; - BOOL bret = FALSE; - - if ((NULL != h_obj) && (NULL != p_list)) { - /* Search list */ - p_now = g_pst_handle_kind_table; - while (NULL != p_now) { - /* h_obj and p_now->h_handle are pointer type.*/ - if ((int64_t)h_obj == (int64_t)p_now->h_handle) { - *p_list = p_now; - bret = TRUE; - break; - } - p_now = p_now->next; - } - } else { - bret = FALSE; /** Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief AddList
- Append data to the end of the list -@outline AddList
- Append data to the end of the list -@type Completion return type -@param[in] HANDLE_TYPE* p_list : Data to add - -@return BOOL -@retval TRUE : Normal - FALSE : Error -*****************************************************************************/ -static BOOL AddList(HANDLE_TYPE *p_add_list) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - HANDLE_TYPE *p_now = NULL; - BOOL bret = FALSE; - - if (NULL != p_add_list) { - /* Add unregistered data */ - if (NULL == g_pst_handle_kind_table) { - g_pst_handle_kind_table = p_add_list; - bret = TRUE; - } else { - /* Add to end of list */ - p_now = g_pst_handle_kind_table; - while (NULL != p_now) { - if (NULL == p_now->next) { - p_now->next = p_add_list; - bret = TRUE; - break; - } - p_now = p_now->next; - } - } - } else { - bret = FALSE; /** Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief DelList
- Remove specified data from a List -@outline DelList
- Remove specified data from a List -@type Completion return type -@param[in,out] HANDLE_TYPE* h_del_obj : - -@return BOOL -@retval TRUE : Normal - FALSE : End -*****************************************************************************/ -static BOOL DelList(HANDLE_TYPE *h_del_obj) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - HANDLE_TYPE *p_now = NULL; - HANDLE_TYPE *pBef = NULL; - BOOL bret = FALSE; - - if (NULL != h_del_obj) { - /* Add to end of list */ - p_now = g_pst_handle_kind_table; - while (NULL != p_now) { - if (h_del_obj == p_now) { - if (NULL == pBef) { - /* Delete first */ - g_pst_handle_kind_table = p_now->next; - } else { - /* Others */ - pBef->next = h_del_obj->next; - } - bret = TRUE; - break; - } - pBef = p_now; - p_now = p_now->next; - } - } else { - bret = FALSE; /** Parameter error */ - } - - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief FunctionLock
- Start locking of g_pst_handle_kind_table -@outline FunctionLock
- Start locking of g_pst_handle_kind_table -@type Completion return type -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) { - bret = TRUE; - } - return bret; -} -// LCOV_EXCL_STOP - -/**************************************************************************** -@brief FunctionUnlock
- Terminate locking of g_pst_handle_kind_table -@outline FunctionUnlock
- Terminate locking of g_pst_handle_kind_table -@type Completion return type -@return BOOL -@retval TRUE : Normal -@retval FALSE : Error -*****************************************************************************/ -static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - BOOL bret = FALSE; - if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) { - bret = TRUE; - } - return bret; -} -// LCOV_EXCL_STOP - diff --git a/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp b/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp deleted file mode 100755 index 204c516..0000000 --- a/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - - -#include "WPF_STD_private.h" -void* Memcpy64pSync(void* dest, const void* src, size_t count) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return _pb_memcpy(dest, src, count); -} -// LCOV_EXCL_STOP diff --git a/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp b/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp deleted file mode 100755 index ad6c11e..0000000 --- a/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include "WPF_STD_private.h" - -void* Memset64pSync(void* dest, int c, size_t count) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - return _pb_memset(dest, c, count); -} -// LCOV_EXCL_STOP -- cgit 1.2.3-korg