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

📄 mcf51xx_reg.h

📁 freescale badge board 开发板测试 源程序
💻 H
📖 第 1 页 / 共 3 页
字号:
/***************************************************************************
 *
 *            Copyright (c) 2006-2007 by CMX Systems, Inc.
 *
 * This software is copyrighted by and is the sole property of
 * CMX.  All rights, title, ownership, or other interests
 * in the software remain the property of CMX.  This
 * software may only be used in accordance with the corresponding
 * license agreement.  Any unauthorized use, duplication, transmission,
 * distribution, or disclosure of this software is expressly forbidden.
 *
 * This Copyright notice may not be removed or modified without prior
 * written consent of CMX.
 *
 * CMX reserves the right to modify this software without notice.
 *
 * CMX Systems, Inc.
 * 12276 San Jose Blvd. #511
 * Jacksonville, FL 32223
 * USA
 *
 * Tel:  (904) 880-1840
 * Fax:  (904) 880-1632
 * http: www.cmx.com
 * email: cmx@cmx.com
 *
 ***************************************************************************/
 /*
  * Author: William Jiang
  * Change History:
  *       version 1, Oct.31, 2007 --- initial version
  */
#ifndef _MCF51XX_REGS_H_
#define _MCF51XX_REGS_H_

#include "hcc_types.h"
#include <mcf51jm128.h>

#define LITTLE_ENDIAN_MODE

#define nop()       asm( nop)

/*
 * Memory map definitions from linker command files
 */
extern volatile byte  const _IPSBAR[];

/*
 * Memory Map Info
 */

#define BITX(x) (1U<<(x))
#define BIT0	BITX(0)
#define BIT1	BITX(1)
#define BIT2	BITX(2)
#define BIT3	BITX(3)
#define BIT4	BITX(4)
#define BIT5	BITX(5)
#define BIT6	BITX(6)
#define BIT7 	BITX(7)
#define BIT8	BITX(8)
#define BIT9	BITX(9)
#define BIT10   BITX(10)
#define BIT11	BITX(11)
#define BIT12   BITX(12)
#define BIT13	BITX(13)
#define BIT14   BITX(14)
#define BIT15	BITX(15)
#define BIT16   BITX(16)
#define BIT17	BITX(17)
#define BIT18   BITX(18)
#define BIT19	BITX(19)
#define BIT20   BITX(20)
#define BIT21	BITX(21)
#define BIT22   BITX(22)
#define BIT23	BITX(23)
#define BIT24   BITX(24)
#define BIT25	BITX(25)
#define BIT26   BITX(26)
#define BIT27	BITX(27)
#define BIT28   BITX(28)
#define BIT29	BITX(29)
#define BIT30   BITX(30)
#define BIT31	BITX(31)


/*********************************************************************
*
* Core register bit definitions
*
*********************************************************************/
/* Status Register */
#define MCF5XXX_SR_T        (0x8000)
#define MCF5XXX_SR_S        (0x2000)
#define MCF5XXX_SR_M        (0x1000)
#define MCF5XXX_SR_IPL      (0x0700)
#define MCF5XXX_SR_IPL_0    (0x0000)
#define MCF5XXX_SR_IPL_1    (0x0100)
#define MCF5XXX_SR_IPL_2    (0x0200)
#define MCF5XXX_SR_IPL_3    (0x0300)
#define MCF5XXX_SR_IPL_4    (0x0400)
#define MCF5XXX_SR_IPL_5    (0x0500)
#define MCF5XXX_SR_IPL_6    (0x0600)
#define MCF5XXX_SR_IPL_7    (0x0700)
#define MCF5XXX_SR_X        (0x0010)
#define MCF5XXX_SR_N        (0x0008)
#define MCF5XXX_SR_Z        (0x0004)
#define MCF5XXX_SR_V        (0x0002)
#define MCF5XXX_SR_C        (0x0001)


/*********************************************************************
*
* Universal Serial Bus (USB)
*
*********************************************************************/

/* Register read/write macros */
#define MCF_USB_PER_ID                       (*(hcc_reg8 *)(&_IPSBAR[0x1A00]))
#define MCF_USB_IP_COMP                      (*(hcc_reg8 *)(&_IPSBAR[0x1A04]))
#define MCF_USB_REV                          (*(hcc_reg8 *)(&_IPSBAR[0x1A08]))
#define MCF_USB_ADD_INFO                     (*(hcc_reg8 *)(&_IPSBAR[0x1A0C]))
#define MCF_USB_OTG_INT_STAT                 (*(hcc_reg8 *)(&_IPSBAR[0x1A10]))
#define MCF_USB_OTG_INT_EN                   (*(hcc_reg8 *)(&_IPSBAR[0x1A14]))
#define MCF_USB_OTG_STATUS                   (*(hcc_reg8 *)(&_IPSBAR[0x1A18]))
#define MCF_USB_OTG_CTRL                     (*(hcc_reg8 *)(&_IPSBAR[0x1A1C]))
#define MCF_USB_INT_STAT                     (*(hcc_reg8 *)(&_IPSBAR[0x1A80]))
#define MCF_USB_INT_ENB                      (*(hcc_reg8 *)(&_IPSBAR[0x1A84]))
#define MCF_USB_ERR_STAT                     (*(hcc_reg8 *)(&_IPSBAR[0x1A88]))
#define MCF_USB_ERR_ENB                      (*(hcc_reg8 *)(&_IPSBAR[0x1A8C]))
#define MCF_USB_STAT                         (*(hcc_reg8 *)(&_IPSBAR[0x1A90]))
#define MCF_USB_CTL                          (*(hcc_reg8 *)(&_IPSBAR[0x1A94]))
#define MCF_USB_ADDR                         (*(hcc_reg8 *)(&_IPSBAR[0x1A98]))
#define MCF_USB_BDT_PAGE_01                  (*(hcc_reg8 *)(&_IPSBAR[0x1A9C]))
#define MCF_USB_FRM_NUML                     (*(hcc_reg8 *)(&_IPSBAR[0x1AA0]))
#define MCF_USB_FRM_NUMH                     (*(hcc_reg8 *)(&_IPSBAR[0x1AA4]))
#define MCF_USB_FRM_NUM       (MCF_USB_INT_STAT=MCF_USB_INT_STAT_SOF_TOK ,MCF_USB_FRM_NUML | (((hcc_u16)MCF_USB_FRM_NUMH)<<8))
#define MCF_USB_TOKEN                        (*(hcc_reg8 *)(&_IPSBAR[0x1AA8]))
#define MCF_USB_SOF_THLDL                    (*(hcc_reg8 *)(&_IPSBAR[0x1AAC]))
#define MCF_USB_BDT_PAGE_02                  (*(hcc_reg8 *)(&_IPSBAR[0x1AB0]))
#define MCF_USB_BDT_PAGE_03                  (*(hcc_reg8 *)(&_IPSBAR[0x1AB4]))
#define MCF_USB_ENDPT0                       (*(hcc_reg8 *)(&_IPSBAR[0x1AC0]))
#define MCF_USB_ENDPT1                       (*(hcc_reg8 *)(&_IPSBAR[0x1AC4]))
#define MCF_USB_ENDPT2                       (*(hcc_reg8 *)(&_IPSBAR[0x1AC8]))
#define MCF_USB_ENDPT3                       (*(hcc_reg8 *)(&_IPSBAR[0x1ACC]))
#define MCF_USB_ENDPT4                       (*(hcc_reg8 *)(&_IPSBAR[0x1AD0]))
#define MCF_USB_ENDPT5                       (*(hcc_reg8 *)(&_IPSBAR[0x1AD4]))
#define MCF_USB_ENDPT6                       (*(hcc_reg8 *)(&_IPSBAR[0x1AD8]))
#define MCF_USB_ENDPT7                       (*(hcc_reg8 *)(&_IPSBAR[0x1ADC]))
#define MCF_USB_ENDPT8                       (*(hcc_reg8 *)(&_IPSBAR[0x1AE0]))
#define MCF_USB_ENDPT9                       (*(hcc_reg8 *)(&_IPSBAR[0x1AE4]))
#define MCF_USB_ENDPT10                      (*(hcc_reg8 *)(&_IPSBAR[0x1AE8]))
#define MCF_USB_ENDPT11                      (*(hcc_reg8 *)(&_IPSBAR[0x1AEC]))
#define MCF_USB_ENDPT12                      (*(hcc_reg8 *)(&_IPSBAR[0x1AF0]))
#define MCF_USB_ENDPT13                      (*(hcc_reg8 *)(&_IPSBAR[0x1AF4]))
#define MCF_USB_ENDPT14                      (*(hcc_reg8 *)(&_IPSBAR[0x1AF8]))
#define MCF_USB_ENDPT15                      (*(hcc_reg8 *)(&_IPSBAR[0x1AFC]))
#define MCF_USB_USB_CTRL                     (*(hcc_reg8 *)(&_IPSBAR[0x1B00]))
#define MCF_USB_USB_OTG_OBSERVE              (*(hcc_reg8 *)(&_IPSBAR[0x1B04]))
#define MCF_USB_USB_OTG_CONTROL              (*(hcc_reg8 *)(&_IPSBAR[0x1B08]))

/* two new added registers for V1 */
#define MCF_USB_USBTRC0			                 (*(hcc_reg8 *)(&_IPSBAR[0x1B0C]))
#define MCF_USB_OTGPIN			                 (*(hcc_reg8 *)(&_IPSBAR[0x1B10]))

/* Bit definitions and macros for MCF_USB_USBTRC0 */
#define MCF_USB_USBTRC0_USB_RESUME_INT		(0x01)
#define MCF_USB_USBTRC0_USBVREN			(0x04)
#define MCF_USB_USBTRC0_USBRESMEN		(0x20)
#define MCF_USB_USBTRC0_USBPU			(0x40)
#define MCF_USB_USBTRC0_USBRESET		(0x80)

/* Bit definitions and macros for MCF_USB_OTGPIN */
#define MCF_USB_OTGPIN_SESSVLD			(0x01)
#define MCF_USB_OTGPIN_SESSEND			(0x02)
#define MCF_USB_OTGPIN_VBUSVLD			(0x04)
#define MCF_USB_OTGPIN_PULLUP			(0x08)
#define MCF_USB_OTGPIN_DPDOWN			(0x10)
#define MCF_USB_OTGPIN_DMDOWN			(0x20)
#define MCF_USB_OTGPIN_USBID			(0x40)


/* Bit definitions and macros for MCF_USB_PER_ID */
#define MCF_USB_PER_ID_ID(x)                 (((x)&0x3F)<<0)

/* Bit definitions and macros for MCF_USB_IP_COMP */
#define MCF_USB_IP_COMP_NID(x)               (((x)&0x3F)<<0)

/* Bit definitions and macros for MCF_USB_REV */
#define MCF_USB_REV_REV(x)                   (((x)&0xFF)<<0)

/* Bit definitions and macros for MCF_USB_ADD_INFO */
#define MCF_USB_ADD_INFO_HOST                (0x01)
#define MCF_USB_ADD_INFO_IRQ_NUM(x)          (((x)&0x1F)<<3)

/* Bit definitions and macros for MCF_USB_OTG_INT_STAT */
#define MCF_USB_OTG_INT_STAT_A_VBUS_VLD_CHG  (0x01)
#define MCF_USB_OTG_INT_STAT_B_SESS_END_CHG  (0x04)
#define MCF_USB_OTG_INT_STAT_SESS_VLD_CHG    (0x08)
#define MCF_USB_OTG_INT_STAT_LINE_STATE      (0x20)
#define MCF_USB_OTG_INT_STAT_1_MSEC          (0x40)
#define MCF_USB_OTG_INT_STAT_ID_CHG          (0x80)

/* Bit definitions and macros for MCF_USB_OTG_INT_EN */
#define MCF_USB_OTG_INT_EN_A_VBUS_VLD_EN     (0x01)
#define MCF_USB_OTG_INT_EN_B_SESS_END_EN     (0x04)
#define MCF_USB_OTG_INT_EN_SESS_VLD_EN       (0x08)
#define MCF_USB_OTG_INT_EN_LINE_STATE        (0x20)
#define MCF_USB_OTG_INT_EN_1_MSEC_EN         (0x40)
#define MCF_USB_OTG_INT_EN_ID_EN             (0x80)

/* Bit definitions and macros for MCF_USB_OTG_STATUS */
#define MCF_USB_OTG_STATUS_A_VBUS_VLD        (0x01)
#define MCF_USB_OTG_STATUS_B_SESS_END        (0x04)
#define MCF_USB_OTG_STATUS_SESS_VLD          (0x08)
#define MCF_USB_OTG_STATUS_LINE_STATE        (0x20)
#define MCF_USB_OTG_STATUS_1_MSEC            (0x40)
#define MCF_USB_OTG_STATUS_ID                (0x80)

/* Bit definitions and macros for MCF_USB_OTG_CTRL */
#define MCF_USB_OTG_CTRL_VBUS_DSCHG          (0x01)
#define MCF_USB_OTG_CTRL_VBUS_CHG            (0x02)
#define MCF_USB_OTG_CTRL_OTG_EN              (0x04)
#define MCF_USB_OTG_CTRL_VBUS_ON             (0x08)
#define MCF_USB_OTG_CTRL_DM_LOW              (0x10)
#define MCF_USB_OTG_CTRL_DP_LOW              (0x20)
#define MCF_USB_OTG_CTRL_DM_HIGH             (0x40)
#define MCF_USB_OTG_CTRL_DP_HIGH             (0x80)

/* Bit definitions and macros for MCF_USB_INT_STAT */
#define MCF_USB_INT_STAT_USB_RST             (0x01)
#define MCF_USB_INT_STAT_ERROR               (0x02)
#define MCF_USB_INT_STAT_SOF_TOK             (0x04)
#define MCF_USB_INT_STAT_TOK_DNE             (0x08)
#define MCF_USB_INT_STAT_SLEEP               (0x10)
#define MCF_USB_INT_STAT_RESUME              (0x20)
#define MCF_USB_INT_STAT_ATTACH              (0x40)
#define MCF_USB_INT_STAT_STALL               (0x80)

/* Bit definitions and macros for MCF_USB_INT_ENB */
#define MCF_USB_INT_ENB_USB_RST              (0x01)
#define MCF_USB_INT_ENB_ERROR                (0x02)
#define MCF_USB_INT_ENB_SOF_TOK              (0x04)
#define MCF_USB_INT_ENB_TOK_DNE              (0x08)
#define MCF_USB_INT_ENB_SLEEP                (0x10)
#define MCF_USB_INT_ENB_RESUME               (0x20)
#define MCF_USB_INT_ENB_ATTACH               (0x40)
#define MCF_USB_INT_ENB_STALL                (0x80)

/* Bit definitions and macros for MCF_USB_ERR_STAT */
#define MCF_USB_ERR_STAT_PID_ERR             (0x01)
#define MCF_USB_ERR_STAT_CRC5_EOF            (0x02)
#define MCF_USB_ERR_STAT_CRC16               (0x04)
#define MCF_USB_ERR_STAT_DFN8                (0x08)
#define MCF_USB_ERR_STAT_BTO_ERR             (0x10)
#define MCF_USB_ERR_STAT_DMA_ERR             (0x20)
#define MCF_USB_ERR_STAT_BTS_ERR             (0x80)

/* Bit definitions and macros for MCF_USB_ERR_ENB */
#define MCF_USB_ERR_ENB_PID_ERR              (0x01)
#define MCF_USB_ERR_ENB_CRC5_EOF             (0x02)
#define MCF_USB_ERR_ENB_CRC16                (0x04)
#define MCF_USB_ERR_ENB_DFN8                 (0x08)
#define MCF_USB_ERR_ENB_BTO_ERR              (0x10)
#define MCF_USB_ERR_ENB_DMA_ERR              (0x20)
#define MCF_USB_ERR_ENB_BTS_ERR              (0x80)

/* Bit definitions and macros for MCF_USB_STAT */
#define MCF_USB_STAT_ODD                     (0x04)
#define MCF_USB_STAT_TX                      (0x08)
#define MCF_USB_STAT_ENDP(x)                 (((x)&0x0F)<<4)

/* Bit definitions and macros for MCF_USB_CTL */
#define MCF_USB_CTL_USB_EN_SOF_EN            (0x01)
#define MCF_USB_CTL_ODD_RST                  (0x02)
#define MCF_USB_CTL_RESUME                   (0x04)
#define MCF_USB_CTL_HOST_MODE_EN             (0x08)
#define MCF_USB_CTL_RESET                    (0x10)
#define MCF_USB_CTL_TXDSUSPEND_TOKBUSY       (0x20)
#define MCF_USB_CTL_SE0                      (0x40)
#define MCF_USB_CTL_JSTATE                   (0x80)

/* Bit definitions and macros for MCF_USB_ADDR */
#define MCF_USB_ADDR_ADDR(x)                 (((x)&0x7F)<<0)
#define MCF_USB_ADDR_LS_EN                   (0x80)

⌨️ 快捷键说明

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