C:/nxpdrv/LPC1700CMSIS/Drivers/include/lpc17xx_can.h File Reference
: Contains all macro definitions and function prototypes support for CAN firmware library on LPC17xx More...
#include "LPC17xx.h"
#include "lpc_types.h"
Go to the source code of this file.
Data Structures | |
struct | CAN_PinCFG_Type |
Pin Configuration structure. More... | |
struct | CAN_MSG_Type |
CAN message object structure. More... | |
struct | FullCAN_Entry |
FullCAN Entry structure. More... | |
struct | SFF_Entry |
Standard ID Frame Format Entry structure. More... | |
struct | SFF_GPR_Entry |
Group of Standard ID Frame Format Entry structure. More... | |
struct | EFF_Entry |
Extended ID Frame Format Entry structure. More... | |
struct | EFF_GPR_Entry |
Group of Extended ID Frame Format Entry structure. More... | |
struct | AF_SectionDef |
Acceptance Filter Section Table structure. More... | |
Defines | |
#define | ID_11 1 |
#define | MAX_HW_FULLCAN_OBJ 64 |
#define | MAX_SW_FULLCAN_OBJ 32 |
#define | CAN_MOD_RM ((uint32_t)(1)) |
#define | CAN_MOD_LOM ((uint32_t)(1<<1)) |
#define | CAN_MOD_STM ((uint32_t)(1<<2)) |
#define | CAN_MOD_TPM ((uint32_t)(1<<3)) |
#define | CAN_MOD_SM ((uint32_t)(1<<4)) |
#define | CAN_MOD_RPM ((uint32_t)(1<<5)) |
#define | CAN_MOD_TM ((uint32_t)(1<<7)) |
#define | CAN_CMR_TR ((uint32_t)(1)) |
#define | CAN_CMR_AT ((uint32_t)(1<<1)) |
#define | CAN_CMR_RRB ((uint32_t)(1<<2)) |
#define | CAN_CMR_CDO ((uint32_t)(1<<3)) |
#define | CAN_CMR_SRR ((uint32_t)(1<<4)) |
#define | CAN_CMR_STB1 ((uint32_t)(1<<5)) |
#define | CAN_CMR_STB2 ((uint32_t)(1<<6)) |
#define | CAN_CMR_STB3 ((uint32_t)(1<<7)) |
#define | CAN_GSR_RBS ((uint32_t)(1)) |
#define | CAN_GSR_DOS ((uint32_t)(1<<1)) |
#define | CAN_GSR_TBS ((uint32_t)(1<<2)) |
#define | CAN_GSR_TCS ((uint32_t)(1<<3)) |
#define | CAN_GSR_RS ((uint32_t)(1<<4)) |
#define | CAN_GSR_TS ((uint32_t)(1<<5)) |
#define | CAN_GSR_ES ((uint32_t)(1<<6)) |
#define | CAN_GSR_BS ((uint32_t)(1<<7)) |
#define | CAN_GSR_RXERR(n) ((uint32_t)((n&0xFF)<<16)) |
#define | CAN_GSR_TXERR(n) ((uint32_t)(n&0xFF)<<24)) |
#define | CAN_ICR_RI ((uint32_t)(1)) |
#define | CAN_ICR_TI1 ((uint32_t)(1<<1)) |
#define | CAN_ICR_EI ((uint32_t)(1<<2)) |
#define | CAN_ICR_DOI ((uint32_t)(1<<3)) |
#define | CAN_ICR_WUI ((uint32_t)(1<<4)) |
#define | CAN_ICR_EPI ((uint32_t)(1<<5)) |
#define | CAN_ICR_ALI ((uint32_t)(1<<6)) |
#define | CAN_ICR_BEI ((uint32_t)(1<<7)) |
#define | CAN_ICR_IDI ((uint32_t)(1<<8)) |
#define | CAN_ICR_TI2 ((uint32_t)(1<<9)) |
#define | CAN_ICR_TI3 ((uint32_t)(1<<10)) |
#define | CAN_ICR_ERRBIT(n) ((uint32_t)((n&0x1F)<<16)) |
#define | CAN_ICR_ERRDIR ((uint32_t)(1<<21)) |
#define | CAN_ICR_ERRC(n) ((uint32_t)((n&0x3)<<22)) |
#define | CAN_ICR_ALCBIT(n) ((uint32_t)((n&0xFF)<<24)) |
#define | CAN_IER_RIE ((uint32_t)(1)) |
#define | CAN_IER_TIE1 ((uint32_t)(1<<1)) |
#define | CAN_IER_EIE ((uint32_t)(1<<2)) |
#define | CAN_IER_DOIE ((uint32_t)(1<<3)) |
#define | CAN_IER_WUIE ((uint32_t)(1<<4)) |
#define | CAN_IER_EPIE ((uint32_t)(1<<5)) |
#define | CAN_IER_ALIE ((uint32_t)(1<<6)) |
#define | CAN_IER_BEIE ((uint32_t)(1<<7)) |
#define | CAN_IER_IDIE ((uint32_t)(1<<8)) |
#define | CAN_IER_TIE2 ((uint32_t)(1<<9)) |
#define | CAN_IER_TIE3 ((uint32_t)(1<<10)) |
#define | CAN_BTR_BRP(n) ((uint32_t)(n&0x3FF)) |
#define | CAN_BTR_SJM(n) ((uint32_t)((n&0x3)<<14)) |
#define | CAN_BTR_TESG1(n) ((uint32_t)(n&0xF)<<16)) |
#define | CAN_BTR_TESG2(n) ((uint32_t)(n&0xF)<<20)) |
#define | CAN_BTR_SAM(n) ((uint32_t)(1<<23)) |
#define | CAN_EWL_EWL(n) ((uint32_t)(n&0xFF)) |
#define | CAN_SR_RBS ((uint32_t)(1)) |
#define | CAN_SR_DOS ((uint32_t)(1<<1)) |
#define | CAN_SR_TBS1 ((uint32_t)(1<<2)) |
#define | CAN_SR_TCS1 ((uint32_t)(1<<3)) |
#define | CAN_SR_RS ((uint32_t)(1<<4)) |
#define | CAN_SR_TS1 ((uint32_t)(1<<5)) |
#define | CAN_SR_ES ((uint32_t)(1<<6)) |
#define | CAN_SR_BS ((uint32_t)(1<<7)) |
#define | CAN_SR_TBS2 ((uint32_t)(1<<10)) |
#define | CAN_SR_TCS2 ((uint32_t)(1<<11)) |
#define | CAN_SR_TS2 ((uint32_t)(1<<13)) |
#define | CAN_SR_TBS3 ((uint32_t)(1<<18)) |
#define | CAN_SR_TCS3 ((uint32_t)(1<<19)) |
#define | CAN_SR_TS3 ((uint32_t)(1<<21)) |
#define | CAN_RFS_ID_INDEX(n) ((uint32_t)(n&0x3FF)) |
#define | CAN_RFS_BP ((uint32_t)(1<<10)) |
#define | CAN_RFS_DLC(n) ((uint32_t)((n&0xF)<<16) |
#define | CAN_RFS_RTR ((uint32_t)(1<<30)) |
#define | CAN_RFS_FF ((uint32_t)(1<<31)) |
#define | CAN_RID_ID_11(n) ((uint32_t)(n&0x7FF)) |
#define | CAN_RID_ID_29(n) ((uint32_t)(n&0x1FFFFFFF)) |
#define | CAN_RDA_DATA1(n) ((uint32_t)(n&0xFF)) |
#define | CAN_RDA_DATA2(n) ((uint32_t)((n&0xFF)<<8)) |
#define | CAN_RDA_DATA3(n) ((uint32_t)((n&0xFF)<<16)) |
#define | CAN_RDA_DATA4(n) ((uint32_t)((n&0xFF)<<24)) |
#define | CAN_RDB_DATA5(n) ((uint32_t)(n&0xFF)) |
#define | CAN_RDB_DATA6(n) ((uint32_t)((n&0xFF)<<8)) |
#define | CAN_RDB_DATA7(n) ((uint32_t)((n&0xFF)<<16)) |
#define | CAN_RDB_DATA8(n) ((uint32_t)((n&0xFF)<<24)) |
#define | CAN_TFI_PRIO(n) ((uint32_t)(n&0xFF)) |
#define | CAN_TFI_DLC(n) ((uint32_t)((n&0xF)<<16)) |
#define | CAN_TFI_RTR ((uint32_t)(1<<30)) |
#define | CAN_TFI_FF ((uint32_t)(1<<31)) |
#define | CAN_TID_ID11(n) ((uint32_t)(n&0x7FF)) |
#define | CAN_TID_ID29(n) ((uint32_t)(n&0x1FFFFFFF)) |
#define | CAN_TDA_DATA1(n) ((uint32_t)(n&0xFF)) |
#define | CAN_TDA_DATA2(n) ((uint32_t)((n&0xFF)<<8)) |
#define | CAN_TDA_DATA3(n) ((uint32_t)((n&0xFF)<<16)) |
#define | CAN_TDA_DATA4(n) ((uint32_t)((n&0xFF)<<24)) |
#define | CAN_TDA_DATA5(n) ((uint32_t)(n&0xFF)) |
#define | CAN_TDA_DATA6(n) ((uint32_t)((n&0xFF)<<8)) |
#define | CAN_TDA_DATA7(n) ((uint32_t)((n&0xFF)<<16)) |
#define | CAN_TDA_DATA8(n) ((uint32_t)((n&0xFF)<<24)) |
#define | CAN1SLEEPCLR ((uint32_t)(1<<1)) |
#define | CAN2SLEEPCLR ((uint32_t)(1<<2)) |
#define | CAN_WAKEFLAGES_CAN1WAKE ((uint32_t)(1<<1)) |
#define | CAN_WAKEFLAGES_CAN2WAKE ((uint32_t)(1<<2)) |
#define | CAN_TSR_TS1 ((uint32_t)(1)) |
#define | CAN_TSR_TS2 ((uint32_t)(1<<1)) |
#define | CAN_TSR_TBS1 ((uint32_t)(1<<8)) |
#define | CAN_TSR_TBS2 ((uint32_t)(1<<9)) |
#define | CAN_TSR_TCS1 ((uint32_t)(1<<16)) |
#define | CAN_TSR_TCS2 ((uint32_t)(1<<17)) |
#define | CAN_RSR_RS1 ((uint32_t)(1)) |
#define | CAN_RSR_RS2 ((uint32_t)(1<<1)) |
#define | CAN_RSR_RB1 ((uint32_t)(1<<8)) |
#define | CAN_RSR_RB2 ((uint32_t)(1<<9)) |
#define | CAN_RSR_DOS1 ((uint32_t)(1<<16)) |
#define | CAN_RSR_DOS2 ((uint32_t)(1<<17)) |
#define | CAN_MSR_E1 ((uint32_t)(1)) |
#define | CAN_MSR_E2 ((uint32_t)(1<<1)) |
#define | CAN_MSR_BS1 ((uint32_t)(1<<8)) |
#define | CAN_MSR_BS2 ((uint32_t)(1<<9)) |
#define | CAN_AFMR_AccOff ((uint32_t)(1)) |
#define | CAN_AFMR_AccBP ((uint32_t)(1<<1)) |
#define | CAN_AFMR_eFCAN ((uint32_t)(1<<2)) |
#define | CAN_STT_sa(n) ((uint32_t)((n&1FF)<<2)) |
#define | CAN_SFF_GRP_sa(n) ((uint32_t)((n&3FF)<<2)) |
#define | CAN_EFF_sa(n) ((uint32_t)((n&1FF)<<2)) |
#define | CAN_Eff_GRP_sa(n) ((uint32_t)((n&3FF)<<2)) |
#define | CAN_EndofTable(n) ((uint32_t)((n&3FF)<<2)) |
#define | CAN_LUTerrAd(n) ((uint32_t)((n&1FF)<<2)) |
#define | CAN_LUTerr ((uint32_t)(1)) |
#define | CAN_FCANIE ((uint32_t)(1)) |
#define | CAN_FCANIC0_IntPnd(n) ((uint32_t)(1<<n)) |
#define | CAN_FCANIC1_IntPnd(n) ((uint32_t)(1<<(n-32))) |
#define | PARAM_CANx(x) |
#define | PARAM_CANAFx(x) (((uint32_t*)x)== ((uint32_t*)LPC_CANAF)) |
#define | PARAM_CANAFRAMx(x) (((uint32_t*)x)== (uint32_t*)LPC_CANAF_RAM) |
#define | PARAM_CANCRx(x) (((uint32_t*)x)==((uint32_t*)LPC_CANCR)) |
#define | PARAM_I2S_DATA(data) ((data>=0)&&(data <= 0xFFFFFFFF)) |
#define | PRAM_I2S_FREQ(freq) ((freq>=16000)&&(freq <= 96000)) |
#define | PARAM_RD1_PIN(n) ((n==CAN_RD1_P0_0)||(n==CAN_RD1_P0_21)) |
#define | PARAM_TD1_PIN(n) ((n==CAN_TD1_P0_1)||(n==CAN_TD1_P0_22)) |
#define | PARAM_RD2_PIN(n) ((n==CAN_RD2_P0_4)||(n==CAN_RD2_P2_7)) |
#define | PARAM_TD2_PIN(n) ((n==CAN_TD2_P0_5)||(n==CAN_TD2_P2_8)) |
#define | PARAM_ID_11(n) ((n>>11)==0) |
#define | PARAM_ID_29(n) ((n>>29)==0) |
#define | PARAM_DLC(n) ((n>>4)==0) |
#define | PARAM_ID_FORMAT(n) ((n==STD_ID_FORMAT)||(n==EXT_ID_FORMAT)) |
#define | PARAM_GRP_ID(x, y) ((x<=y)) |
#define | PARAM_FRAME_TYPE(n) ((n==DATA_FRAME)||(n==REMOTE_FRAME)) |
#define | PARAM_CTRL_STS_TYPE(n) |
#define | PARAM_CR_STS_TYPE(n) |
#define | PARAM_AFMODE_TYPE(n) |
#define | PARAM_MODE_TYPE(n) |
#define | CAN1_CTRL ((uint8_t)(0)) |
#define | CAN2_CTRL ((uint8_t)(1)) |
#define | PARAM_CTRL(n) ((n==CAN1_CTRL)|(n==CAN2_CTRL)) |
#define | MSG_ENABLE ((uint8_t)(0)) |
#define | MSG_DISABLE ((uint8_t)(1)) |
#define | PARAM_MSG_DISABLE(n) ((n==MSG_ENABLE)|(n==MSG_DISABLE)) |
#define | PARAM_INT_EN_TYPE(n) |
#define | PARAM_AFLUT_ENTRY_TYPE(n) |
#define | PARAM_POSITION(n) ((n>=0)&&(n<512)) |
#define | CAN_RD1_P0_0 ((uint8_t)(0)) |
#define | CAN_RD1_P0_21 ((uint8_t)(1)) |
#define | CAN_TD1_P0_1 ((uint8_t)(0)) |
#define | CAN_TD1_P0_22 ((uint8_t)(1)) |
#define | CAN_RD2_P0_4 ((uint8_t)(0)) |
#define | CAN_RD2_P2_7 ((uint8_t)(1)) |
#define | CAN_TD2_P0_5 ((uint8_t)(0)) |
#define | CAN_TD2_P2_8 ((uint8_t)(1)) |
Typedefs | |
typedef void( | fnCANCbs_Type )() |
CAN call-back function type definitions. | |
Enumerations | |
enum | CAN_ID_FORMAT_Type { STD_ID_FORMAT = 0, EXT_ID_FORMAT = 1 } |
CAN ID format definition. More... | |
enum | AFLUT_ENTRY_Type { FULLCAN_ENTRY = 0, EXPLICIT_STANDARD_ENTRY, GROUP_STANDARD_ENTRY, EXPLICIT_EXTEND_ENTRY, GROUP_EXTEND_ENTRY } |
AFLUT Entry type definition. More... | |
enum | CAN_FRAME_Type { DATA_FRAME = 0, REMOTE_FRAME = 1 } |
Symbolic names for type of CAN message. More... | |
enum | CAN_CTRL_STS_Type { CANCTRL_GLOBAL_STS = 0, CANCTRL_INT_CAP, CANCTRL_ERR_WRN, CANCTRL_STS } |
CAN Control status definition. More... | |
enum | CAN_CR_STS_Type { CANCR_TX_STS = 0, CANCR_RX_STS, CANCR_MS } |
Central CAN status type definition. More... | |
enum | CAN_INT_EN_Type { CANINT_RIE = 0, CANINT_TIE1, CANINT_EIE, CANINT_DOIE, CANINT_WUIE, CANINT_EPIE, CANINT_ALIE, CANINT_BEIE, CANINT_IDIE, CANINT_TIE2, CANINT_TIE3, CANINT_FCE } |
CAN interrupt enable type definition. More... | |
enum | CAN_AFMODE_Type { CAN_Normal = 0, CAN_AccOff, CAN_AccBP, CAN_eFCAN } |
Acceptance Filter Mode type definition. More... | |
enum | CAN_MODE_Type { CAN_OPERATING_MODE = 0, CAN_RESET_MODE, CAN_LISTENONLY_MODE, CAN_SELFTEST_MODE, CAN_TXPRIORITY_MODE, CAN_SLEEP_MODE, CAN_RXPOLARITY_MODE, CAN_TEST_MODE } |
CAN Mode Type definition. More... | |
enum | CAN_ERROR { CAN_OK = 1, CAN_OBJECTS_FULL_ERROR, CAN_FULL_OBJ_NOT_RCV, CAN_NO_RECEIVE_DATA, CAN_AF_ENTRY_ERROR, CAN_CONFLICT_ID_ERROR, CAN_ENTRY_NOT_EXIT_ERROR } |
Error values that functions can return. More... | |
Functions | |
void | CAN_Init (LPC_CAN_TypeDef *CANx, uint32_t baudrate) |
Initialize CAN peripheral with given baudrate. | |
void | CAN_DeInit (LPC_CAN_TypeDef *CANx) |
CAN deInit. | |
Status | CAN_SendMsg (LPC_CAN_TypeDef *CANx, CAN_MSG_Type *CAN_Msg) |
Send message data. | |
Status | CAN_ReceiveMsg (LPC_CAN_TypeDef *CANx, CAN_MSG_Type *CAN_Msg) |
Receive message data. | |
CAN_ERROR | FCAN_ReadObj (LPC_CANAF_TypeDef *CANAFx, CAN_MSG_Type *CAN_Msg) |
Receive FullCAN Object. | |
uint32_t | CAN_GetCTRLStatus (LPC_CAN_TypeDef *CANx, CAN_CTRL_STS_Type arg) |
Get CAN Control Status. | |
uint32_t | CAN_GetCRStatus (LPC_CANCR_TypeDef *CANCRx, CAN_CR_STS_Type arg) |
Get CAN Central Status. | |
void | CAN_ModeConfig (LPC_CAN_TypeDef *CANx, CAN_MODE_Type mode, FunctionalState NewState) |
Enable/Disable CAN Mode. | |
void | CAN_SetBaudRate (LPC_CAN_TypeDef *CANx, uint32_t baudrate) |
Setting CAN baud rate (bps). | |
void | CAN_SetAFMode (LPC_CANAF_TypeDef *CANAFx, CAN_AFMODE_Type AFMode) |
Setting Acceptance Filter mode. | |
CAN_ERROR | CAN_SetupAFLUT (LPC_CANAF_TypeDef *CANAFx, AF_SectionDef *AFSection) |
Setup Acceptance Filter Look-Up Table. | |
CAN_ERROR | CAN_LoadFullCANEntry (LPC_CAN_TypeDef *CANx, uint16_t id) |
Load FullCAN entry into AFLUT. | |
CAN_ERROR | CAN_LoadExplicitEntry (LPC_CAN_TypeDef *CANx, uint32_t id, CAN_ID_FORMAT_Type format) |
Add Explicit ID into AF Look-Up Table dynamically. | |
CAN_ERROR | CAN_LoadGroupEntry (LPC_CAN_TypeDef *CANx, uint32_t lowerID, uint32_t upperID, CAN_ID_FORMAT_Type format) |
Load Group entry into AFLUT. | |
CAN_ERROR | CAN_RemoveEntry (AFLUT_ENTRY_Type EntryType, uint16_t position) |
Remove AFLUT entry (FullCAN entry and Explicit Standard entry). | |
void | CAN_SetupCBS (CAN_INT_EN_Type arg, fnCANCbs_Type *pnCANCbs) |
Install interrupt call-back function. | |
void | CAN_IRQCmd (LPC_CAN_TypeDef *CANx, CAN_INT_EN_Type arg, FunctionalState NewState) |
Enable/Disable CAN Interrupt. | |
void | CAN_IntHandler (LPC_CAN_TypeDef *CANx) |
Standard CAN interrupt handler, this function will check all interrupt status of CAN channels, then execute the call back function if they're already installed. |
Detailed Description
: Contains all macro definitions and function prototypes support for CAN firmware library on LPC17xx
- Version:
- : 1.0
- Date:
- : 1.June.2009
- Author:
- : NguyenCao
Definition in file lpc17xx_can.h.
Generated on Mon Feb 8 10:01:38 2010 for LPC1700CMSIS Standard Peripheral Firmware Library by
