From 211696c95c1ec3fc48e0096d47d4278910274195 Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Thu, 22 Oct 2020 13:28:36 +0900 Subject: ps-communication branch 0.1 --- .../server/include/CAN/CommWatch/CAN_CommWatch.h | 45 +++--- .../include/CAN/CommWatch/CAN_CommWatchData.h | 125 ---------------- .../server/include/CAN/CommWatch/CommWatchCommon.h | 22 +++ .../server/include/CAN/Command/CAN_Command.h | 23 +-- .../server/include/CAN/Command/CAN_CommandData.h | 96 ------------ .../server/include/CAN/Delivery/CAN_Delivery.h | 46 +++--- .../server/include/CAN/Delivery/CAN_DeliveryData.h | 7 +- .../server/include/CAN/TimerCtrl/CAN_TimerCtrl.h | 82 ----------- .../include/CAN/Transmission/CAN_Transmission.h | 56 ------- .../CAN/Transmission/CAN_TransmissionData.h | 162 --------------------- communication/server/include/CAN/TxMsg/CAN_TxMsg.h | 128 +++++----------- communication/server/include/com_error_type.h | 20 +-- .../server/include/main/communication_cid.h | 16 +- .../include/main/communication_communicationlog.h | 2 +- .../server/include/main/communication_version.h | 2 +- .../include/peripheral_service/communication.h | 2 +- .../communication_notifications.h | 2 +- .../include/peripheral_service/ps_services.h | 2 +- communication/server/include/private/ICR_Common.h | 30 ---- communication/server/include/threads/CAN_Thread.h | 133 ++--------------- .../server/include/threads/Thread_Common.h | 28 ++-- 21 files changed, 137 insertions(+), 892 deletions(-) delete mode 100644 communication/server/include/CAN/CommWatch/CAN_CommWatchData.h create mode 100644 communication/server/include/CAN/CommWatch/CommWatchCommon.h delete mode 100644 communication/server/include/CAN/Command/CAN_CommandData.h delete mode 100644 communication/server/include/CAN/TimerCtrl/CAN_TimerCtrl.h delete mode 100644 communication/server/include/CAN/Transmission/CAN_Transmission.h delete mode 100644 communication/server/include/CAN/Transmission/CAN_TransmissionData.h delete mode 100644 communication/server/include/private/ICR_Common.h (limited to 'communication/server/include') diff --git a/communication/server/include/CAN/CommWatch/CAN_CommWatch.h b/communication/server/include/CAN/CommWatch/CAN_CommWatch.h index 3b6c8840..16aa54ff 100644 --- a/communication/server/include/CAN/CommWatch/CAN_CommWatch.h +++ b/communication/server/include/CAN/CommWatch/CAN_CommWatch.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,34 +16,27 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ #define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ -/****************************************************************************** - * FILE :CAN_CommWatch.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ -#include "CAN_CommWatchData.h" +#include +#include +#include +#include +#include +#include "CommWatchCommon.h" -/************************************************************************ -* Macro definitions * -************************************************************************/ +typedef struct { + char notify_name[MAX_NAME_SIZE_APP]; + uint32_t data_id; + uint8_t comm_watch_flag; + uint16_t set_time; + uint16_t timer_cnt; +} CAN_COMM_WATCH_VAL; -/* Flag relationship */ -#define CAN_COMM_IG_OFF 0x00 /* IG OFF */ -#define CAN_COMM_IG_ON 0x01 /* IG ON */ -#define CAN_COMM_IG_NORCV 0xFF /* IG not yet */ +typedef std::multimap CAN_CommWatchTable; +typedef std::pair CAN_CommWatchTablePair; +typedef CAN_CommWatchTable::iterator CAN_CommWatchTableIt; -/************************************************************************ -* Struct definitions * -************************************************************************/ - -/************************************************************************ -* Function prototype * -************************************************************************/ void CANCommWatchInit(void); -RET_CAN CANCommWatchTimeoutMsg(HANDLE h_app, uint16_t); EFrameworkunifiedStatus CANCommWatch(HANDLE h_app); -EFrameworkunifiedStatus CANCommWatchCore(HANDLE h_app, CAN_PROTOCOL_TYPE type); -void CANCommWatchClear(HANDLE h_app, CANID); -EFrameworkunifiedStatus CANVehicleInfoMsg(HANDLE h_app); -uint8_t CANIgStatGet(void); +EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app); +void CANCommWatchClear(HANDLE h_app, CANID id); #endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ diff --git a/communication/server/include/CAN/CommWatch/CAN_CommWatchData.h b/communication/server/include/CAN/CommWatch/CAN_CommWatchData.h deleted file mode 100644 index 7a982e03..00000000 --- a/communication/server/include/CAN/CommWatch/CAN_CommWatchData.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCHDATA_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCHDATA_H_ -/****************************************************************************** - * FILE :CAN_CommWatchData.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - -#include -#include "CAN_Thread.h" - -/************************************************************************ -* Macro definitions * -************************************************************************/ -/* #001 start */ -#define COMM_WATICH_TIMER_SEQ_NO_MIN 0x0001 /* Minimum value of timer sequence number */ -/* #100 start */ -#define COMM_WATICH_TIMER_SEQ_NO_MAX 0x0FFF /* Maximum value of timer sequence number */ -/* #001 end */ -/* #100 end */ - -/* Flag Relationship */ -#define CAN_COMM_OFF 0x00 /* Monitoring OFF */ -#define CAN_COMM_NORMAL 0x01 /* Communicating */ -#define CAN_COMM_STOP 0x02 /* Interruption of communication */ - -/************************************************************************ -* Struct definitions * -************************************************************************/ -/*************************************************** -* TAG : CAN_COMM_WATCH_DAT -* ABSTRACT : Communication interruption monitoring management table structure (1 item) -* Use in arrays when used -* (CAN internal data management table) Not used because API is used in the TBD_Z first game -****************************************************/ -typedef struct { /* Type definition of communication disconnection monitoring management table (1 case) */ - CANID ul_can_id; /* CAN ID */ - DID ul_did; /* Data ID */ - uint16_t us_watch_time; /* Communication interruption monitoring time (in units of 100ms) */ - // uint32_t notifyId; /* Addresses for delivery ID */ - uint8_t uc_comm_stop; /* Communication status */ - uint8_t uc_ig; /* IG linkage */ - uint16_t us_timer_seq_no; /* Timer Sequence Number*/ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_COMM_WATCH_DAT; - -/************************************************************************ -* Variable prototype * -************************************************************************/ -/* Communication disruption monitoring management table */ -extern CAN_COMM_WATCH_DAT g_st_comm_watch_dat[CAN_PROTOCOL_TYPE_TERMINATE][COMM_WATCH_LIST_NUM]; -/* Number of effective registrations of communication disruption monitoring management table */ -extern uint16_t g_us_comm_watch_dat_cnt[CAN_PROTOCOL_TYPE_TERMINATE]; - -/************************************************************************ -* Function prototype * -************************************************************************/ -void CANCommWatchDataInit(void); -BOOL CANCommWatchCanidDidEntryCheck(uint8_t, CANID canid, DID did, CAN_PROTOCOL_TYPE); -BOOL CANCommWatchTimerSeqNoEntryCheck(uint16_t, uint8_t *, uint8_t *, CAN_PROTOCOL_TYPE); -BOOL CANCommWatchEntryCheck(CANID canid, DID did, PCSTR namel, uint8_t *, CAN_PROTOCOL_TYPE); -void CANCommWatchEntry(uint8_t uc_index, const CAN_COMM_WATCHEXT_MSG_DAT *pst_msg_data, - uint16_t us_timer_seq_no, uint8_t uc_comm_stop, CAN_PROTOCOL_TYPE); -void CANCommWatchDelete(uint8_t, CAN_PROTOCOL_TYPE); -void CANCommWatchCtrl(uint8_t, uint8_t, CAN_PROTOCOL_TYPE); -void CANCommWatchDataGet(uint8_t, char *, DID *, uint8_t *, CAN_PROTOCOL_TYPE); -uint16_t CANCommWatchTimerSeqNoGet(uint8_t, CAN_PROTOCOL_TYPE); -uint16_t CANCommWatchTimerSeqNoRenwal(uint8_t, uint16_t *, CAN_PROTOCOL_TYPE); -BOOL CANCommWatchSndCheck(uint8_t, PCSTR name, CAN_PROTOCOL_TYPE); -uint8_t CANCommWatchIgcoopGet(uint8_t uc_index, CAN_PROTOCOL_TYPE); -void CANCommWatchBufferOut(FILE *fp_log, CAN_PROTOCOL_TYPE); -inline BOOL CANCommWatchCanidEntryCheck(uint8_t uc_index, CANID ul_can_id, uint8_t *puc_comm_stop, - uint16_t *pus_chk_cnt, CAN_PROTOCOL_TYPE); - -/* for debug */ -EFrameworkunifiedStatus CANCommWatchAllClearDebug(HANDLE h_app); -/******************************************************************************* - * MODULE : CANCommWatchCanidEntryCheck - * ABSTRACT : CANDataCommunication Disruption Monitoring Control Table Registration Status Checking Process (CAN ID Search) - * FUNCTION : Compare the communication discontinuity monitoring control data indicated by the index with the specified CAN ID. - * ARGUMENT : uc_index :Indexed - * can_id :CAN ID - * puc_comm_stop :Communication status return pointer - * pusChkCnt :Pointer to number of valid data checks for table registration - * NOTE : - * RETURN : TRUE :Data consistency - * FALSE :Data mismatch - ******************************************************************************/ - -inline BOOL CANCommWatchCanidEntryCheck(uint8_t uc_index, CANID can_id, uint8_t *puc_comm_stop, - uint16_t *pusChkCnt, CAN_PROTOCOL_TYPE mode) { - BOOL ret = FALSE; - CAN_COMM_WATCH_DAT *ptr = &g_st_comm_watch_dat[mode][uc_index]; - - /* Is the specified index monitoring interrupted? */ - if ((uint16_t)0 != ptr->us_watch_time) { - /* Specified index-data CANID matches the arguments? */ - if (can_id == ptr->ul_can_id) { - ret = TRUE; - *puc_comm_stop = ptr->uc_comm_stop; - } - /* Updating the number of effective data checks for table registration */ - *pusChkCnt = (uint16_t)(*pusChkCnt + (uint16_t)1); - } - - return (ret); -} - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCHDATA_H_ diff --git a/communication/server/include/CAN/CommWatch/CommWatchCommon.h b/communication/server/include/CAN/CommWatch/CommWatchCommon.h new file mode 100644 index 00000000..7306214e --- /dev/null +++ b/communication/server/include/CAN/CommWatch/CommWatchCommon.h @@ -0,0 +1,22 @@ +/* + * @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_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_ +#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_ +#define CAN_COMM_OFF 0x00 +#define CAN_COMM_NORMAL 0x01 +#define CAN_COMM_STOP 0x02 +#endif diff --git a/communication/server/include/CAN/Command/CAN_Command.h b/communication/server/include/CAN/Command/CAN_Command.h index ca385b2d..43abcdcd 100644 --- a/communication/server/include/CAN/Command/CAN_Command.h +++ b/communication/server/include/CAN/Command/CAN_Command.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,27 +16,6 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ #define COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ -/****************************************************************************** - * FILE :CAN_Command.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - -#include "CAN_Thread.h" - -/************************************************************************ -* Macro definitions * -************************************************************************/ - -/************************************************************************ -* Struct definitions * -************************************************************************/ - -/************************************************************************ -* Function prototype * -************************************************************************/ EFrameworkunifiedStatus CANCommandTransmission(HANDLE h_app); RET_CAN CANCommandTxRslt(HANDLE h_app, CAN_MSG_DATA*); -RET_CAN CANCommandDelivery(HANDLE h_app, CAN_MSG_DATA*); - #endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ diff --git a/communication/server/include/CAN/Command/CAN_CommandData.h b/communication/server/include/CAN/Command/CAN_CommandData.h deleted file mode 100644 index 3d476a68..00000000 --- a/communication/server/include/CAN/Command/CAN_CommandData.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMANDDATA_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMANDDATA_H_ -/****************************************************************************** - * FILE :CAN_CommandData.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - -#include - -/************************************************************************ -* Macro definitions * -************************************************************************/ -/* Number of table elements */ -#define CAN_COMMAND_DELIVERY_SNDID_NUM 16 /* CAN Command Delivery Registered Delivery Destination ID Max. */ -#define CAN_COMMAND_DELIVERY_NUM 6 /* Max. number of CAN command delivery control tables (6 for CAN command) */ -#define CAN_COMMAND_TXRSLT_SNDID_NUM 16 /* Maximum number of registered delivery destination IDs for CAN command transmission results */ -#define CAN_COMMAND_TXRSLT_NUM (6 * CAN_COMMAND_TXRSLT_SNDID_NUM) /* Maximum number of CAN command transmission result management tables */ - -/* Control method */ -#define CAN_CMD_DELIVERY_CTRL 0 /* Delivery control type */ -#define CAN_CMD_1TIME_TRANCE 1 /* One-time communication */ -#define CAN_CMD_TRANCE 2 /* Continuous communication type */ - -/* Controlling flag */ -#define CAN_CMD_RST_NOT_RCV 0 /* Not received */ -#define CAN_CMD_RST_RCV 1 /* Received */ - -/* Resource ID Mask */ -#define CAN_CMD_RID_MASK 0x80 - -/************************************************************************ -* Struct definitions * -************************************************************************/ -/*************************************************** -* TAG : CAN_COMMAND_DELIVERY_LIST_DAT -* ABSTRACT : CAN command delivery management table structure (1 item) -* Use in arrays when used -* (CAN internal data management table) -****************************************************/ -typedef struct { - uint8_t uc_ctrl; /* Control method */ - uint8_t uc_flag; /* Controlling flag */ - uint8_t notify_name_num; /* Number of registered shipping destinations */ - uint8_t reserve; /* ----- */ - // uint32_t notifyIdList[CAN_COMMAND_DELIVERY_SNDID_NUM]; /* Addresses for delivery ID */ - char notify_name_list[CAN_COMMAND_DELIVERY_SNDID_NUM][MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_COMMAND_DELIVERY_LIST_DAT; - -/*************************************************** -* TAG : CAN_COMMAND_TXRSLT_LIST_DAT -* ABSTRACT : CAN command transmission result management table structure (1 item) -* Use in arrays when used -* (CAN internal data management table) -****************************************************/ -typedef struct { - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ - // uint32_t notifyId; /* Addresses for delivery ID */ - uint8_t uc_rid; /* Resources ID */ - uint8_t uc_cmd_id; /* CAN command ID */ -} CAN_COMMAND_TXRSLT_LIST_DAT; - -/************************************************************************ -* Function prototype * -************************************************************************/ -BOOL CANCommandDeliveryEntryCheck(PCSTR name, uint8_t); -void CANCommandDeliveryEntry(PCSTR name, uint8_t); -void CANCommandDeliveryDataGet(uint8_t, CAN_COMMAND_DELIVERY_LIST_DAT *); -void CANCommandDeliveryDelete(uint8_t); -void CANCommandDeliveryDeletesingle(uint8_t, PCSTR); -BOOL CANCommandTxRsltEntryCheck(uint8_t, uint8_t *); -void CANCommandTxRsltEntry(uint8_t, PCSTR name, uint8_t); -void CANCommandTxRsltDataGet(uint8_t, char *, uint8_t *, uint8_t *); -void CANCommandTxRsltDelete(uint8_t); -BOOL CANCommandTxRsltCheck(uint8_t); -BOOL CANCommandFuelCalcRstReqCheck(void); -void CANCommandFuelCalcRstReq(void); -void CANCommandDataInit(void); - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMANDDATA_H_ diff --git a/communication/server/include/CAN/Delivery/CAN_Delivery.h b/communication/server/include/CAN/Delivery/CAN_Delivery.h index 74e226c1..01f2e2ff 100644 --- a/communication/server/include/CAN/Delivery/CAN_Delivery.h +++ b/communication/server/include/CAN/Delivery/CAN_Delivery.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,33 +16,25 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ #define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ -/****************************************************************************** - * FILE :CAN_Delivery.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - -#include +#include #include "CAN_Thread.h" +#include +#include +#include +#include -/************************************************************************ -* Macro definitions * -************************************************************************/ -#define CAN_CSUM_CHECKTBL_STOP_CODE 0xFFFFFFFFUL -/* CANDataStop code of the table for which checksum checksumming is to be performed */ - -/************************************************************************ -* Struct definitions * -************************************************************************/ +typedef std::multimap CAN_DeliveryEntryList; +typedef CAN_DeliveryEntryList::iterator CAN_DeliveryEntryListIt; +typedef std::pair CAN_DeliveryEntryListPair; -/************************************************************************ -* Function prototype * -************************************************************************/ -RET_CAN CANDataReceiveMsg(HANDLE h_app, CAN_MSG_DATA*); /* CANDataProcess of Received Messages */ -//RET_CAN CANDlcCheck(const T_ICR_CMD_DATA*); /* DLC check process */ -CANID CANCanidIfToUserCvt(uint8_t*); /* CAN ID Conversion Process 1 */ -CANID CANPacCanidIfToUserCvt(uint8_t*); -RET_CAN CANDeliveryRcvData(HANDLE h_app, CANID ul_canid, uint8_t n_ta, - uint8_t uc_dlc, uint8_t* puc_data_pos, uint8_t opc); -RET_CAN CANDeliveryRcv_CWORD29_Data(HANDLE h_app, const uint16_t us_opc, uint32_t uc_dlc, uint8_t *puc_data_pos); +void CANDeliveryInit(void); +bool CANDeliveryInsert(CANID canid, std::string s); +EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg); +EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); +EFrameworkunifiedStatus CANClearEntry(HANDLE h_app); +EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta, + uint8_t uc_dlc, const uint8_t *puc_data, + PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag = CANIF_PURERECV); +EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app, + CanMessage *msg, uint8_t cmd); #endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ diff --git a/communication/server/include/CAN/Delivery/CAN_DeliveryData.h b/communication/server/include/CAN/Delivery/CAN_DeliveryData.h index 692b8216..ae0302c7 100644 --- a/communication/server/include/CAN/Delivery/CAN_DeliveryData.h +++ b/communication/server/include/CAN/Delivery/CAN_DeliveryData.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -131,10 +131,7 @@ typedef struct { ************************************************************************/ void CANDeliveryDataInit(void); /* CANDataDelivery Management Data Initialization Process */ EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); /* CANDataDelivery registration process */ -EFrameworkunifiedStatus CAN_CWORD29_DeliveryEntry(HANDLE h_app); /* Process of registering the delivery of _CWORD29_ data */ void CANDeliveryBufferOut(FILE* fp_log); /* CAN shipping table log output processing */ -#ifdef CAN_DEBUG -EFrameworkunifiedStatus CANAllDeleteDeliveryEntry(HANDLE h_app); -#endif +EFrameworkunifiedStatus CANClearEntry(HANDLE h_app); #endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_ diff --git a/communication/server/include/CAN/TimerCtrl/CAN_TimerCtrl.h b/communication/server/include/CAN/TimerCtrl/CAN_TimerCtrl.h deleted file mode 100644 index bf273dd7..00000000 --- a/communication/server/include/CAN/TimerCtrl/CAN_TimerCtrl.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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_SERVER_INCLUDE_CAN_TIMERCTRL_CAN_TIMERCTRL_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_TIMERCTRL_CAN_TIMERCTRL_H_ -/****************************************************************************** - * FILE :CAN_TimerCtrl.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - -#include "CAN_Thread.h" - -/************************************************************************ -* Macro Definitions * -************************************************************************/ -#define CAN_TIM_RETRY_NUM 3 /* Number of retries for alarm API errors */ -/************************************************************************ -* Struct Definitions * -************************************************************************/ - -/*************************************************** -* TAG : CAN_TIMER_CTRL_DATA -* ABSTRACT : Timer management data section structure -****************************************************/ -typedef struct { - uint16_t us_set_tim; /* Timeout value */ - uint16_t us_tim_cnt; /* Measured value of timer */ -} CAN_TIMER_CTRL_DATA; - -/*************************************************** -* TAG : CAN_FREQTRANS_TIMER -* ABSTRACT : Periodic transmission timer management table structure -****************************************************/ -typedef struct { - uint16_t us_num; /* Number of timer registrations */ - uint8_t reserve[2]; /* Reserve */ - CAN_TIMER_CTRL_DATA data[CAN_FREQTRANS_TIMER_DATA]; /* Timer management data */ -} CAN_FREQTRANS_TIMER; - -/*************************************************** -* TAG : CAN_COMMWATCH_TIMER -* ABSTRACT : Disruption monitoring timer management table structure -****************************************************/ -typedef struct { - uint16_t us_num; /* Number of timer registrations */ - uint8_t reserve[2]; /* Reserve */ - CAN_TIMER_CTRL_DATA data[CAN_COMMWATCH_TIMER_DATA]; /* Timer management data */ -} CAN_COMMWATCH_TIMER; - -/************************************************************************ -* Function Prototype * -************************************************************************/ -RET_CAN CANFreqTransTimerStart(uint8_t, uint16_t, CAN_PROTOCOL_TYPE); /* Periodic transmission timer start processing */ -RET_CAN CANFreqTransTimerStop(uint8_t, CAN_PROTOCOL_TYPE); /* Periodic transmission timer start processing */ -RET_CAN CANCommWatchTimerStart(uint8_t, uint16_t, CAN_PROTOCOL_TYPE); /* Communication interruption monitoring timer start processing */ -RET_CAN CANCommWatchTimerStop(uint8_t, CAN_PROTOCOL_TYPE); /* Communication interruption monitoring timer stop processing */ -RET_CAN CANCommWatchTimerRenewal(uint8_t, CAN_PROTOCOL_TYPE); /* Communication interruption monitoring timer update processing */ -void CANFreqTransTimeOut(HANDLE h_app, uint16_t, CAN_PROTOCOL_TYPE); /* CAN periodic transmission timeout confirmation processing */ -void CANCommWatchTimeOut(HANDLE h_app, CAN_PROTOCOL_TYPE); /* CAN Communication Disruption Monitoring Timeout Confirmation Process */ -void CANTimerStart(uint16_t, CAN_TIMER_CTRL_DATA*); /* CAN Timer Master Processing */ -void CANTimerTblInit(void); /* CAN timer table initialization processing */ - -void CANFreqTimerEntry(CANID canid, uint32_t); -void CANFreqTransTimeOutMap(HANDLE h_app); -RET_CAN CANFreqTransTimerStopMap(CANID); -void CANFreqTimerResetMap(CANID); - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TIMERCTRL_CAN_TIMERCTRL_H_ diff --git a/communication/server/include/CAN/Transmission/CAN_Transmission.h b/communication/server/include/CAN/Transmission/CAN_Transmission.h deleted file mode 100644 index bca233ea..00000000 --- a/communication/server/include/CAN/Transmission/CAN_Transmission.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSION_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSION_H_ -/****************************************************************************** - * FILE :CAN_Transmission.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ -#include -#include "CAN_Thread.h" - -/************************************************************************ -* Macro definitions * -************************************************************************/ -#define TIMER_SEQNO_MASK_CODE (uint16_t)(0x00FF) /* Mask code for acquiring timer sequence number */ - -/************************************************************************ -* Struct definitions * -************************************************************************/ - -/************************************************************************ -* Function prototype * -************************************************************************/ -/* CANDataTransmission start message processing */ -EFrameworkunifiedStatus CANTxStart(HANDLE); -/* CANDataSend start message check processing */ -RET_CAN CANTxStartMsgCheck(const CAN_TRANSMISSION_START_MSG_DAT *, uint8_t *); -/* CANDataPeriodic transmission stop message processing */ -EFrameworkunifiedStatus CANFreqTxStop(HANDLE); -/* CANDataPeriodic transmission time-up message processing */ -RET_CAN CANFreqTxTimeupMsg(HANDLE h_app, uint16_t); -/* CANDataReceive message processing of transmission result */ -RET_CAN CANTxRsltReceiveMsg(HANDLE h_app, CAN_MSG_DATA *); -/* CANDataSend result received message check processing */ -RET_CAN CANTxRsltReceiveMsgCheck(CAN_MSG_DATA *); -/* CANData(_CWORD29_) outgoing message processing */ -EFrameworkunifiedStatus CAN_CWORD29_TxMsg(HANDLE h_app); -EFrameworkunifiedStatus CANTxBitStart(HANDLE); /* CANDataTransmission start message processing */ -EFrameworkunifiedStatus CANTxBitStop(HANDLE); /* CANDataPeriodic transmission stop message processing */ - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSION_H_ diff --git a/communication/server/include/CAN/Transmission/CAN_TransmissionData.h b/communication/server/include/CAN/Transmission/CAN_TransmissionData.h deleted file mode 100644 index 0c389276..00000000 --- a/communication/server/include/CAN/Transmission/CAN_TransmissionData.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSIONDATA_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSIONDATA_H_ -/****************************************************************************** - * FILE :CAN_TransmissionData.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ -#include -#include -#include "Canif_API_Local.h" -/************************************************************************ -* Macro definitions * -************************************************************************/ -/* Data size relationship */ -/* Maximum number of transmission results management tables */ -#define CAN_1TIME_TRSNSMISSION_RSLT_NUM 16 -#define CAN__CWORD29__TRSNSMISSION_RSLT_NUM 16 - -/* Regular transmission, one transmission result management table relationship */ -#define CAN_TXRSLT_CANRID_START 0x00 /* Send result CANRID starting No. */ -/* Transmission result (1 transmission) CANRID starting number */ -#define CAN_TXRSLT_CANRID_1TIME_START CAN_FREQ_TRSNSMISSION_LIST_NUM -/* Send result (_CWORD29_) CANRID starting number) */ -#define CAN_TXRSLT_CANRID__CWORD29__START (CAN_FREQ_TRSNSMISSION_LIST_NUM + CAN_1TIME_TRSNSMISSION_RSLT_NUM) // NOLINT(whitespace/line_length) -/* Send result CANRID end No. */ -#define CAN_TXRSLT_CANRID_END (CAN_FREQ_TRSNSMISSION_LIST_NUM + CAN_1TIME_TRSNSMISSION_RSLT_NUM + CAN__CWORD29__TRSNSMISSION_RSLT_NUM - 1) // NOLINT(whitespace/line_length) - -/* Others */ -#define CAN_FREQ_TXRSLT_NUM 1 /* Number of notifications of periodic transmission results */ - -#define LAN_TYPE_19PF "CAN_19PF" -/************************************************************************ -* Struct definitions * -************************************************************************/ -/*************************************************** -* TAG : CAN_FREQ_TRANSMISSION_DAT -* ABSTRACT : Periodic transmission management table structure (1 item) -* Use in arrays when used -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Type definitions for the periodic transmission management table (1 item) */ - uint16_t us_freq; /* Periodic transmission period (in 100ms) */ - // uint32_t notifyId; /* Thread ID */ - uint8_t uc_rid; /* Resources ID */ - uint8_t uc_resp_num; /* Number of transmission result notifications (number of remaining notifications) */ - uint8_t reserve[2]; /* Reserved */ - CAN_DATA st_can_data; /* Transmitted data */ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_FREQ_TRANSMISSION_DAT; - -/*************************************************** -* TAG : CAN_1TIME_TXRSLT_DAT -* ABSTRACT : One transmission result management table structure (1 item) -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Defining the type of delivery destination CAN ID (1 item) */ - CANID ul_canid; /* CAN ID */ - // uint32_t notifyId; /* Addresses for delivery ID */ - uint8_t uc_rid; /* Resources ID */ - uint8_t reserve; /* Reserved */ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_1TIME_TXRSLT_DAT; - -/*************************************************** -* TAG : CAN_1TIME_TXRSLT_MSG_DAT -* ABSTRACT : List of Messages Sent Once (1 item) -* (CAN-internal Work) -****************************************************/ -typedef struct { /* Defining the type of delivery destination CAN ID (1 item) */ - CANID ul_canid; /* CAN ID */ - // uint32_t notifyId; /* Addresses for delivery ID */ - uint8_t uc_rid; /* Resources ID */ - uint8_t uc_sts; /* Transmission result status */ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_1TIME_TXRSLT_MSG_DAT; - -/*************************************************** -* TAG : CAN_1TIME_TXRSLT_MSG_LIST_DAT -* ABSTRACT : List of Messages Sent Once (All Messages) -* (CAN-internal Work) -****************************************************/ -typedef struct { /* Type definition of the delivery destination ID data to which the message is sent */ - int32_t i_num; /* Number of messages sent */ - CAN_1TIME_TXRSLT_MSG_DAT st_list[CAN_1TIME_TRSNSMISSION_RSLT_NUM]; /* List */ -} CAN_1TIME_TXRSLT_MSG_LIST_DAT; - -/*************************************************** -* TAG : CAN__CWORD29__TXRSLT_DAT -* ABSTRACT : _CWORD29_ send result control table structure (1 item) -* (CAN internal data management table) -****************************************************/ -typedef struct { - uint16_t opc; /* OPC */ - uint8_t uc_rid; /* Resources ID */ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN__CWORD29__TXRSLT_DAT; - -/*************************************************** -* TAG : CAN_TRANS_START_TABLE_VAL -* ABSTRACT : Transmit data management table structure (1 item) -* (CAN internal data management table) -****************************************************/ -typedef struct { - uint8_t dlc; - CAN_DATA_BIT dat; -} CAN_TRANS_START_TABLE_VAL; - -/*************************************************** -* TAG : CAN_INIT_TABLE -* ABSTRACT : Transmission data initial value management table structure -****************************************************/ -typedef struct { - CANID canid; - CAN_TRANS_START_TABLE_VAL val; -} CAN_INIT_TABLE; - -/************************************************************************ -* Function prototype * -************************************************************************/ -void CANTransmissionDataInit(void); -BOOL CANFreqTransEntryCheck(CANID canid, uint8_t *); -void CANFreqTransEntry(uint8_t, const CAN_TRANSMISSION_START_MSG_DAT *); -void CANFreqTransDataGet(uint8_t uc_index, CAN_FREQ_TRANSMISSION_DAT *pst_data); -BOOL CANFreqTransCanidEntryCheck(uint8_t, CANID); -BOOL CANFreqTransIdEntryCheck(uint8_t, PCSTR); -void CANFreqTransStop(uint8_t); -BOOL CANFreqTransIndexEntryCheck(uint8_t); -BOOL CAN1TimeTransEntryCheck(uint8_t *); -BOOL CAN_CWORD29_TransEntryCheck(uint8_t *); -EFrameworkunifiedStatus CAN1TimeTransEntry(uint8_t, const CAN_TRANSMISSION_START_MSG_DAT *); -EFrameworkunifiedStatus CAN_CWORD29_TransEntry(uint8_t, const CAN__CWORD29__TRANS_MSG *); -BOOL CANTxRsltEntryCheck(uint8_t); -void CANTxRsltDataGet(uint8_t, CAN_1TIME_TXRSLT_DAT *); -void CAN_CWORD29_TxRsltDataGet(const uint8_t, CAN__CWORD29__TXRSLT_DAT* const); -void CANTxRsltFin(uint8_t); -void CAN_CWORD29_TxRsltFin(const uint8_t); -BOOL CANTxRsltSndCheck(uint8_t, uint32_t); -void CANCycleTransBufferOut(FILE *fp_log); - -BOOL CANTransDataEntry(CAN_TRANS_START_MSG_DAT *); -BOOL CANTransStartTxMsg(HANDLE h_app, CANID); -BOOL CANEntryTransCanidCheck(CANID); - -BOOL CAN_SubIDTransStartTxMsg(HANDLE h_app, CAN_TRANS_START_MSG_DAT *); - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TRANSMISSION_CAN_TRANSMISSIONDATA_H_ diff --git a/communication/server/include/CAN/TxMsg/CAN_TxMsg.h b/communication/server/include/CAN/TxMsg/CAN_TxMsg.h index 15fc56d1..dc4f6e8e 100644 --- a/communication/server/include/CAN/TxMsg/CAN_TxMsg.h +++ b/communication/server/include/CAN/TxMsg/CAN_TxMsg.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,101 +16,39 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ #define COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ -/****************************************************************************** - * FILE :CAN_TxMsg.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : - ******************************************************************************/ - +#include +#include +#include +#include #include "CAN_Thread.h" +#include "API_Local_Common.h" +#include "Canif_API_Local.h" + + +#define CAN_OPC_PAC_RX 0x00 +#define CAN_OPC_COMMAND_STARTUP_FIN_REQ_TX 0x00 // CAN start completion notification request transmission +#define CAN_OPC_COMMAND_MRST_INFO_REQ_TX 0x01 // CAN master reset information notification request transmission +#define CAN_OPC_COMMAND_VERSION_REQ_TX 0x02 // CAN Version Request Send +#define CAN_OPC_COMMAND_CONNECTION_NODE_REQ_TX 0x03 // CAN connection node notification request transmission +#define CAN_OPC_COMMAND_BUS_STATUS_REQ_TX 0x04 // CAN bus status notification request transmission +#define CAN_OPC_COMMAND_FUELCALC_REQ_TX 0x05 // CAN section flame reset response transmission +#define CAN_OPC_COMMAND_STARTUP_FIN_RESP_RX 0x06 // CAN startup completion notice received +#define CAN_OPC_COMMAND_MRST_INFO_RESP_RX 0x07 // CAN Master Reset Information Notification Reception +#define CAN_OPC_COMMAND_VERSION_RESP_RX 0x08 // CAN Version Response Reception +#define CAN_OPC_COMMAND_CONNECTION_NODE_RESP_RX 0x09 // Receive CAN Connection Node Notification Response +#define CAN_OPC_COMMAND_BUS_STATUS_RESP_RX 0x10 // CAN Bus Status Notification Response Reception +#define CAN_OPC_COMMAND_FUELCALC_RST_REQ_RX 0x11 // RECEIVE REQUEST FREE OF CAN SECTION -/************************************************************************ -* Macro definitions * -************************************************************************/ -#define CAN_TX_COMM_KIND 0x00 /* CANDataCommunication type for transmission */ -#define CAN_TX_PHYS_ADRS 0x0000 /* CANDataPhysical address for transmission */ -#define CAN_TX_FROM_ADRS 0x00 /* CANDataSource address for sending (wildcard) */ -#define CAN_TX_TO_ADRS 0x00 /* CANDataDestination address for sending (wildcard) */ - -/****** OPC ******/ -#define CAN_OPC_RX 0x00 /* CANData reception notice */ -#define CAN_OPC_PAC_RX 0x00 /* CAN Packaging Data Reception Notification */ -#define CAN_OPC_TX 0x00 /* CANDataReport request */ - -#define CAN_OPC_COMMAND_STARTUP_FIN_REQ_TX 0x00 /* CAN start completion notification request transmission */ -#define CAN_OPC_COMMAND_MRST_INFO_REQ_TX 0x01 /* CAN master reset information notification request transmission */ -#define CAN_OPC_COMMAND_VERSION_REQ_TX 0x02 /* CAN Version Request Send */ -#define CAN_OPC_COMMAND_CONNECTION_NODE_REQ_TX 0x03 /* CAN connection node notification request transmission */ -#define CAN_OPC_COMMAND_BUS_STATUS_REQ_TX 0x04 /* CAN bus status notification request transmission */ -#define CAN_OPC_COMMAND_FUELCALC_REQ_TX 0x05 /* CAN section flame reset response transmission */ -#define CAN_OPC_COMMAND_STARTUP_FIN_RESP_RX 0x06 /* CAN startup completion notice received */ -#define CAN_OPC_COMMAND_MRST_INFO_RESP_RX 0x07 /* CAN Master Reset Information Notification Reception */ -#define CAN_OPC_COMMAND_VERSION_RESP_RX 0x08 /* CAN Version Response Reception */ -#define CAN_OPC_COMMAND_CONNECTION_NODE_RESP_RX 0x09 /* Receive CAN Connection Node Notification Response */ -#define CAN_OPC_COMMAND_BUS_STATUS_RESP_RX 0x10 /* CAN Bus Status Notification Response Reception */ -#define CAN_OPC_COMMAND_FUELCALC_RST_REQ_RX 0x11 /* RECEIVE REQUEST FREE OF CAN SECTION */ - -/************************************************************************ -* Struct definitions * -************************************************************************/ -/*************************************************** -* TAG : CAN_TXMSG_DAT -* ABSTRACT : CANDataTransmission data section structure -* (Data structure passed from tha CAN to router) -****************************************************/ -typedef struct { /* Type definition of send command */ - uint8_t reserve; /* Reserved */ - uint8_t uc_length; /* Data length */ - uint8_t uc_kind_padrs; /* Data type/Physical address */ - uint8_t uc_p_adrs; /* Physical address */ - uint8_t uc_from_adrs; /* Source address */ - uint8_t uc_to_adrs; /* Forwarding address */ - uint8_t uc_opc; /* OPC */ - uint8_t uc_operand[CAN_TX_OPERAND_SIZE]; /* Operand*/ -} CAN_TXMSG_DAT; - -/*************************************************** -* TAG : CAN_TXMSG -* ABSTRACT : CANDataTransmission data section structure -* (Data structure passed from tha CAN to router) -****************************************************/ -typedef struct { /* For main processing */ -// T_APIMSG_MSGBUF_HEADER_COMM st_head; /* Header */ - CAN_TXMSG_DAT st_data; /* Data portion */ -} CAN_TXMSG; - -/*************************************************** -* TAG : HANDLE_DAT -* ABSTRACT : MapHandler data-section structures -****************************************************/ typedef struct { - HANDLE handle; - BOOL is_q_full; /* Queue full judgment flag */ -} HANDLE_DAT; - -/************************************************************************ -* Function prototype * -************************************************************************/ -BOOL CANDeliverySndMsg(HANDLE h_app, CANID canid, uint8_t, const uint8_t *, uint8_t, uint8_t); -BOOL CANDelivery_CWORD29_SndMsg(HANDLE h_app, const uint16_t us_opc, uint32_t uc_dlc, const uint8_t *puc_data); -/* CANDataDelivery Messages Sending Process (Except for CANGW) */ -BOOL CANDeliverySndMsgToCANGW(HANDLE h_app, CAN_MSG_CANGWDATA *cangw_data); -/* CAN-data-delivery-messaging process to the CANGW */ -BOOL CANFreqTransStartTxMsg(HANDLE h_app, uint8_t); /* CANDataPeriodic transmission start message transmission processing */ -BOOL CAN1TimeTransStartTxMsg(HANDLE h_app, uint8_t, const CAN_DATA *); /* CANDataSend one transmission start message processing */ -void CANCommWatchSndMsg(HANDLE h_app, uint8_t); /* CANDataTransmission of communication interruption detection/recovery message */ -BOOL CANTxRsltSndMsg(HANDLE h_app, uint8_t, uint8_t); /* CANDataTransmission result notification message transmission processing */ -/* _CWORD29_ data transmission result notification message transmission process */ -BOOL CAN_CWORD29_TxRsltSndMsg(const HANDLE h_app, const uint8_t uc_can_rid, const uint8_t uc_status); -void CANCanidUserToIfCvt(CANID canid, uint8_t *); /* CAN ID Conversion Process 2 */ - -BOOL CANCommandDeliverySndMsg(HANDLE h_app, uint8_t, const uint8_t *); /* CAN command delivery message transmission processing */ -BOOL CANCommandTxRsltSndMsg(HANDLE h_app, uint8_t, uint8_t); /* CAN command transmission result notification message transmission processing */ -BOOL CANCommandTransmissionSndMsg(uint8_t, uint8_t); /* CAN command message transmission processing */ -BOOL CANCommandFuelCalcRstReqSndMsg(HANDLE h_app, PCSTR name); /* CAN section flame reset request reception message transmission processing */ -BOOL CANCommandidOpcToUserCvt(uint8_t, uint8_t *); /* CAN Command ID Conversion Processing 1 */ -BOOL CANCommandidUserToOpcCvt(uint8_t, uint8_t *); /* CAN command ID conversion process 2 */ - -BOOL CANTransStartTxMsgCore(HANDLE h_app, CANID canid, uint8_t, CAN_DATA_BIT *); - + uint8_t rid; + char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1]; +} CAN_SEND_STATUS_DAT; + +void CANTxMsgInit(void); +EFrameworkunifiedStatus CANTxMsg(HANDLE h_app); +EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app); +void CANCommandSetFuelCalcRstReq(void); +EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app); +EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg, + PS_CommunicationProtocol cid); #endif // COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ diff --git a/communication/server/include/com_error_type.h b/communication/server/include/com_error_type.h index bfd96b3a..4d15f827 100644 --- a/communication/server/include/com_error_type.h +++ b/communication/server/include/com_error_type.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,20 +16,6 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ #define COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ - -/************************************************************************* - * RET_API define - *************************************************************************/ - -#define RET_NORMAL 0 /* Normal completion */ - -/* Function code (normal termination) system */ -#define RET_RCVMSG 1 /* Receive only message */ - -/* Error code system */ -#define RET_OSERROR -127 /* OS System call error*/ -#define RET_ERROR -1 /* Error termination (content is unspecified) */ -#define RET_ERRPARAM -2 /* Parameter error */ -#define RET_ERRTIMEOUT -5 /* Timeout with Processing Not Complete */ - +const int32_t RET_NORMAL = 0; +const int32_t RET_ERROR = -1; #endif // COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ diff --git a/communication/server/include/main/communication_cid.h b/communication/server/include/main/communication_cid.h index 21882eea..d8176247 100644 --- a/communication/server/include/main/communication_cid.h +++ b/communication/server/include/main/communication_cid.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -14,16 +14,6 @@ * limitations under the License. */ -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup -/// \brief -/// -/// -/// -/// -/// -/////////////////////////////////////////////////////////////////////////////// - /* * This file has been generated automatically. * User hand written code entry is not allowed. Do not modify the file content. @@ -32,10 +22,6 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_ #define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_ -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Include Files -//////////////////////////////////////////////////////////////////////////////////////////////////// - #define LAN_SERVICE_MAIN "Communication" typedef enum PSCommunicationServiceProtocol { diff --git a/communication/server/include/main/communication_communicationlog.h b/communication/server/include/main/communication_communicationlog.h index c8a46e5f..37016ad1 100644 --- a/communication/server/include/main/communication_communicationlog.h +++ b/communication/server/include/main/communication_communicationlog.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. diff --git a/communication/server/include/main/communication_version.h b/communication/server/include/main/communication_version.h index cdb83e66..7cd2c3ba 100644 --- a/communication/server/include/main/communication_version.h +++ b/communication/server/include/main/communication_version.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. diff --git a/communication/server/include/peripheral_service/communication.h b/communication/server/include/peripheral_service/communication.h index e99996ce..94f55449 100644 --- a/communication/server/include/peripheral_service/communication.h +++ b/communication/server/include/peripheral_service/communication.h @@ -1,5 +1,5 @@ // -// @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION. +// @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. diff --git a/communication/server/include/peripheral_service/communication_notifications.h b/communication/server/include/peripheral_service/communication_notifications.h index 97817177..9c207f3f 100644 --- a/communication/server/include/peripheral_service/communication_notifications.h +++ b/communication/server/include/peripheral_service/communication_notifications.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. diff --git a/communication/server/include/peripheral_service/ps_services.h b/communication/server/include/peripheral_service/ps_services.h index dbb823ee..fd556d6d 100644 --- a/communication/server/include/peripheral_service/ps_services.h +++ b/communication/server/include/peripheral_service/ps_services.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION. + * @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. diff --git a/communication/server/include/private/ICR_Common.h b/communication/server/include/private/ICR_Common.h deleted file mode 100644 index c9bae1c1..00000000 --- a/communication/server/include/private/ICR_Common.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 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 ICR_Common.h - * @~english - * @brief ICR common definitions - *----------------------------------------------------------------------------*/ -#ifndef COMMUNICATION_SERVER_INCLUDE_PRIVATE_ICR_COMMON_H_ -#define COMMUNICATION_SERVER_INCLUDE_PRIVATE_ICR_COMMON_H_ - -#include -//#include - -//#include - -#endif // COMMUNICATION_SERVER_INCLUDE_PRIVATE_ICR_COMMON_H_ diff --git a/communication/server/include/threads/CAN_Thread.h b/communication/server/include/threads/CAN_Thread.h index 67a814a0..b6960efd 100644 --- a/communication/server/include/threads/CAN_Thread.h +++ b/communication/server/include/threads/CAN_Thread.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,143 +16,36 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ #define COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ -/*!----------------------------------------------------------------------------- - * @file CAN_Thread.h - * @~english - * @brief CAN Thread main block header file - *----------------------------------------------------------------------------*/ #include #include #include "com_error_type.h" -#include "ICR_Common.h" #include "communication_communicationlog.h" -/************************************************************************ -* Macro definitions * -************************************************************************/ -/* Data size relationship */ - -#define CAN_TRX_HEADER_SIZE 7 /* Size of send/receive header section (data length excluding operands) */ -#define CAN_TRX_HEADER_LEN_SIZE 5 /* Size included in the data length calculation of the send/receive header section */ - -#define CAN_TRX_CANID_SIZE 4 /* Transmit/Receive CAN ID Size */ -#define CAN_TRX_DLC_SIZE 1 /* Transmit/Receive DLC Data Size */ -#define CAN_TRX_DLC_RESERVE_SIZE 3 /* Reserved data size after transmit/receive DLC */ +#if 0 +#define CAN_TX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_TX_OPERAND_SIZE) -#define CAN_RX_CANDATA_SIZE CAN_DATA_SIZE /* Reserve CANData(DATA#1 ~ #x)size */ +#define CAN_RX_CANDATA_SIZE CAN_DATA_SIZE /* Receive CANData(DATA#1 ~ #x)size */ /* Reserve the structure if it is not a multiple of 4. */ #define CAN_TX_CANDATA_SIZE CAN_DATA_SIZE /* Send CANData(DATA#1 ~ #x)size */ /* Reserve the structure if it is not a multiple of 4. */ #define CAN_RX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_RX_CANDATA_SIZE) -/* Receive operand size */ -#define CAN_RX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_RX_OPERAND_SIZE) -/* Receive command size */ #define CAN_TX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_TX_CANDATA_SIZE) // NOLINT(whitespace/line_length) /* Send operand size */ -#define CAN_TX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_TX_OPERAND_SIZE) -/* Send command size */ + +#endif + +#define CAN_CMDSND_DATA_SIZE 0 /* Command transmission data section size (CAN command control) */ + #define CAN_TX_CMD_DELIVERY_SIZE 4 /* Transmitting CAN Command Delivery Data Size Common Block */ #define CAN_TX_CMD_FUELCALC_RST_SIZE 0 /* Transmit CAN Command Delivery Data Size CAN Section Burn Cost Reset Request Receive Data */ #define CAN_TX_CMD_STARTUP_FIN_SIZE 3 /* Transmit CAN Command Delivery Data Size CAN Startup Completion Notification Data */ #define CAN_TX_CMD_MRST_INFO_SIZE 33 /* Transmit CAN Command Delivery Data Size CAN Master Reset Information Notification Receive Data */ #define CAN_TX_CMD_VERSION_SIZE 4 /* Transmit CAN Command Delivery Data Size CAN Version Response Receive Data */ -#define CAN_TX_CMD_BUS_STATUS_SIZE 1 /* Transmit CAN Command Delivery Data Size Receive CAN Bus Status Notification Response */ - -#define CAN_CMDSND_DATA_SIZE 0 /* Command transmission data section size (CAN command control) */ - -/* Data location relationship */ -#define CAN_MSGBUF_CANID_POS 0 /* How many operands the CAN ID contains? */ -#define CAN_MSGBUF_DLC_POS 4 /* No. of operand from which DLC contains data? */ -#define CAN_MSGBUF_DATA_POS 5 /* How many operands does the DATA contain? */ - -#define CAN_MSGBUF_PAC_CANID_POS 1 /* How many operands the CAN ID contains? */ -#define CAN_MSGBUF_PAC_DLC_POS 3 /* No. of operand from which DLC contains data? */ -#define CAN_MSGBUF_PAC_DATA_POS 4 /* How many operands does the DATA contain? */ - -/* Error definitions */ -#define RET_CAN_INIT_SUCCESS RET_NORMAL /* Success in initialization */ -#define RET_CAN_INIT_ERROR RET_ERROR /* Master Clear failed */ - -#define RET_CAN_NORMAL CANIF_RET_NORMAL /* Normal completion */ -#define RET_CAN_ERROR_CREATE_EVENT CANIF_RET_ERROR_CREATE_EVENT /* Event generation failure */ -#define RET_CAN_ERROR_PARAM CANIF_RET_ERROR_PARAM /* Specified parameter is invalid */ -#define RET_CAN_ERROR_UNDEF CANIF_RET_ERROR_UNDEF /* Unregistered ID */ -#define RET_CAN_ERROR_SNDID CANIF_RET_ERROR_PID /* Discrepancy of Destination ID */ -#define RET_CAN_ERROR_BUFFULL CANIF_RET_ERROR_BUFFULL /* Registered FULL (Delivery/Periodic Transmission/Communication Disruption Monitor) */ -#define RET_CAN_ERROR_CANIDFULL CANIF_RET_ERROR_CANIDFULL /* CAN ID type is FULL */ -#define RET_CAN_ERROR_TIMER CANIF_RET_ERROR_TIMER /* Timer acquisition failed */ -#define RET_CAN_ERROR_CANCEL CANIF_RET_ERROR_CANCEL /* Abnormal termination (discard/cancel data) */ -/* CANDataControl code used in the transmission/reception relationship */ -#define CAN_ID_EXT_FLAG 0x80000000UL /* CAN ID Extended Identity Codes */ - -/* Timer Relationship */ -#define CAN_TIMER_SEQNO_CODE 0x0001 /* CAN thread timer sequence number */ -#define CAN_TIMER_SEQNO_BUFFLOGOUT 0x0002 /* Buffer log output timer No. */ - -#define COMM_WATCH_SEQNO_CODE 0x0000 /* Timer Sequence Number Identification Flag of Communication Disruption */ -#define FREQ_TRANS_SEQNO_CODE 0x8000 /* Timer Sequence Number Identification Flag for Periodic Transmission */ -#define CAN_TIMER_DISTINCTION_CODE 0xF000 /* Timer Sequence Number Identification Flag */ - -#define CAN_COMTIM_OFF 0x00 /* Timer not started */ -#define CAN_COMTIM_ON 0x01 /* Timer activation state */ - -#define CAN_FREQ_TRSNSMISSION_LIST_NUM 32 /* Maximum number of periodic transmission management tables */ -#define COMM_WATCH_LIST_NUM 64 /* Maximum number of communication disruption monitoring management tables */ - - -/* Maximum number of CAN periodic transmission timer management data */ -#define CAN_FREQTRANS_TIMER_DATA CAN_FREQ_TRSNSMISSION_LIST_NUM -/* Maximum number of CAN disruption monitoring timer management data */ -#define CAN_COMMWATCH_TIMER_DATA COMM_WATCH_LIST_NUM - -#define CAN_BUFFER_LOGOUT_NAME "/fs/U0/can_buffer_log.txt" /* */ - -#define CAN_USAGE_RATE_THRESHOLD 80 /* Buffer Utilization Threshold (80%) */ - -#define CAN_DELIVERY_DLCERR 0xfeff /* CAN delivery error (DLC) */ -#define CAN_DELIVERY_CSUMERR 0xfefe /* CAN delivery errors (CSUM) */ -#define CAN_DELIVERY_ERR 0xfefd /* CAN delivery error (delivery unregistered) */ -#define CAN_TRANCE_ICR_ERR 0xfefc /* CAN transmission error (ICR) */ -#define CAN_TRANCE_SYSCOM_ERR 0xfefb /* CAN transmission errors (SYSCOM) */ - -/********************************************************************* -* Type definition -***********************************************************************/ +#define CAN_TRX_HEADER_SIZE 7 /* Size of send/receive header section (data length excluding operands) */ +#define CAN_TRX_CANID_SIZE 4 /* Transmit/Receive CAN ID Size */ +#define CAN_TRX_DLC_SIZE 1 /* Transmit/Receive DLC Data Size */ typedef CANIF_RET_API RET_CAN; - -typedef enum { - CAN_PROTOCOL_TYPE_CAN = 0, /* CAN */ - /* -------------------------------------------------------------------- */ - CAN_PROTOCOL_TYPE_TERMINATE /* Mode termination */ -} CAN_PROTOCOL_TYPE; - -/************************************************************************ -* Function prototype * -************************************************************************/ -RET_CAN CANMainThreadInit(void); EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE); -void CANTimeOutMsg(HANDLE h_app, uint16_t); -void CANCommonTimerStart(void); -void CANBufferLogOut(void); -void CANDebugLogOut(uint16_t, void*); -void CANFreqTransTimeOutMap(void); - -/******************************************************************************* - * MODULE : CANMsgErrChk - * ABSTRACT : Message Send/Receive Error Check Processing - * FUNCTION : Check for message transmission and reception errors and perform error processing. - * ARGUMENT : RET_API ret_api Message send/receive return value - * : u_int16 communication_code Registration code - * NOTE : - * RETURN : - ******************************************************************************/ - -inline void CANMsgErrChk(int32_t ret_api, uint16_t communication_code) { - if (RET_ERROR == ret_api) { /* In case of an error */ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CANMsgErrChk Called."); - exit(EXIT_FAILURE); - } -} -#endif // COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ +#endif // COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ \ No newline at end of file diff --git a/communication/server/include/threads/Thread_Common.h b/communication/server/include/threads/Thread_Common.h index 91b907d5..6cda5aaf 100644 --- a/communication/server/include/threads/Thread_Common.h +++ b/communication/server/include/threads/Thread_Common.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION. + * @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. @@ -16,17 +16,27 @@ #ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_ #define COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_ #include -//#include +#include +#include +#include +#include + const int32_t CAN_AVAILABILITY = 0x1; +void CommonInit(void); +HANDLE CommonFindSender(HANDLE h_app, std::string s); BOOL CommGetAvailabilityCurrent(int32_t current); void CommSetAvailabilityCurrent(int32_t current); void CommClrAvailabilityCurrent(int32_t current); EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd); -//EFrameworkunifiedStatus CommonCanHalThreadStart(HANDLE h_app, -// const FrameworkunifiedProtocolCallbackHandler *cb, -// UI_32 count, PCSTR cmd, CanHalParam *p); -//EFrameworkunifiedStatus CommonCanHalThreadStop(HANDLE h_app, const PUI_32 cb, -// UI_32 count, PCSTR cmd, CanHalType type); -EFrameworkunifiedStatus CommonCanHalErrorNotify(const char *msg, void *ctxid); -#endif +EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb, + UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE)); +EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb, UI_32 count, + PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE)); +EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app); + +static inline EFrameworkunifiedStatus ConvRet(CANHAL_RET_API ret) { + return ((ret != CANHAL_RET_NORMAL) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK); +} +std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len); +#endif \ No newline at end of file -- cgit 1.2.3-korg