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

📄 des_mc33742.h

📁 BCM 控制demo源代码
💻 H
字号:
/*******************************************************************************/
/**
Copyright (c) 2007 Freescale Semiconductor
\file       des_MC33742.h
\brief      Register definitions and function prototypes for SBC handling
\author     Freescale Semiconductor
\author     B05114
\version    0.1
\date       April/2007
*/
/*******************************************************************************/

#ifndef _DES_MC33742_H  /* Prevent duplicated includes */
#define _DES_MC33742_H

/** Variable types and common definitions */
#include "typedefs.h" 

/* SBC default configuration: */
#define SBC_TIM1_INIT           SBC_WDOG_350MS
#define SBC_RCR_INIT            0
#define SBC_CAN_INIT            CANCLR|SBC_SLEWRATE0
#define SBC_IOR_INIT            0
#define SBC_WUR_INIT            0
#define SBC_TIM2_INIT           SBC_CYCLICSENSE_388MS
#define SBC_LPC_INIT            0
#define SBC_INTR_INIT           0

/* Read/ Write bit */
#define SBC_R                   0x00
#define SBC_W                   0x10

/* SBC Register adresses */
#define SBC_MCR                 0x00
#define SBC_RCR                 0x20
#define SBC_CAN                 0x40
#define SBC_IOR                 0x60
#define SBC_WUR                 0x80
#define SBC_TIM1                0xA0
#define SBC_TIM2                0xA8
#define SBC_LPC                 0xC0
#define SBC_INTR                0xE0

/* MCR, Mode Control register */
/* Write */
#define SBC_MCTR2               0x04
#define SBC_MCTR1               0x02
#define SBC_MCTR0               0x01
/* Read  */
#define SBC_BATFAIL             0x08
#define SBC_VDDPRE              0x04
#define SBC_GFAIL               0x02
#define SBC_WDRST               0x01
/* MCR Control Bits */
#define SBC_DEBUGMODE           0x00
#define SBC_NORMAL              SBC_MCTR0
#define SBC_STANDBY             SBC_MCTR1
#define SBC_STOP                SBC_MCTR1|SBC_MCTR0
#define SBC_SLEEP               SBC_MCTR2
#define SBC_DBGNORMAL           SBC_MCTR2|SBC_MCTR0
#define SBC_DBGSTANDBY          SBC_MCTR2|SBC_MCTR1
#define SBC_DBGSTOP             SBC_MCTR2|SBC_MCTR1|SBC_MCTR0

/* RCR, Reset Control Register */    
#define SBC_WDSTOP              0x08
#define SBC_NOSTOP              0x04
#define SBC_CANSLEEP            0x02
#define SBC_RSTTH               0x01

/* CAN Register */
/* Write */
#define CANCLR                  0x08
#define SBC_SC1                 0x04
#define SBC_SC0                 0x02
#define SBC_MODE                0x01
/* Read */
#define SBC_CANWU               0x08
#define SBC_CAN_F               0x04
#define SBC_CAN_UF              0x02
#define SBC_THERM_CUR           0x01
/* High Speed Can Transceiver Modes */
#define SBC_SLEWRATE0           0x00
#define SBC_SLEWRATE1           SBC_SC0
#define SBC_SLEWRATE2           SBC_SC1
#define SBC_SLEWRATE3           SBC_SC1|SBC_SC0
#define SBC_SLEEP_WKPDISABLE    SBC_MODE|SBC_SC0  
#define SBC_SLEEP_WKPENABLE     SBC_MODE


/* IOR, Input/Output Register */
/* Write */
#define SBC_HSON                0x04
	/* Read */
#define SBC_V2LOW               0x08
#define SBC_HSOT                0x04
#define SBC_VSUPLOW             0x02
#define SBC_DEBUG               0x01


/* WUR, Wake Up Register */
/* Write */
#define SBC_LCTR3               0x08
#define SBC_LCTR2               0x04
#define SBC_LCTR1               0x02
#define SBC_LCTR0               0x01
/* Read */
#define SBC_L3WU                0x08
#define SBC_L2WU                0x04
#define SBC_L1WU                0x02
#define SBC_L0WU                0x01
/* Control Bits */
#define SBC_L0L1DISABLED        0x00
#define SBC_L0L1HIGH            SBC_LCTR0
#define SBC_L0L1LOW             SBC_LCTR1
#define SBC_L0L1BOTH            SBC_LCTR1|SBC_LCTR0
#define SBC_L2L3DISABLED        0x00
#define SBC_L2L3HIGH            SBC_LCTR2
#define SBC_L2L3LOW             SBC_LCTR3
#define SBC_L2L3BOTH            SBC_LCTR3|SBC_LCTR2


/* TIM1/2, Timing Registers */
/* TIM1 Write */
#define SBC_WDW                 0x04
#define SBC_WDT1                0x02
#define SBC_WDT0                0x01
/* TIM2 Write */
#define SBC_CSP2                0x04
#define SBC_CSP1                0x02
#define SBC_CSP0                0x01
/* TIM1/TIM2 Read */
#define SBC_CANL2VDD            0x08
#define SBC_CANL2BAT            0x04
#define SBC_CANL2GND            0x02
#define SBC_TXPD                0x01
/* Watchdog Periods */
#define SBC_WDOG_10MS           0x00
#define SBC_WDOG_45MS           SBC_WDT0
#define SBC_WDOG_100MS          SBC_WDT1
#define SBC_WDOG_350MS          SBC_WDT1|SBC_WDT0
#define SBC_WDOG_WDW_10MS       SBC_WDW
#define SBC_WDOG_WDW_45MS       SBC_WDW|SBC_WDT0
#define SBC_WDOG_WDW_100MS      SBC_WDW|SBC_WDT1
#define SBC_WDOG_WDW_350MS      SBC_WDW|SBC_WDT1|SBC_WDT0
/* Cyclic Sense Timings */
#define SBC_CYCLICSENSE_5MS     0x00
#define SBC_CYCLICSENSE_9MS     SBC_CSP0
#define SBC_CYCLICSENSE_18MS    SBC_CSP1
#define SBC_CYCLICSENSE_37MS    SBC_CSP1|SBC_CSP0
#define SBC_CYCLICSENSE_74MS    SBC_CSP2
#define SBC_CYCLICSENSE_95MS    SBC_CSP2|SBC_CSP0
#define SBC_CYCLICSENSE_191MS   SBC_CSP2|SBC_CSP1
#define SBC_CYCLICSENSE_388MS   SBC_CSP2|SBC_CSP1|SBC_CSP0


/* LPC, Low Power Control Register */
/* Write */
#define SBC_LX2HS               0x08
#define SBC_FWU                 0x04
#define SBC_CAN_INT             0x02
#define SBC_HSAUTO	            0x01
/* Read */
#define SBC_CANH2VDD            0x08
#define SBC_CANH2BAT            0x04
#define SBC_CANH2GND            0x02
#define SBC_RXPR                0x01


/* INTR, Interrupt Register */
/* Write */
#define SBC_INTVSUPLOW          0x08
#define SBC_HSOT_V2LOW          0x04
#define SBC_VDDTEMP             0x02
#define SBC_CANF                0x01
/* Read */
#define SBC_HSOT                0x04


/** Function Prototypes */

/** Write SBC register */
void des_MC33742_Write (UINT8 u8TXByte);

/** Read SBC register */
UINT8 des_MC33742_Read (UINT8 u8TXByte);

/** SBC initial configuration with default values */
void des_MC33742_Config(void);

/** Sets the SBC mode */
void des_MC33742_SetMode (UINT8 u8Mode);

/** Sets the SBC in Debug-Normal mode  */
void des_MC33742_SetDebugMode(void);

/** Exits from Debug mode  */
void des_MC33742_ExitDebugMode(void);

/** Resets the SBC watchdog  */
void des_MC33742_ClearWDT(void);

/** Sets the SBC watchdog period  */
void des_MC33742_SetWDTperiod(UINT8 u8WDT_Period);

/** Enable/ disable the watchdog in stop mode */
void des_MC33742_WDT_StopMode(UINT8 u8Select);

/** Enable/ disable CAN sleep mode */
void des_MC33742_CAN_SleepMode(UINT8 u8Select);

/** CAN transceiver slew rate selection */
void des_MC33742_CAN_SlewRate(UINT8 u8SlewRate);

/** Enable/ disable CAN transceiver wake-up when in sleep mode */
void des_MC33742_CAN_Wkup_SleepMode(UINT8 u8Select);

/** Set Lx sensitivity for wake-up */
void des_MC33742_SetLxSens(UINT8 u8LxSens);

/** Enable/ disable HS in stop and sleep modes */
void des_MC33742_HSCyclic(UINT8 u8Select);

/** Select cyclic sense period */
void des_MC33742_SetCyclicSense(UINT8 u8CycSens_Period);

/** Enable/ disable HS */
void des_MC33742_HS(UINT8 u8Select);

/** Enable interrupt sources */
void des_MC33742_SetInterrupts(UINT8 u8InterrSelect);


#endif /* _DES_MC33742_H */

/*******************************************************************************/

⌨️ 快捷键说明

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