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

📄 j1939cfg.h

📁 在Freescale16位单片机MC9s12dp256上移植了J1939源码和操作系统(ucOSII)。
💻 H
字号:
/******************************************************************************
*
* File Name:      J1939CFG.H
*
* Description:    Configuration of the protocol stack
*                 
*
* Comments:       User adaption required
*                 
*
* Version  Date         Author           Comments
* -------  ----------   --------------   ------------------------------
*     0.9    18.12.98   Ft               Create
*     1.0    02.03.99   Ft               Configuration options
*     1.1    08.06.2001 Ma               changed configuration for developing
*                                        version 2.0
*     1.2    11.06.2001 Ma               implement a new TX state machine
*     1.2    24.01.2002 Ma               changed confguration # of RX and TX PG's
*                                        and array sizes!
*     1.3    15.07.2003 Ma               added define for TP size limitation
*     1.4    24.06.2004 Ma               changed demo application
*
* Copyright (c) 1998 - 2004 Vector Informatik GmbH
*****************************************************************************/
#ifndef _J1939CFG_H_
#define _J1939CFG_H_

/*****************************************************************************/
/* Some application specific definitions                                     */
/*****************************************************************************/
#define ARC_ADDR 1          /*!< Device address of ARC */



#ifdef DEBUG_TIMEANALYZE
 /* #define DEBUG_TIMEANALYZE_MAINLOOP */  /*!< Measure time used by main loop */
 #define DEBUG_TIMEANALYZE_CANISR          /*!< Measure time useb by interrupt service */

 #ifdef _KL_C515_
  #include "main.h"
  #define DB_TIME_PEEK      P3 |= 0x02; \
                            P3 &= 0xfd
  #define DEBUG_TIMER_BEGIN P3 |= 0x02 /*!< Set Port3 Pin TX to high */
  #define DEBUG_TIMER_END   P3 &= 0xfd /*!< Set Port3 Pin TX to low */
 #elif _TSK_C166_
  #error not implemented
 #endif
#else
 #define DB_TIME_PEEK
 #define DEBUG_TIMER_BEGIN
 #define DEBUG_TIMER_END
#endif


#define NR_OF_TP_CH 2 /*!< Max. no. of simultanious opend transport channels */

/*! \brief Define for size limitation of the TP's BAM and CMDT */
#define MAX_TP_DATA_LENGTH    1785

/*! \brief Defines some timeouts for the protocol 
*/
#define ADDRESSCLAIMTIMEOUT 250 /*!< 250ms delay after AddressClaimed message */
/*! \brief Defines for J1939 standard Addresses */
#define J1939GLOBALADDRESS 255   /*!< the J1939 global address */
#define J1939NULLADDRESS 254     /*!< the J1939 invalid or NULL address */

/*! \brief Defines the transmission type */
#define TT_ASYNC 0     /*!< tag for asynchronous PGs */
#define TT_CYCLIC 1    /*!< tag for cyclic PGs */ 
#define TT_BAM 2       /*!< tag for the BAM transport protocol */
#define TT_CMDT 3      /*!< tag for the CMDT transport protocol */

/*! \brief Define the TX statemachine states */
#define PG_TX_FREE     0      /*!< buffer free, no transmission stands on */
#define PG_TX_REQ      1      /*!< a TX PG is entered into buffer but controler isn't activated */
#define PG_TX_XMT      2      /*!< stands on in the controler and trasmission is active */
#define PG_TX_TX       3      /*!< the TX interrupt occurs - message was successful sent */

/*! \brief Define the RX statemachine states */
#define PG_RX_FREE     0      /*!< no receiption has occured */
#define PG_RX_FULL     1      /*!< we have received a PG */

/*! \brief Defines for the DeviceName */
#define ARBITRARY_ADDRESS_CAPABLE 0x01 /*!< Selfe arbitrary? (0=no, 1=yes) (1 bit) */
#define INDUSTRY_GROUP            0x01 /*!< Industry group (3 bit) */
#define VEHICLE_SYSTEM_INSTANCE   0x01 /*!< Vehicle System instance (4 bit) */
#define VEHICLE_SYSTEM            0x01 /*!< Vehicle System (7 bit) */
#define FUNCTION                  0x01 /*!< Function (8 bit) */
#define FUNCTION_INSTANCE         0x01 /*!< Function Instance (5 bit) */
#define ECU_INSTANCE              0x01 /*!< ECU Instance (3 bit) */
#define MANUFACT_CODE_MSB         0x01 /*!<              (8 bit) */
#define MANUFACT_CODE_LSB         0x01 /*!< Manufacturer code (3 bit) */
#define IDENTITY_NUMBER_MSB       0x01 /*!<                 (5 bit) */
#define IDENTITY_NUMBER_2SB       0x01 /*!<                 (8 bit) */
#define IDENTITY_NUMBER_LSB       0x01 /*!< Identity number (8 bit) */

/*! \brief Return values of the callback function J1939AppRequestIndication */
#define REQ_SENDNOTHING  0 /*!< send no acknowledge and no PG */
#define REQ_SENDPGN      1 /*!< send requested PG */
#define REQ_SENDNACK     2 /*!< send not acknowledge */
#define REQ_SENDPACK     3 /*!< send acknowledge */

/* [USER_MODIFIED] */
/*! \brief Note the first RX or TX is the global (free) buffer */
#define NR_OF_RX_PG 17      /*!< Number of receive parameter groups */
#define NR_OF_TX_PG 10      /*!< Number of transmit parameter groups */

/*#define NO_OF_USER_CAN_BUFFERS (NR_OF_RX_PG - (RX_PGN_USER)) + (NR_OF_TX_PG - (TX_PGN_USER))*/ /* RX and TX buffers */

/*! \brief Define the buffer for the RxPGs
           System defined RX PGNs 
*/
#define RX_PGN_ADDRESS_CLAIMED 0   /*!< the RX address claim buffer */
#define RX_PGN_REQ             1   /*!< the RX request buffer */
#define RX_PGN_TPCM            2   /*!< the RX TPCM buffer */
#define RX_PGN_TPDT            3   /*!< the RX TPDT buffer */
#define RX_PGN_COMMAND_ADDRESS 4   /*!< the RX commanded address buffer */
/*! \brief User defined RX PGNs */
#define RX_PGN_USER 5       /*!< NOTE: RX_PGN_USER and the first user PG are always the same */
/* [USER_MODIFIED] */
#define RX_PGN_FE10 5     /*!<0 Propriatory_24 */
#define RX_PGN_FE30 6     /*!<0 Propriatory_24 */
#define RX_PGN_CC00 7     /*!<0 Propriatory_24 */
#define RX_PGN_CB00 8     /*!<0 Propriatory_24 */
#define RX_PGN_FF17 9

#define RX_PGN_F004 10
#define RX_PGN_FEEE 11
#define RX_PGN_FEEF 12
#define RX_PGN_FEC0 13
#define RX_PGN_FE6C 14
#define RX_PGN_FEE6 15
#define RX_PGN_FEC1 16



/* \brief Define the buffer for the TxPGs
          System defined TX PGNs 
*/
#define TX_PGN_ADDRESS_CLAIMED 0   /*!< the TX address claim buffer */
#define TX_PGN_ACK   1             /*!< the TX Acknowledge buffer */
/*#define TX_PGN_REQ   2*/
#define TX_PGN_TPCM  2             /*!< the TX TPCM buffer */
#define TX_PGN_TPDT  3             /*!< the TX TPDT buffer */
/*! \brief User defined TX PGNs */

#define TX_PGN_USER  4 /*!< NOTE: TX_PGN_USER and the first user PG are always the same */
/* [USER_MODIFIED] */
  /*FOR DEMO*/
#define TX_PGN_FE10  4 /*!< Propriatory_25 */
#define TX_PGN_FE30  5
#define TX_PGN_CC00  6
#define TX_PGN_CB00  7
#define TX_PGN_FF17  8

/*Application J1939PGN*/


#endif /* _J1939CFG_H_ */

/*!
  \file
  \brief Config module header for user and system PG's 
*/

⌨️ 快捷键说明

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