• 大小: 63KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-13
  • 语言: C/C++
  • 标签: CAN总线  驱动程序  

资源简介

用标准c语言编写的can总线源程序.包含sja1000,82527等芯片的源程序.-standard language prepared by the bus can source. Included sja1000, 82527 chip of the source

资源截图

代码片段和文件信息

/* canBoard.c - implementation of CAN Board routines */

/* Copyright 2001 Wind River Systems Inc. */

/* 
modification history 
--------------------
09nov01dnb modified for integration into Tornado
12jul01jac written

*/

/* 

DEscriptION
implementation of CAN Board routines

*/

/* includes */
#include 
#include 
#include 
#include 
#include 
#include 
#include 


/* global variables */

STATUS (*pfn_esd_can_pc104_200_establishlinks)(struct WNCAN_Device *pDev);
void (*pfn_esd_can_pc104_200_close)(struct WNCAN_Device *pDev);
struct WNCAN_Device *(*pfn_esd_can_pc104_200_open)(UINT brdNdx UINT ctrlNdx);

STATUS (*pfn_esd_can_pci_200_establishlinks)(struct WNCAN_Device *pDev);
void   (*pfn_esd_can_pci_200_close)(struct WNCAN_Device *pDev);
struct WNCAN_Device *(*pfn_esd_can_pci_200_open)(UINT brdNdx UINT ctrlNdx);

STATUS (*pfn_msmcan_pc104_establishlinks)(struct WNCAN_Device *pDev);
void   (*pfn_msmcan_pc104_close)(struct WNCAN_Device *pDev);
struct WNCAN_Device *(*pfn_msmcan_pc104_open)(UINT brdNdx);

STATUS (*pfn_ppc5xxCAN_establishlinks)(struct WNCAN_Device *pDev);
void   (*pfn_ppc5xxCAN_close)(struct WNCAN_Device *pDev);
struct WNCAN_Device *(*pfn_ppc5xxCAN_open)(UINT ctrlNdx);


STATUS (*pfn_pxa250_can_establishlinks)(struct WNCAN_Device *pDev);
void   (*pfn_pxa250_can_close)(void);
struct WNCAN_Device *(*pfn_pxa250_can_open)(void);


/************************************************************************
*
* WNCAN_Board_establishlinks - connect the function pointers in the
* board structure to the appropriate routines
*
*
* RETURNS: OK or ERROR
*   
* ERRNO: S_can_unknown_board
*
*/
STATUS WNCAN_Board_establishlinks

    struct WNCAN_Device *pDev
    WNCAN_BoardType brdType

{
    STATUS retCode = ERROR;
    
    switch(brdType)
    {
        case WNCAN_ESD_PC104_200:
            if(pfn_esd_can_pc104_200_establishlinks)
                retCode = pfn_esd_can_pc104_200_establishlinks(pDev);
            break;
        case WNCAN_ESD_PCI_200:
            if(pfn_esd_can_pci_200_establishlinks)
                retCode = pfn_esd_can_pci_200_establishlinks(pDev);
            break;
        case WNCAN_MSMCAN:
            if(pfn_msmcan_pc104_establishlinks)
                retCode = pfn_msmcan_pc104_establishlinks(pDev);
            break;

case WNCAN_PPC5XX:
            if(pfn_ppc5xxCAN_establishlinks)
                retCode = pfn_ppc5xxCAN_establishlinks(pDev);
            break;

    case WNCAN_DAYTONA:
            if (pfn_pxa250_can_establishlinks)
                retCode = pfn_pxa250_can_establishlinks(pDev);
            break;

        default:
            errnoSet(S_can_unknown_board);
            retCode = ERROR;
            break; 
    }
    return retCode;
}

/************************************************************************
*
* WNCAN_Board_Open - attempt to open specified board
*
* RETURNS: point to device structure or 0 on error

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2004-08-05 22:55  CAN

     文件      46384  2002-10-26 07:24  CAN\can_api.c

     文件       5569  2002-09-26 06:26  CAN\canBoard.c

     文件       1948  2002-09-26 06:26  CAN\canController.c

     文件      11773  2002-10-26 07:24  CAN\esd_pc104_200.c

     文件       7176  2002-10-26 07:06  CAN\esd_pci_200.c

     文件      70433  2002-10-26 07:24  CAN\i82527.c

     文件        627  2002-10-26 07:24  CAN\Makefile

     文件       6834  2002-10-17 08:09  CAN\msmcan.c

     文件       7594  2002-09-26 06:26  CAN\ppc5xxCAN.c

     文件      56667  2002-10-26 07:24  CAN\sja1000.c

     文件      79306  2002-11-06 07:54  CAN\toucan.c

     文件      16614  2002-10-26 07:24  CAN\wnCAN.c

----------- ---------  ---------- -----  ----

               311143                    14


评论

共有 条评论