]> rtime.felk.cvut.cz Git - arc.git/blobdiff - communication/J1939Tp/J1939Tp_Internal.h
starting to rewrite structure because I cant identify channels for rx indication...
[arc.git] / communication / J1939Tp / J1939Tp_Internal.h
index bca3bebe1acfd99c6df1eae019ac7c6b9f4353b7..f489d8ef8f2201ca5a5da4c08512e2e59d67a6a4 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef J1939TP_INTERNAL_H_\r
 #define J1939TP_INTERNAL_H_\r
 #include "J1939Tp_Internal_Packets.h"\r
+#include "J1939Tp_ConfigTypes.h"\r
+#include "ComStack_Types.h"\r
 #define PGN_BYTE_COUNT                 3\r
 /** Service Ids */\r
 #define J1939TP_TRANSMIT_ID    0x05\r
@@ -40,87 +42,48 @@ typedef enum {
        J1939TP_EXPIRED,\r
        J1939TP_NOT_EXPIRED\r
 } J1939Tp_Internal_TimerStatusType;\r
-typedef uint8 J1939Tp_Internal_ControlByteType;\r
-typedef uint32 J1939Tp_Internal_PgnType;\r
-typedef uint32 J1939Tp_Internal_DtPayloadSizeType;\r
+\r
 \r
 typedef struct {\r
        J1939Tp_Internal_GlobalStateType State;\r
 } J1939Tp_Internal_GlobalStateInfoType;\r
 \r
-typedef enum {\r
-       J1939TP_TX_IDLE,\r
-       J1939TP_TX_WAIT_RTS_CANIF_CONFIRM,\r
-       J1939TP_TX_WAIT_DIRECT_SEND_CANIF_CONFIRM,\r
-       J1939TP_TX_WAITING_FOR_CTS,\r
-       J1939TP_TX_WAIT_DT_CANIF_CONFIRM,\r
-       J1939TP_TX_WAITING_FOR_END_OF_MSG_ACK\r
-} J1939Tp_Internal_TxPgStateType;\r
-typedef enum {\r
-       J1939TP_RX_IDLE,\r
-       J1939TP_RX_WAIT_CTS_CANIF_CONFIRM,\r
-       J1939TP_RX_RECEIVING_DT,\r
-       J1939TP_RX_WAIT_ENDOFMSGACK_CANIF_CONFIRM,\r
-} J1939Tp_Internal_RxPgStateType;\r
-typedef struct {\r
-       uint32 Timer;\r
-       uint32 TimerExpire;\r
-} J1939Tp_Internal_TimerType;\r
 \r
-typedef struct {\r
-       J1939Tp_Internal_RxPgStateType State;\r
-       J1939Tp_Internal_TimerType TimerInfo;\r
-       uint8 TotalReceivedDtCount;\r
-       uint8 TotalDtToReceiveCount;\r
-       J1939Tp_Internal_DtPayloadSizeType TotalMessageSize;\r
-}J1939Tp_Internal_RxPgInfo;\r
 \r
-typedef struct {\r
-       J1939Tp_Internal_TxPgStateType State;\r
-       J1939Tp_Internal_TimerType TimerInfo;\r
-       uint8 SentDtCount;\r
-       uint8 DtToSendBeforeCtsCount;\r
-       J1939Tp_Internal_DtPayloadSizeType TotalMessageSize;\r
-       uint8 TotalSentDtCount;\r
-       uint16 TotalBytesSent;\r
-       PduIdType PduRPdu;\r
-}J1939Tp_Internal_TxPgInfo;\r
 \r
-typedef struct {\r
-       J1939Tp_Internal_TxPgInfo* Tx;\r
-       J1939Tp_Internal_RxPgInfo* Rx;\r
-       const J1939Tp_PgType* PgConfPtr;\r
-} J1939Tp_Internal_PgStateInfoType;\r
-\r
-static void J1939Tp_Internal_SendRts(J1939Tp_Internal_PgStateInfoType* TxPgState, const PduInfoType* TxInfoPtr);\r
-static void inline J1939Tp_Internal_SendDt(J1939Tp_Internal_PgStateInfoType* PgState);\r
-static inline void J1939Tp_Internal_SendCts(J1939Tp_Internal_PgStateInfoType* TxPgState, PduInfoType* RtsPduInfoPtr);\r
-static void inline J1939Tp_Internal_SendEndOfMsgAck(J1939Tp_Internal_PgStateInfoType* PgState);\r
-static inline void J1939Tp_Internal_SendConnectionAbort(PduIdType CmPdu, J1939Tp_PgnType Pgn);\r
-static void inline J1939Tp_Internal_TxSessionStartTimer(J1939Tp_Internal_TxPgInfo* Tx,uint16 TimerExpire);\r
-static void inline J1939Tp_Internal_RxSessionStartTimer(J1939Tp_Internal_RxPgInfo* Rx,uint16 TimerExpire);\r
-static inline const J1939Tp_PgType* J1939Tp_Internal_ConfGetPg(PduIdType pduId);\r
-static inline boolean J1939Tp_Internal_WaitForCts(J1939Tp_Internal_TxPgInfo* TxPgState);\r
-static inline boolean J1939Tp_Internal_WaitForEndOfMsgAck(J1939Tp_Internal_TxPgInfo* TxPgState);\r
-\r
-static inline J1939Tp_Internal_PgStateInfoType* J1939Tp_Internal_GetPg(PduIdType txPduId);\r
-static inline const J1939Tp_ChannelType* J1939Tp_Internal_ConfGetTxChannel(PduIdType txPduId);\r
-static inline boolean J1939Tp_Internal_CheckValidEndOfMsgAck(J1939Tp_Internal_PgStateInfoType* pgState, PduInfoType* PduInfoPtr);\r
-static inline J1939Tp_Internal_TimerStatusType J1939Tp_Internal_IncAndCheckTimer(J1939Tp_Internal_TimerType* Timer);\r
-static uint8 J1939Tp_Internal_GetPf(uint32 pgn);\r
-static J1939Tp_ProtocolType J1939Tp_Internal_GetProtocol(uint8 pf);\r
-static inline boolean J1939Tp_Internal_CheckValidCts(PduInfoType* PduInfoPtr,uint8* NumPackets,uint8* NextPacket);\r
-\r
-static inline void J1939Tp_Internal_ResetTimer(J1939Tp_Internal_PgStateInfoType* pgState);\r
-static inline void J1939Tp_Internal_ReportError(uint8 ApiId, uint8 ErrorId);\r
-static void inline J1939Tp_Internal_RxIndication_TxChannel(PduIdType RxPduId, PduInfoType* PduInfoPtr);\r
-static void inline J1939Tp_Internal_RxIndication_RxChannel(PduIdType RxPduId, PduInfoType* PduInfoPtr);\r
-static Std_ReturnType inline J1939Tp_Internal_ReceiveRts(PduIdType NSduId, PduInfoType* PduInfoPtr);\r
+typedef uint8 J1939Tp_Internal_ControlByteType;\r
 \r
-static Std_ReturnType inline J1939Tp_Internal_ReceiveDt(PduIdType NSduId, PduInfoType* PduInfoPtr);\r
-static inline void J1939Tp_Internal_SetPgn(uint8* PgnBytes,J1939Tp_PgnType pgn );\r
+\r
+\r
+static inline Std_ReturnType J1939Tp_Internal_ValidatePacketType(J1939Tp_RxPduInfoType* RxPduInfo);\r
+\r
+static inline void J1939Tp_Internal_RxIndication_Dt(PduInfoType* PduInfoPtr, J1939Tp_ChannelType* Channel);\r
+static inline void J1939Tp_Internal_RxIndication_Cm(PduInfoType* PduInfoPtr, J1939Tp_ChannelType* Channel);\r
+static inline void J1939Tp_Internal_RxIndication_ReverseCm(PduInfoType* PduInfoPtr, J1939Tp_ChannelType* Channel);\r
+Std_ReturnType J1939Tp_ChangeParameterRequest(PduIdType SduId, TPParameterType Parameter, uint16 value);\r
+static inline void J1939Tp_Internal_TxConfirmation_RxChannel(J1939Tp_RxPduInfoType RxPdu);\r
+static inline boolean J1939Tp_Internal_IsDtPacketAlreadySent(uint8 nextPacket, uint8 totalPacketsSent);\r
+static inline Std_ReturnType J1939Tp_Internal_GetRxPduInfo(PduIdType RxPdu,J1939Tp_RxPduInfoType* RxPduInfo);\r
+static inline Std_ReturnType J1939Tp_Internal_GetPgFromPgn(const J1939Tp_ChannelType* channel, const J1939Tp_Internal_PgnType Pgn, J1939Tp_PgType* Pg);\r
+static inline boolean J1939Tp_Internal_IsLastDt(J1939Tp_Internal_RxChannelInfoType* rxPgInfo);\r
+static inline void J1939Tp_Internal_TxConfirmation_TxChannel(J1939Tp_RxPduInfoType* RxPduInfo);\r
+/** @req J1939TP0096 */\r
+Std_ReturnType J1939Tp_Transmit(PduIdType TxSduId, const PduInfoType* TxInfoPtr);\r
 static inline uint16 J1939Tp_Internal_GetRtsMessageSize(PduInfoType* pduInfo);\r
-static inline void J1939Tp_Internal_TxConfirmation_TxChannel(PduIdType NSduId);\r
-static inline Std_ReturnType J1939Tp_Internal_GetCmControlByte(PduInfoType* pduInfo, J1939Tp_Internal_ControlByteType* controlByte);\r
-static inline void J1939Tp_Internal_TxConfirmation_RxChannel(PduIdType NSduId);\r
+static inline boolean J1939Tp_Internal_WaitForCts(J1939Tp_Internal_TxChannelInfoType* TxChannelState);\r
+static inline boolean J1939Tp_Internal_WaitForEndOfMsgAck(J1939Tp_Internal_TxChannelInfoType* TxPgState);\r
+static inline Std_ReturnType J1939Tp_Internal_ConfGetPg(PduIdType NSduId, J1939Tp_PgType* Pg);\r
+static inline J1939Tp_Internal_TimerStatusType J1939Tp_Internal_IncAndCheckTimer(J1939Tp_Internal_TimerType* TimerInfo);\r
+\r
+static inline void J1939Tp_Internal_SendDt(J1939Tp_ChannelType* Channel);\r
+static inline void J1939Tp_Internal_SendRts(J1939Tp_ChannelType* Channel, const PduInfoType* TxInfoPtr);\r
+static inline void J1939Tp_Internal_SendEndOfMsgAck(J1939Tp_ChannelType* Channel);\r
+static inline void J1939Tp_Internal_SendCts(J1939Tp_ChannelType* Channel, PduInfoType* RtsPduInfoPtr);\r
+static inline void J1939Tp_Internal_SendConnectionAbort(PduIdType CmNPdu, J1939Tp_PgnType Pgn);\r
+static inline void J1939Tp_Internal_TxSessionStartTimer(J1939Tp_Internal_TxChannelInfoType* Tx,uint16 TimerExpire);\r
+static inline void J1939Tp_Internal_RxSessionStartTimer(J1939Tp_Internal_RxChannelInfoType* Rx,uint16 TimerExpire);\r
+static inline void J1939Tp_Internal_SetPgn(uint8* PgnBytes,J1939Tp_PgnType pgn );\r
+static inline J1939Tp_PgnType J1939Tp_Internal_GetPgn(uint8* PgnBytes);\r
+\r
+static inline void J1939Tp_Internal_ReportError(uint8 ApiId, uint8 ErrorId);\r
 #endif\r