diff options
author | 2020-11-19 12:45:32 +0900 | |
---|---|---|
committer | 2020-11-19 12:45:32 +0900 | |
commit | 8e0e00d21146a84c18f9cf9409e187b4fb0248aa (patch) | |
tree | ef791689dad216ac61091a1d1bd3b928d563aba6 /stub/communication_subcpu/client | |
parent | 18df6e21c6743a137e2760c52ca89d0789e90417 (diff) |
Init basesystem source codes.
Signed-off-by: Riku Nomoto <riku_nomoto@mail.toyota.co.jp>
Change-Id: I55aa2f1406ce7f751ae14140b613b53b68995528
Diffstat (limited to 'stub/communication_subcpu/client')
4 files changed, 431 insertions, 0 deletions
diff --git a/stub/communication_subcpu/client/Makefile b/stub/communication_subcpu/client/Makefile new file mode 100755 index 0000000..b232f9c --- /dev/null +++ b/stub/communication_subcpu/client/Makefile @@ -0,0 +1,43 @@ +# +# @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. +# + +######### installed shared library(*.so) ############# +INST_SHLIBS = libCommSubCpu + +######### install headers(*.h) ############# +INST_HEADERS = CommSubCpu_API.h com_message_header.h + +######### compiled sources ############# +libCommSubCpu_SRCS += ./src/CommSubCpu_API.cpp + +######### add source path ############# +VPATH += src +VPATH += include/stub + +######### add include path ############# +CPPFLAGS += -I./include +CPPFLAGS += -I./include/$(COMPONENT_NAME) + +######### add compile option ############# + +######### linked library ############# + +######### linked library (dynamic) ############# + +######### add library path ############# + + +include ../../stub.mk diff --git a/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h b/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h new file mode 100755 index 0000000..020c361 --- /dev/null +++ b/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h @@ -0,0 +1,266 @@ +/* + * @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 COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_ +#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_ + +/** + * @file CommSubCpu_API.h + * @~english + * @brief communication_subcpu API header + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup peripheral_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup communication_subcpu + * @ingroup peripheral_service + * @{ + */ + +#include <sys/types.h> +#include <native_service/frameworkunified_types.h> +#include <agldd/moduleid.h> +#include <stub/com_message_header.h> + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus*/ + +/*! @~english CommSubCpu I/F API return code */ +typedef int32_t COMMSUBCPU_RET_API; + +/*! @~english Thread name */ +#define LAN_SERVICE_SYSCOM_MAIN "DEV_SYSCOM_MAIN" + +/** + * \~english The ICR command receive notification + */ +#define CID_ICR_CMD_RCV (0x0A00) + +/** + * \~english The ICR command send result notification + */ +#define CID_ICR_CMD_SND_CNF (0x0A01) + +/*! @~english The MAX length of send command */ +#define ICRCMD_OPELAND_SND_MAX (2048) +/*! @~english The MAX length of send ICR command */ +#define ICRCMD_OPELAND_MAX (252) + +/** + * \~english ICR command format + */ +typedef struct { + uint16_t phyadr_from; //!< \~english Physical address + uint8_t service_type; //!< \~english Communication type + uint8_t lgadr_from; //!< \~english Source logical address + uint8_t lgadr_to; //!< \~english Forwarding destination logical address + uint8_t opc; //!< \~english Operation code + uint8_t d_length; //!< \~english Data size + uint8_t data[ICRCMD_OPELAND_MAX]; //!< \~english Command data + uint8_t reserve; //!< \~english Reserve +} T_ICR_CMD_DATA; + +/** + * \~english Send command structure + */ +typedef struct { + uint16_t phyadr_from; //!< \~english Physical address + uint8_t service_type; //!< \~english Communication type + uint8_t lgadr_from; //!< \~english Source logical address + uint8_t lgadr_to; //!< \~english Forwarding destination logical address + uint8_t opc; //!< \~english Operation code + uint16_t d_length; //!< \~english Data size + uint8_t data[ICRCMD_OPELAND_SND_MAX]; //!< \~english Command data +} T_ICR_CMD_SND_DATA; + +/** + * \~english ICR command data + */ +typedef struct { + T_ICR_CMD_SND_DATA cmd_data; //!< \~english Command information +} T_ICR_CMD; + +/** + * \~english The message of command receive notification + */ +typedef struct { + /*! @~english The header of message */ + T_APIMSG_MSGBUF_HEADER_COMM msg_hdr; + /*! @~english The message data for send result */ + T_ICR_CMD_DATA cmd_data; +} T_ICR_CMD_RCV; + +/*! + * @~english Status of message send result + */ +typedef enum { + /*! @~english Send success */ + ICR_SND_SUCCESS = 0, + /*! @~english Initialize error */ + ICR_SND_ERR_INIT, + /*! @~english Send error */ + ICR_SND_ERR, + /*! @~english Send error(retry out) */ + ICR_SND_ERR_RETRYOUT, + /*! @~english Send error(buffer full) */ + ICR_SND_ERR_BUFFERFULL, + /*! @~english Send error(micon abnormal) */ + ICR_SND_ERR_MC, + /*! @~english The MAX */ + ICR_SND_ERR_MAX +} ICR_ERROR_CODE; + +/*! + * @~english Structure for message send status data + */ +typedef struct { + /*! @~english Result of send message */ + ICR_ERROR_CODE cnf_sts; +} T_ICR_CMDSNDCNF_STS; + + + /** + * \~english The send result notification + */ +typedef struct { + /*! @~english The header of message */ + T_APIMSG_MSGBUF_HEADER_COMM msg_hdr; + /*! @~english The message data for send result */ + T_ICR_CMDSNDCNF_STS sts; +} T_ICR_CMDSNDCNF; + + +#define COMMSUBCPU_RET_NORMAL 0 //!< \~english Normal termination +#define COMMSUBCPU_RET_ERROR_CANCEL 1 //!< \~english Abnormal termination +#define COMMSUBCPU_RET_ERROR_PARAM 2 //!< \~english Abnormality of parameter +#define COMMSUBCPU_RET_ERROR_BUFFULL 3 //!< \~english Buffer FULL +#define COMMSUBCPU_RET_ERROR_OVERLAPPED 4 //!< \~english Entry overlapped +#define COMMSUBCPU_RET_ERROR_CREATE_EVENT 5 //!< \~english Event generation failure + +/** + * \ingroup CommSubCpu + * \~english @par Brief + * CommSubCpu moudle init + * \~english @retval COMMSUBCPU_RET_NORMAL : Success + * \~english @par Prerequisite + * None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * None + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +COMMSUBCPU_RET_API CommSubCpu_Init(); + +/** + * \ingroup CommSubCpu + * \~english @par Brief + * CommSubCpu moudle deinitializes + * \~english @retval COMMSUBCPU_RET_NORMAL : Success + * \~english @par Prerequisite + * CommSubCpu moudle init completely + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * None + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +COMMSUBCPU_RET_API CommSubCpu_DeInit(); + +/** + * \ingroup CommSubCpu + * \~english @par Brief + * Delivery registration of CommSubCpu command + * \~english @param [in] name + * PCSTR - Receiver thread name + * \~english @param [in] from + * uint8_t - Sender logical address + * \~english @param [in] to + * uint8_t - Receiver logical address + * \~english @param [in] opc + * uint8_t - Operation code + * \~english @param [in] callback_id + * uint8_t - callback ID + * \~english @param [in] cid + * uint16_t - CID + * \~english @retval COMMSUBCPU_RET_NORMAL : Success + * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error + * \~english @par Prerequisite + * Availability of Communication is TRUE + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Input parameter error + * - COMMSUBCPU_RET_ERROR_PARAM + * \~english @par Classification + * Public + * \~english @par Type + * Async + * \~english @see + * None + */ +COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc, + uint8_t callback_id, uint16_t cid); + +/** + * \ingroup CommSubCpu + * \~english @par Brief + * CommSubCpu command transmission request + * \~english @param [in] name + * PCSTR - Sender thread name + * \~english @param [in] snd_cmd + * T_ICR_CMD* - Pointer to send command + * \~english @param [in] req_id + * uint8_t - RID of the results + * \~english @retval COMMSUBCPU_RET_NORMAL : Success + * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error + * \~english @par Prerequisite + * Availability of Communication is TRUE + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Input parameter error + * - COMMSUBCPU_RET_ERROR_PARAM + * \~english @par Classification + * Public + * \~english @par Type + * Async + * \~english @see + * None + */ +COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id); + +#ifdef __cplusplus +} +#endif /*__cplusplus */ + +#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_ diff --git a/stub/communication_subcpu/client/include/stub/com_message_header.h b/stub/communication_subcpu/client/include/stub/com_message_header.h new file mode 100755 index 0000000..707cca5 --- /dev/null +++ b/stub/communication_subcpu/client/include/stub/com_message_header.h @@ -0,0 +1,65 @@ +/* + * @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 COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_ +#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_ + +/** + * @file com_message_header.h + * @~english + * @brief Defination of structure for message header + */ + +#include <sys/types.h> + +/**************************************************************************** + * TAG : typedef T_APIMSG_HEADER + * ABSTRACT : _CWORD64_API message header structure + * NOTE : + ****************************************************************************/ +/*! + * @~english + * @brief Structure for message header + */ +typedef struct { + uint16_t replyid; //!< \~english Send Result ID + uint16_t sndpno; //!< \~english Send process No + uint16_t respno; //!< \~english Response No + uint16_t cid; //!< \~english Command ID + uint16_t msgbodysize; //!< \~english Message body size + uint8_t rid; //!< \~english Resource ID + uint8_t reserve; //!< \~english Reserve + uint8_t filler[2]; //!< \~english filler +} T_APIMSG_HEADER_COMM; + +/*! + * @~english + * @brief Structure for buffer message header + */ +typedef struct { + uint32_t signo; //!< \~english Signal No + T_APIMSG_HEADER_COMM hdr; //!< \~english Message Header +} T_APIMSG_MSGBUF_HEADER_COMM; + +/*! + * @~english @brief Check for assert do not overflow buffer when Re-arrangement was cast to another structure + */ +#define assert_static(e) \ + do { \ + enum { assert_static__ = 1 / (e) }; \ + } while (0) + +#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_ diff --git a/stub/communication_subcpu/client/src/CommSubCpu_API.cpp b/stub/communication_subcpu/client/src/CommSubCpu_API.cpp new file mode 100755 index 0000000..69e06e3 --- /dev/null +++ b/stub/communication_subcpu/client/src/CommSubCpu_API.cpp @@ -0,0 +1,57 @@ +/* + * @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. + */ + +/* + * Information. + * This source code is a sample source code . + * Implementation of the function must be performed by the vendor. + */ + +#include <stub/CommSubCpu_API.h> + +COMMSUBCPU_RET_API CommSubCpu_Init() { + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return COMMSUBCPU_RET_NORMAL; +} + +COMMSUBCPU_RET_API CommSubCpu_DeInit() { + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return COMMSUBCPU_RET_NORMAL; +} + +COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc, + uint8_t callback_id, uint16_t cid) { + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return COMMSUBCPU_RET_NORMAL; +} + + +COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id) { + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return COMMSUBCPU_RET_NORMAL; +} |