|
@@ -3,7 +3,7 @@
|
|
|
* @Date : 2021-10-14 09:27:15
|
|
|
* @Version : V3.0
|
|
|
* @LastEditors : ChenJie
|
|
|
- * @LastEditTime : 2021-10-22 14:27:36
|
|
|
+ * @LastEditTime : 2021-10-22 15:15:32
|
|
|
* @Description : 应用层函数定义区,UTF-8
|
|
|
* @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\src\AppFunc.c
|
|
|
*/
|
|
@@ -2269,9 +2269,23 @@ void UDS_Service(CAN_Msg_Type *CanRxMsg)
|
|
|
}
|
|
|
else if (UDSSubService[i] == 0x0E) //read ram data 22 0E xx xx xx xx XX XX
|
|
|
{
|
|
|
- UINT32 *addr = (UINT32 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
UINT16 size = CanRxMsg[i].Data[7] | (CanRxMsg[i].Data[6] << 8);
|
|
|
- UINT32 retData = *(addr);
|
|
|
+ UINT32 retData = 0xFFFFFFFF;
|
|
|
+ if (size == 1)
|
|
|
+ {
|
|
|
+ UINT8 *addr = (UINT8 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
+ retData = *(addr);
|
|
|
+ }
|
|
|
+ else if (size == 2)
|
|
|
+ {
|
|
|
+ UINT16 *addr = (UINT16 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
+ retData = *(addr);
|
|
|
+ }
|
|
|
+ else if (size == 4)
|
|
|
+ {
|
|
|
+ UINT32 *addr = (UINT32 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
+ retData = *(addr);
|
|
|
+ }
|
|
|
UDSPositiveAnswer(8, i, retData); // 08 78 22 0E xx xx xx xx
|
|
|
}
|
|
|
else
|
|
@@ -2349,10 +2363,10 @@ void UDS_Service(CAN_Msg_Type *CanRxMsg)
|
|
|
}
|
|
|
else if (UDSSubService[i] == 0x0E) //write ram data 2E 0E xx xx xx xx XX XX
|
|
|
{
|
|
|
- UINT32 *addr = (UINT32 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
- UINT16 data = CanRxMsg[i].Data[7] | (CanRxMsg[i].Data[6] << 8);
|
|
|
+ UINT8 *addr = (UINT8 *)(CanRxMsg[i].Data[5] | (CanRxMsg[i].Data[4] << 8) | (CanRxMsg[i].Data[3] << 16) | (CanRxMsg[i].Data[2] << 24));
|
|
|
+ UINT8 data = CanRxMsg[i].Data[7];
|
|
|
*(addr) = data;
|
|
|
- UINT32 retData = *(addr);
|
|
|
+ UINT8 retData = *(addr);
|
|
|
UDSPositiveAnswer(8, i, retData); // 08 78 2E 0E xx xx xx xx
|
|
|
}
|
|
|
else
|