98 lines
2.8 KiB
C
98 lines
2.8 KiB
C
/* mpc5121eCan.h - definitions for MPC5121E based CAN controller */
|
|
|
|
/*
|
|
* Copyright (c) 2008 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01a,01dec08,x_f written
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
This file contains definitions used only in mpc5121eCan.c
|
|
and mpc5121eCan_cfg.c
|
|
*/
|
|
|
|
#ifndef _MPC5121E_CAN_H_
|
|
#define _MPC5121E_CAN_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
#include "CAN/motMsCan.h"
|
|
|
|
/* external WindNet CAN required functions */
|
|
|
|
/*
|
|
* Since all MSCAN devices are internal to the processor, only one
|
|
* board can exist.
|
|
*/
|
|
|
|
#define MAX_NUM_MPC5121E_CAN_BOARDS (1)
|
|
|
|
#define BRD_NDX (0) /* Only one board possible */
|
|
|
|
#define INUM_CAN1 12
|
|
#define INUM_CAN2 13
|
|
#define IV_CAN1 INUM_TO_IVEC (INUM_CAN1)
|
|
#define IV_CAN2 INUM_TO_IVEC (INUM_CAN2)
|
|
|
|
#define CFG_IMMR 0x80000000
|
|
|
|
/* We need an identifier for each individual MSCAN controllers */
|
|
|
|
typedef enum
|
|
{
|
|
MSCAN1_CTRL,
|
|
MSCAN2_CTRL
|
|
}
|
|
MSCAN_CTRL_ID;
|
|
|
|
/*
|
|
* Define a type to record MSCAN device instance.
|
|
* Used to pass BSP configuration data to WNCAN
|
|
*/
|
|
|
|
typedef struct
|
|
{
|
|
MSCAN_CTRL_ID MSCANcontrollerId; /* MSCAN controller Identifier. */
|
|
void * pDevBaseAddr; /* Base address of MSCAN device */
|
|
VOIDFUNCPTR * pIntVec; /* Interrupt vector */
|
|
int intNum; /* Interrupt number */
|
|
UINT32 clockSource; /* 0=Oscillator Clock, 1=IP Bus Clock */
|
|
UINT32 freq; /* frequency */
|
|
}
|
|
mpc5121e_mscan_instance;
|
|
|
|
/* Defined in mpc5121eCan.c */
|
|
IMPORT STATUS mpc5121eCan_init (mpc5121e_mscan_instance * pMSCANboardCfg);
|
|
IMPORT STATUS mpc5121eCan_establishLinks (struct WNCAN_Device *);
|
|
IMPORT struct WNCAN_Device * mpc5121eCan_open (UINT, UINT);
|
|
IMPORT STATUS mpc5121eCan_close (struct WNCAN_Device *);
|
|
|
|
/* Defined in mpc5121e_cfg.c */
|
|
IMPORT BOOL mpc5121e_cfgGet_inUse (UINT brdNdx);
|
|
IMPORT void mpc5121e_cfgSet_inUse (UINT brdNdx, BOOL val);
|
|
IMPORT BOOL mpc5121e_cfgGet_allocated (UINT brdNdx, UINT ctrlNdx);
|
|
IMPORT void mpc5121e_cfgSet_allocated (UINT brdNdx, UINT ctrlNdx, BOOL val);
|
|
IMPORT struct WNCAN_Board * mpc5121e_cfgGet_canBoardPtr (UINT brdNdx);
|
|
IMPORT struct WNCAN_Device * mpc5121e_cfgGet_canDevicePtr (UINT brdNdx, UINT ctrlNdx);
|
|
IMPORT struct WNCAN_Controller * mpc5121e_cfgGet_canControllerPtr (UINT brdNdx, UINT ctrlNdx);
|
|
IMPORT MSCAN_DEV * mpc5121e_cfgGet_mscanDevPtr (UINT brdNdx, UINT ctrlNdx);
|
|
IMPORT WNCAN_ChannelMode * mpc5121e_cfgGet_chModePtr (UINT brdNdx, UINT ctrlNdx);
|
|
IMPORT UINT32 mpc5121e_cfgGet_NumControllers (void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* _MPC5121E_CAN_H_ */
|