From d8a5f3225d105585a4f181ed884adb2a861e0d13 Mon Sep 17 00:00:00 2001 From: tao_z <tzj0429@163.com> Date: Sat, 11 Jun 2022 02:36:46 +0800 Subject: [PATCH] 修改ee虚拟地址方式 --- Application/source/uds_modules/uds.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Application/source/uds_modules/uds.c b/Application/source/uds_modules/uds.c index 153ebff..1be6abd 100644 --- a/Application/source/uds_modules/uds.c +++ b/Application/source/uds_modules/uds.c @@ -155,7 +155,7 @@ #define RSP_DATA_LEN (6) #define UDS_TASK_RATE (10) -#define CANTP_RX_BUFFER_SIZE (128) +#define CANTP_RX_BUFFER_SIZE (266) #define FBL_RX_BUFFER_SIZE (256) #define CANTP_TX_BUFFER_SIZE (128) @@ -386,9 +386,9 @@ {ROUTINE_CONTROL, UDS_RoutineControl, false, true, false, false, SECURITY_ACCESS_UNLOCK_LEVEL_2}, {TESTER_PRESENT, UDS_TesterPresent, true, true, true, true, SECURITY_ACCESS_LOCKED}, // {CONTROL_DTC_SETTING, UDS_ControlDTCSetting, false, true, false, true, SECURITY_ACCESS_LOCKED}, - {REQUEST_DOWNLOAD, UDS_RequestDownload, false, true, false, true, SECURITY_ACCESS_UNLOCK_LEVEL_2}, - {TRANSFER_DATA, UDS_TransferData, false, true, false, true, SECURITY_ACCESS_UNLOCK_LEVEL_2}, - {REQUEST_TRANSFER_EXIT, UDS_RequestTransferExit, false, true, false, true, SECURITY_ACCESS_UNLOCK_LEVEL_2}, + {REQUEST_DOWNLOAD, UDS_RequestDownload, false, true, false, false, SECURITY_ACCESS_UNLOCK_LEVEL_2}, + {TRANSFER_DATA, UDS_TransferData, false, true, false, false, SECURITY_ACCESS_UNLOCK_LEVEL_2}, + {REQUEST_TRANSFER_EXIT, UDS_RequestTransferExit, false, true, false, false, SECURITY_ACCESS_UNLOCK_LEVEL_2}, }; /* clang-format on */ @@ -1480,14 +1480,15 @@ break; case PROGRAMMING: /* UDS_SendNegResp(NRC_SUBFUNCTION_NOT_SUPPORTED); */ - if (((UDS_L_Diag_session_e == EXTENDED) || (UDS_L_Diag_session_e == PROGRAMMING)) && (UDS_L_ProgrammingPreconditionCheckOK_b == true)) + if (((UDS_L_Diag_session_e == EXTENDED) || (UDS_L_Diag_session_e == PROGRAMMING))) { - /**/ + CDT_RESET(TesterPresentTimer_u16, + UDS_NS_SessionTimeout_u16 / UDS_TASK_RATE); UDS_L_Diag_session_e = PROGRAMMING; UDS_SessionSetOk_b = true; FblSetFblProgramRequestFlag(); } - else if ((UDS_L_Diag_session_e == DEFAULT) || (UDS_L_ProgrammingPreconditionCheckOK_b == false)) /*DEFAULT session can not trans to PROGRAMMING*/ + else if ((UDS_L_Diag_session_e == DEFAULT)) /*DEFAULT session can not trans to PROGRAMMING*/ { UDS_SendNegResp(NRC_CONDITIONS_NOT_CORRECT); } @@ -1498,6 +1499,7 @@ case DEFAULT: if (UDS_L_Diag_session_e == PROGRAMMING) { + UDS_L_Diag_session_e = DEFAULT; UDS_L_tx_msg_buffer[0] = GET_RESPONSE_SERVICE_ID(SESSION_CONTROL); UDS_L_tx_msg_buffer[1] = UDS_L_Diag_session_e; UDS_L_tx_msg_buffer[2] = 0; @@ -1511,6 +1513,7 @@ /* Compose a response message and send a positive */ /* response with the request data */ UDS_RespTxMessage(); + FblClrFblProgramRequestFlag(); while (cnt--) { ; /// wait send command send out and then reset @@ -1936,7 +1939,6 @@ return; } - UDS_L_ResponsePendingRequest_e |= ERASE_RESP_PENDING; UDS_SendNegResp(NRC_SERVICE_BUSY); erase_state = NVM_EraseData(eraseAddress, eraseRemainder); if (erase_state == OP_STATUS_OK) @@ -2215,7 +2217,7 @@ operation_write.current_sequenc = expectedSequenceCnt; operation_write.prev_seqence = currentSequenceCnt; - UDS_SendNegResp(NRC_SERVICE_BUSY); // first send busy + // UDS_SendNegResp(NRC_SERVICE_BUSY); // first send busy write_result = NEM_WriteData(&operation_write); // todo write all data at this function if (write_result == OP_STATUS_OK) { -- Gitblit v1.8.0