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

📄 artx_can.h

📁 can bus 源代码
💻 H
字号:
/*----------------------------------------------------------------------------
 *      A R T X  -  C A N   D r i v e r  -  G e n e r i c   L a y e r 
 *----------------------------------------------------------------------------
 *      Name:    ARTX_CAN.h
 *      Purpose: Header for CAN Generic Driver
 *      Rev.:    V0.20 / october-14-2005
 *----------------------------------------------------------------------------
 *      This code is part of the ARTX-ARM kernel package of Keil Software.
 *      Copyright (c) 2004-2005 Keil Software. All rights reserved.
 *---------------------------------------------------------------------------*/

#include <ARTX.h>                     /* ARTX kernel functions & defines     */
#include "CAN_Cfg.h"                  /* CAN Configuration                   */


#ifndef _ARTX_CAN_H
#define _ARTX_CAN_H

#define			CAN_TEST_STATUS_TO_UART0		1
#define			CAN_TEST_REG_VALUE_TO_UART0	1
#define			CAN_REG_USE_POINT					0

/* Definition of memory pool type, for CAN messages                          */
#define CAN_msgpool_declare(name,cnt)     U32 name[cnt*(sizeof(CAN_msg)/4) + 3]

/* Definition of mailbox array, for used controllers                         */
#define mbx_arr_declare(name,arr_num,cnt) U32 name[arr_num][4 + cnt]

/* CAN message object structure                                              */
typedef struct  {
  U32 id;                 /* 29 bit identifier                               */
  U8  data[8];            /* Data field                                      */
  U8  len;                /* Length of data field in bytes                   */
  U8  ch;                 /* Object channel                                  */
  U8  format;             /* 0 - STANDARD, 1- EXTENDED IDENTIFIER            */
  U8  type;               /* 0 - DATA FRAME, 1 - REMOTE FRAME                */
}  CAN_msg;

/* Externaly declared memory pool for CAN messages, both transmit and receive*/
extern U32 CAN_mpool[CAN_CTRL_MAX_NUM*(CAN_No_SendObjects+CAN_No_ReceiveObjects)*(sizeof(CAN_msg)/4) + 3];

/* Externaly declared mailbox, for CAN transmit messages                     */
extern U32 MBX_tx_ctrl[CAN_CTRL_MAX_NUM][4 + CAN_No_SendObjects];

/* Externaly declared mailbox, for CAN receive messages                      */
extern U32 MBX_rx_ctrl[CAN_CTRL_MAX_NUM][4 + CAN_No_ReceiveObjects];

/* Externaly declared flags signaling writing to CAN hardware                */
extern U8 wr_to_CAN_hw[CAN_CTRL_MAX_NUM];

/* Symbolic names for formats of CAN message                                 */
typedef enum {STANDARD_FORMAT = 0, EXTENDED_FORMAT} CAN_FORMAT;

/* Symbolic names for type of CAN message                                    */
typedef enum {DATA_FRAME = 0, REMOTE_FRAME}         CAN_FRAME;

/* Functions defined in module CAN.c                                         */
CAN_ERROR CAN_init      (U32 ctrl, U32 baudrate);
CAN_ERROR CAN_start     (U32 ctrl);
CAN_ERROR CAN_send      (U32 ctrl, CAN_msg *msg, U16 timeout);
CAN_ERROR CAN_request   (U32 ctrl, CAN_msg *msg, U16 timeout);
CAN_ERROR CAN_set       (U32 ctrl, CAN_msg *msg, U16 timeout);
CAN_ERROR CAN_receive   (U32 ctrl, CAN_msg *msg, U16 timeout);
CAN_ERROR CAN_rx_object (U32 ctrl, U32 ch, U32 id, CAN_FORMAT filter_type);
CAN_ERROR CAN_tx_object (U32 ctrl, U32 ch, CAN_FORMAT filter_type);


void			GetCanRegValue(void);

#endif /* _ARTX_CAN_H */


/*----------------------------------------------------------------------------
 * end of file
 *---------------------------------------------------------------------------*/

⌨️ 快捷键说明

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