/*
* MIT License
*
* Copyright (c) 2019 LandF Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* ________________________________________________________________________________________
*
* UDS-CAN Protocol processing
*
* ----------------------------------------------------------------------------------------
* Development history
*
* 2017/08/13 Start coding (by Tachibana)
*
* ----------------------------------------------------------------------------------------
* T.Tachibana
* L&F
* ________________________________________________________________________________________
*/
#include <sysio.h>
#include <string.h>
#include <stdio.h>
#include "iodefine.h"
#include "timer.h"
#include "ecu.h" // ECU common definition
#include "can3_spi2.h" // CAN3 definition
#include "cantp.h" // CAN-TP definition
#include "uds.h" // CAN-UDS definition
#include "altypes.h"
#include "r_flash_api_rx600_config.h"
#include "mcu_info.h"
#include "r_flash_API_RX600.h"
#include "r_flash_api_rx600_private.h"
/*
* Overview of UDS (Unified Diagnostics Service) processing
*
* UDS is a protocol that provides an integrated diagnostic service that sends and receives variable-length packets.
* In this firmware, only some services are implemented.
*
* UDS service list (X = not implemented / O = implemented * but minimum)
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Function group |Request|Respons| Service | Impl. |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Diagnostic and | 10 | 50 | Diagnostic Session Control | O |
* + Communications +-------+-------+-----------------------------------------------+-------+
* | Management | 11 | 51 | ECU Reset | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 27 | 67 | Security Access | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 28 | 68 | Communication Control | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 3E | 7E | Tester Present | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 83 | C3 | Access Timing Parameters | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 84 | C4 | Secured Data Transmission | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 85 | C5 | Control DTC Setting | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 86 | C6 | Response On Event | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 87 | C7 | Link Control | X |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Data | 22 | 62 | Read Data By Identifier | O |
* + Transmission +-------+-------+-----------------------------------------------+-------+
* | | 23 | 63 | Read Memory By Address | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 24 | 64 | Read Scaling Data By Identifier | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 2A | 6A | Read Data By Identifire Periodic | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 2C | 6C | Dynamically Define Data Identifire | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 2E | 6E | Write Data By Identifire | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 3D | 7D | Write Memory By Address | O |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Stored Data | 14 | 54 | Clear Diagnostic Information | X |
* + Transmission +-------+-------+-----------------------------------------------+-------+
* | | 19 | 59 | Read DTC Information | X |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | I/O Control | 2F | 6F | Input Output Control By Identifire | X |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Remote | | | | |
* | Activation of | 31 | 71 | Routine Control | X |
* | Routine | | | | |
* +-------------------+-------+-------+-----------------------------------------------+-------+
* | Upload / | 34 | 74 | Request Download | O |
* + Download +-------+-------+-----------------------------------------------+-------+
* | | 35 | 75 | Request Upload | X |
* + +-------+-------+-----------------------------------------------+-------+
* | | 36 | 76 | Transfer Data | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 37 | 77 | Request Transfer Exit | O |
* + +-------+-------+-----------------------------------------------+-------+
* | | 38 | 78 | Request File Transfer | X |
* +-------------------+-------+-
- 1
- 2
- 3
前往页