| | |
| | | #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) |
| | | |
| | |
| | | {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 */ |
| | |
| | | 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); |
| | | } |
| | |
| | | /* 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 |
| | |
| | | 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) |
| | |
| | | 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) |
| | | { |