77 lines
2.6 KiB
C
77 lines
2.6 KiB
C
/*
|
|
* Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD
|
|
* All rights reserved.
|
|
*
|
|
* Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use
|
|
* exclusively with CVA's microcontroller products. This file can be freely
|
|
* distributed within development tools that are supporting such microcontroller
|
|
* products.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
* CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
|
|
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
* the includes
|
|
******************************************************************************/
|
|
|
|
#include "uds_service14.h"
|
|
#include "uds_dtc.h"
|
|
|
|
/*******************************************************************************
|
|
* the defines
|
|
******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* the typedefs
|
|
******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* the globals
|
|
******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* the constants
|
|
******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* the functions
|
|
******************************************************************************/
|
|
|
|
void UdsService14_ClearDiagInfo(UdsType *obj, const uint8_t msgBuf[], uint16_t msgLen)
|
|
{
|
|
uint32_t dtcGroup = 0;
|
|
uint8_t rspBuffer[8] = {0};
|
|
|
|
if(msgLen != obj->seviceTable[obj->curServiceIdx].minLen)
|
|
{
|
|
Uds_NegativeResponse(obj, 0x14, NRC_INVALID_MESSAGE_LENGTH_OR_FORMAT);
|
|
return;
|
|
}
|
|
|
|
dtcGroup |= ((uint32_t)msgBuf[1]) << 16;
|
|
dtcGroup |= ((uint32_t)msgBuf[2]) << 8;
|
|
dtcGroup |= ((uint32_t)msgBuf[3]) << 0;
|
|
|
|
rspBuffer[0] = UDS_GET_POSITIVE_RSP(0x14);
|
|
|
|
switch(dtcGroup)
|
|
{
|
|
case EMISSION_SYSTEM_GROUP:
|
|
case SAFETY_SYSTEM_GROUP:
|
|
case ALL_FUNC_SYSTEM_GROUP:
|
|
Uds_ClearDtcByGroup(dtcGroup);
|
|
Uds_PositiveResponse(obj, rspBuffer, 1);
|
|
break;
|
|
default:
|
|
Uds_NegativeResponse(obj, 0x14, NRC_REQUEST_OUT_OF_RANGE);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|