⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 j1939pgn.h

📁 在Freescale16位单片机MC9s12dp256上移植了J1939源码和操作系统(ucOSII)。
💻 H
字号:
/******************************************************************************
*
* File Name:      J1939PGN.H
*
* Description:    Definition of user and system parameter groups
*                 
*
* Comments:       
*                 
*
* Version  Date         Author           Comments
* -------  ----------   --------------   ------------------------------
*     0.9    18.12.98    Ft               Create
*     1.0    02.03.99    Ft               user specific PGNs
*     1.1    28.04.99    Ft               C166CR and Tasking compiler
*     1.2    08.04.2001  Ma               added new PG's to check the developing
*                                         task of version 2.0
*     2.0    18.06.2001  Ma               new buffer concept and documentation
*                                         for doxygen
*     2.1    24.01.2002  Ma               changed the data sizes of the PG's
*     2.2    15.07.2003  Ma               changed datasize of basic PG structure
*     2.3    24.06.2004  Ma               changed demo application
*     2.4    28.06.2004  Ma               changed data size of fragmented PGs
*
* Copyright (c) 1998 - 2004 Vector Informatik GmbH
*****************************************************************************/
#ifndef _J1939PGN_H_
#define _J1939PGN_H_

/* [USER MODIFIED] */
/*! \brief User/Profile specific definition of J1939 PGNs
           User modification
*/

/*! \brief Definition of PG FE10's datalength */
#define PG_FE10_DATALEN   8
/*! \brief Received from HCM/ARC PROPRIATORY_24 */
struct VJ1939PGN_DATA_FE10
{
  unsigned char mData[PG_FE10_DATALEN];  /*!< no interpretation necessary */
};

/*! \brief Definition of PG FF17's datalength */
#define PG_FF17_DATALEN   8
/*! \brief Received from HCM/ARC PROPRIATORY_24 */
struct VJ1939PGN_DATA_FF17
{
  unsigned char mData[PG_FF17_DATALEN];  /*!< no interpretation necessary */
};

/*! \brief Definition of PG A800's datalength */
#define PG_A800_DATALEN   8
/*! \brief Received from HCM/ARC PROPRIATORY_24 */
struct VJ1939PGN_DATA_A800
{
  unsigned char mData[PG_A800_DATALEN];  /*!< no interpretation necessary */
};

/*! \brief Definition of PG FE30's datalength */
#define PG_FE30_DATALEN   50
/*! \brief PROPRIATORY_25 */
struct VJ1939PGN_DATA_FE30
{
 unsigned char mData[PG_FE30_DATALEN];   /*!< no interpretation necessary */
};

/*! \brief Definition of PG CC00's datalength */
#define PG_CC00_DATALEN   8
/*! \brief Received from ArmRestController (ARC) */
struct VJ1939PGN_DATA_CC00
{
  unsigned char mData[PG_CC00_DATALEN];  /*!< no interpretation necessary */
};
/*! \brief Definition of PG CB00's datalength */
#define PG_CB00_DATALEN   50
/*! \brief Received from ArmRestController (ARC) */
struct VJ1939PGN_DATA_CB00
{
  unsigned char mData[PG_CB00_DATALEN];  /*!< no interpretation necessary */
};

/*Application J1939 PG*/

#define PG_F004_DATALEN 8
typedef union {
  QWORD qwPG_F004; 
  struct{
    byte BIT0TO3_BYTE0       :4;
    byte BIT4TO7_BYTE0       :4;
    byte BYTE1                 ;
    byte BYTE2                 ;
    WORD BYTE3TO4              ;
    byte BYTE5                 ;
    WORD BYTE6TO7              ;
   }DATE;
  //struct{
    unsigned char mData[PG_F004_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_F004;
   
#define PG_FEEF_DATALEN 8
typedef union {
  QWORD qwPG_FEEF; 
  struct{
    byte BYTE0                 ;
    byte BYTE1                 ;
    byte BYTE2                 ;
    byte BYTE3                 ;
    WORD BYTE4TO5              ;
    byte BYTE6                 ;
    byte BYTE7                 ;
   }DATE;
  //struct{
    unsigned char mData[PG_FEEF_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FEEF;												

#define PG_FEEE_DATALEN 8
typedef union {
  QWORD qwPG_FEEE; 
  struct{
    byte BYTE0                 ;
    byte BYTE1                 ;
    WORD BYTE2TO3              ;
    WORD BYTE4TO5              ;
    byte BYTE6                 ;
    byte BYTE7                 ;
   }DATE;
  //struct{
    unsigned char mData[PG_FEEE_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FEEE;
   

#define PG_FEC0_DATALEN 8
typedef union {
  QWORD qwPG_FEC0; 
  struct{
    byte BYTE0                 ;
    WORD BYTE1TOBYTE2          ;
    byte BYTE3                 ;
    byte BYTE4                 ;
    byte BYTE5                 ;              
    WORD BYTE6TO7              ;
   }DATE;
  //struct{
    unsigned char mData[PG_FEC0_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FEC0; 
   
   
#define PG_FE6C_DATALEN 8
typedef union {
  QWORD qwPG_FFE6C; 
  struct{
    byte BIT0TO2_BYTE0       :3;
    byte BIT3TO5_BYTE0       :3;
    byte BIT6TO7_BYTE0       :2;
    byte BIT0TO3_BYTE1       :4;
    byte BIT4TO5_BYTE1       :2;
    byte BIT6TO7_BYTE1       :2;
    byte BIT0TO3_BYTE2       :4;
    byte BIT4TO5_BYTE2       :2;
    byte BIT6TO7_BYTE2       :2;
    byte BIT0TO1_BYTE3       :2;
    byte BIT2TO3_BYTE3       :2;
    byte BIT4TO5_BYTE3       :2;
    byte BIT6TO7_BYTE3       :2;
    WORD BYTE4TO5              ;
    WORD BYTE6TO7              ;
   }DATE;
  //struct{
    unsigned char mData[PG_FE6C_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FE6C;     


#define PG_FEE6_DATALEN 8
typedef union {
  QWORD qwPG_FEE6; 
  struct{
    byte BYTE0                 ;
    byte BYTE1                 ;
    byte BYTE2                 ;
    byte BYTE3                 ;
    byte BYTE4                 ;
    byte BYTE5                 ;
    byte BYTE6                 ;
    byte BYTE7                 ;
   }DATE;
  //struct{
    unsigned char mData[PG_FEE6_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FEE6;
   
   
#define PG_FEC1_DATALEN 8
typedef union {
  QWORD qwPG_FEC1; 
  struct{
    QBYTE BYTE0TOBYTE3         ;
    QBYTE BYTE4TOBYTE7         ;
   }DATE;
  //struct{
    unsigned char mData[PG_FEC1_DATALEN];
  // }MergedDate;
   }VJ1939PGN_DATA_FEC1;     
   
   
    
//----------------------------------------------------------   


   
/**************************************************************************/
/* Application MyCAN PG                                                   */
/**************************************************************************/
#define PG_FF09_DATALEN 8
typedef union {
  QWORD qwPG_FF09; 
  struct{
    WORD  BYTE0TOBYTE1         ;
    byte  BIT0TO1BYTE2         :2;
    byte  BIT2TO7BYTE2         :6;
    byte  BYTE3                ;
    QBYTE BYTE4TOBYTE7         ;
   }DATE;
  //struct{
    unsigned char mData[PG_FF09_DATALEN];
  // }MergedDate;
   }VMyPGN_DATA_FF09; 

#define PG_FF08_DATALEN 8
typedef union {
  QWORD qwPG_FF08; 
  struct{
    byte  BIT0TO1BYTE0         :2;
    byte  BIT2TO3BYTE0         :2;
    byte  BIT4TO5BYTE0         :2;
    byte  BIT6TO7BYTE0         :2; 
    byte  BIT0TO1BYTE1         :2;
    byte  BIT2TO3BYTE1         :2;
    byte  BIT4TO5BYTE1         :2;
    byte  BIT6TO7BYTE1         :2;
    byte  BIT0TO1BYTE2         :2;
    byte  BIT2TO3BYTE2         :2;
    byte  BIT4TO5BYTE2         :2;
    byte  BIT6TO7BYTE2         :2;
    byte  BIT0TO1BYTE3         :2;
    byte  BIT2TO7BYTE3         :6;
    QBYTE BYTE4TOBYTE7         ;
   }DATE;
  //struct{
    unsigned char mData[PG_FF08_DATALEN];
  // }MergedDate;
   }VMyPGN_DATA_FF08;

/*! \brief Private Definition of J1939 specific PGNs
           No user modification
           Handles                                                                    
           Flow Control, Requests, ...
*/
/*! \brief  Data struct for the Request PGN (00EA00) */
struct VJ1939PGN_DATA_EA00
{
  unsigned char mPGNlsb;   
  unsigned char mPGN;
  unsigned char mPGNmsb;
};

/*! \brief Data struct for the Acknowledgment (00E800) */
struct VJ1939PGN_DATA_E800
{
  unsigned char mAcknowledge;        /*!< 0 = positive ack, 1 = neg. ack. */
  unsigned char mByte2;              /*!< reserved by SAE, always 0xFF */
  unsigned char mByte3;
  unsigned char mByte4;
  unsigned char mByte5;
  unsigned char mPGNlsb;
  unsigned char mPGN;
  unsigned char mPGNmsb;
};  

/*! \brief Sub structures for the Transport Protocol Connection Management */
/*! \brief Data struct for the Transport Protocol Connection Management (00EB00) */
struct VJ1939PGN_DATA_EC00
{
  unsigned char mControl; /*!< 16=RTS, 17=CTS, 19=EoMAck, 32=BAM, 255=Abort */
  unsigned char mBytesLsb;
  unsigned char mBytesMsb;
  unsigned char mPackets;
  unsigned char mReserved;
  unsigned char mPGNlsb;
  unsigned char mPGN;
  unsigned char mPGNmsb;
};

/*! \brief Data struct for the Transport Protocol Data Transfer (00EB00) */
struct VJ1939PGN_DATA_EB00
{
  unsigned char mSequence;           /* Sequence Number */
  unsigned char mData[7];            /* Data bytes */
};

/*! \brief Data struct for the J1939 Device Name Bytes must be ordered in intel format */
struct VJ1939DeviceName
{
  unsigned char Name[8];               /*!< ECU name */
};

/*! \brief  Data struct for Address Claimed Message (00EE00) */
struct VJ1939PGN_DATA_EE00
{
  struct VJ1939DeviceName mName;       /*!< Device Name */
};

/*! \brief Data struct for Commanded Address Message (00FED8) */
struct VJ1939PGN_DATA_FED8
{
  struct VJ1939DeviceName mName;       /*!< Device Name */
  unsigned char mAddress;              /*!< New Address Assignment */
};

/*! \brief Definition of general PGN related structures                               */
typedef struct
{
  /*! \brief Buffer Information */
  void     *mData;                  /*!< Pointer to specific data struct */  
  unsigned short int mDataLength;   /*!< number of databytes */
  unsigned short int mTransRate;    /*!< Trans. rate in ms, only for cyclic */
  unsigned short int mTimer;        /*!< Timer in ms */
  unsigned char mEnable;            /*!< Enable PG */
  unsigned char mPGState;           /*!< Object used */
  /*! \brief PG Information */
  unsigned char mPDUF;              /*!< PDU Format */
  unsigned char mPDUS;              /*!< PG Number */
  /*! \brief unsigned char mPage;*/ /*!< Page, always 0 */
  unsigned char mSource;            /*!< PG source */
  unsigned char mPriority;          /*!< 3Bit Priority */
  unsigned char mTransType;         /*!< TT_CYCLIC, TT_ASYNC */
} VJ1939PGN;

#endif /* _J1939PGN_H_ */

/*! 
  \file
  \brief Module Header to define all used PGs (user/system) and the general
         PG structure format of the stack
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -