46 lines
2.0 KiB
C
46 lines
2.0 KiB
C
#ifndef IVEC_ECU_UART_H
|
|
#define IVEC_ECU_UART_H
|
|
|
|
//#include "ivec_mcal_uart.h"
|
|
#include "../Core/Include/ivec_mcal_uart.h"
|
|
#include "../ivec_ECU/ivec_ecu_common/inc/ivec_ecu_common.h"
|
|
//#include "ivec_ecu_common.h"
|
|
|
|
|
|
#include "stdint.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define MAX_PACKET_LENGTH 32/*!<Maximum length of packet that can be received*/
|
|
|
|
#define PKT_HEADER 7/*!<Protocol headers*/
|
|
#define PKT_HEADER_FOOTER 9/*!<Protocol headers+footers*/
|
|
|
|
#endif
|
|
|
|
#define GET_PACKET_SIZE(x) (x + PKT_HEADER_FOOTER)/*!<Complete packet size*/
|
|
|
|
#define PACKET_SUCCESS 0/*!<Success*/
|
|
#define PACKET_FAIL -1/*!<Error*/
|
|
|
|
/*Private Variables*/
|
|
typedef int PacketRetCode_t;/*SERVICE_SUCESS or SERVICE_FAIL*/
|
|
|
|
|
|
/*===========================================================================
|
|
* Functions declaration
|
|
===========================================================================*/
|
|
IVEC_EcuCommonErr_e xECU_UARTInit(McalUartHandle_s* prvUartHandle);
|
|
IVEC_EcuCommonErr_e xECU_UARTDeInit(McalUartHandle_s *prvUartHandle);
|
|
IVEC_EcuCommonErr_e xECU_UARTTransmit(McalUartHandle_s *prvUartHandle, uint8_t* pucBuffer, uint16_t len);
|
|
//Uart_Typedef_e xUartWrite(Uart_PortHandle_s *xportHandle, uint8_t* pucBuffer, uint16_t len, uint16_t timeout);
|
|
IVEC_EcuCommonErr_e xECU_UARTGetData(McalUartHandle_s *prvUartHandle, uint8_t* pucBuffer, uint16_t len, uint16_t timeout);
|
|
//Uart_Typedef_e xUartReceive(Uart_PortHandle_s *xportHandle, uint8_t* pucBuffer, uint16_t len, uint16_t timeout);
|
|
|
|
PacketRetCode_t xECU_FormatUartPacket(McalUartHandle_s *prvUartHandle, uint8_t* pucData, uint8_t ucDlc, uint32_t ulId);
|
|
PacketRetCode_t xECU_ReadCANDataLenOverUART(McalUartHandle_s *prvUartHandle, uint8_t* pucBuf, uint32_t *ulId);
|
|
|
|
PacketRetCode_t xECU_ReadCANDataOverUART(McalUartHandle_s* prvUartHandle, uint8_t* pucBuf, uint32_t *ulId);
|
|
int vECU_InitiateUartToCanTransmit(McalUartHandle_s* prvUartHandle, uint32_t id, uint8_t *pucData, uint8_t ucLen);
|