📄 ezregs.h
字号:
//-----------------------------------------------------------------------------
// File: ezregs.h
// Contents: EZ-USB register declarations and bit mask definitions.
//
// Copyright (c) 1997 AnchorChips, Inc. All rights reserved
//-----------------------------------------------------------------------------
#ifndef __EZREGS_H__ /* Header Sentry */
#define __EZREGS_H__
/*-----------------------------------------------------------------------------
Global Variables
-----------------------------------------------------------------------------*/
// The Ez-USB registers are defined here. There used to be 3 files containing
// this information: ezregs.h (external refs), ezregs.c (bound reg names to an
// explicit address in ezusb.lib), and ezregs.inc (included in assembly files).
// We now use ezregs.h for register address allocation instead of ezregs.c by
// using "#define ALLOCATE_EXTERN". The file ezregs.c now just includes ezregs.h.
// When using "#define ALLOCATE_EXTERN", you get:
// xdata volatile BYTE OUT7BUF[64] _at_ 0x7B40;
// Such lines used to be in ezregs.c, but now are created from ezregs.h by using
// the preprocessor. The definitions in ezregs.c were redundant.
// Incidently, these lines will not generate any space in the resulting hex
// file; they just bind the symbols to the addresses for compilation.
// Since the file ezregs.c is still used in the library build, you normally
// just need to use #include "ezregs.h" in your files (i.e. fw.c).
// If you want to generate your own (non-frameworks based) C example, then you
// just need to put "#define ALLOCATE_EXTERN" in your main program file;
// i.e. fw.c or a stand-alone C source file. Any time you link with ezusb.lib,
// it will not be necessary to "#define ALLOCATE_EXTERN".
// Without "#define ALLOCATE_EXTERN", you just get the external reference:
// extern xdata volatile BYTE OUT7BUF[64] ;// 0x7B40;
// This uses the concatenation operator "##" to insert a comment "//"
// to cut off the end of the line, "_at_ 0x7B40;", which is not wanted.
// If you modify the register definitions below, please regenerate the file
// "ezregs.inc" which uses the same basic information, but which could not be
// derived automatically from this one source file using the preprocessor.
/*-----------------------------------------------------------------------------
Special Function Registers (SFRs)
The byte registers and bits defined in the following list are based
on the Synopsis definition of the 8051 Special Function Registers for EZ-USB.
If you modify the register definitions below, please regenerate the file
"ezregs.inc" which includes the same basic information for assembly inclusion.
-----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
Bit Masks
-----------------------------------------------------------------------------*/
/* CPU Control & Status Register */
#define bmCHIPREV (bmBIT7 | bmBIT6 | bmBIT5 | bmBIT4)
#define bmCLK24OE bmBIT1
#define bm8052RES bmBIT0
/* Port Configuration Registers */
/* Port A */
#define bmRXD1OUT bmBIT7
#define bmRXD0OUT bmBIT6
#define bmFRD bmBIT5
#define bmFWR bmBIT4
#define bmCS bmBIT3
#define bmOE bmBIT2
#define bmT1OUT bmBIT1
#define bmT0OUT bmBIT0
/* Port B */
#define bmT2OUT bmBIT7
#define bmINT6 bmBIT6
#define bmINT5 bmBIT5
#define bmINT4 bmBIT4
#define bmTXD1 bmBIT3
#define bmRXD1 bmBIT2
#define bmT2EX bmBIT1
#define bmT2 bmBIT0
/* Port C */
#define bmRD bmBIT7
#define bmWR bmBIT6
#define bmT1 bmBIT5
#define bmT0 bmBIT4
#define bmINT1 bmBIT3
#define bmINT0 bmBIT2
#define bmTXD0 bmBIT1
#define bmRXD0 bmBIT0
/* Isochronous Status & End Point Valid Registers */
#define bmEP15 bmBIT7
#define bmEP14 bmBIT6
#define bmEP13 bmBIT5
#define bmEP12 bmBIT4
#define bmEP11 bmBIT3
#define bmEP10 bmBIT2
#define bmEP9 bmBIT1
#define bmEP8 bmBIT0
/* I2C Control & Status Register */
#define bmSTART bmBIT7
#define bmSTOP bmBIT6
#define bmLASTRD bmBIT5
#define bmID (bmBIT4 | bmBIT3)
#define bmBERR bmBIT2
#define bmACK bmBIT1
#define bmDONE bmBIT0
/* Interrupt Vector Register */
#define bmIV4 bmBIT6
#define bmIV3 bmBIT5
#define bmIV2 bmBIT4
#define bmIV1 bmBIT3
#define bmIV0 bmBIT2
/* End point Interrupt Request, End Point Interrupt Enable */
/* And End Point Valid Registers */
#define bmEP7 bmBIT7
#define bmEP6 bmBIT6
#define bmEP5 bmBIT5
#define bmEP4 bmBIT4
#define bmEP3 bmBIT3
#define bmEP2 bmBIT2
#define bmEP1 bmBIT1
#define bmEP0 bmBIT0
/* Global Interrupt Request & Enable Registers */
#define bmIBN bmBIT5
#define bmURES bmBIT4
#define bmSUSP bmBIT3
#define bmSUTOK bmBIT2
#define bmSOF bmBIT1
#define bmSUDAV bmBIT0
/* Global Control */
#define bmBREAK bmBIT3
#define bmBPPULSE bmBIT2
#define bmBPEN bmBIT1
#define bmAVEN bmBIT0
/* USB Control & Status Register */
#define bmRWAKEUP bmBIT7
#define bmDISCON bmBIT3
#define bmDISCOE bmBIT2
#define bmRENUM bmBIT1
#define bmSIGRESUME bmBIT0
/* End Point 0 Control & Status Register */
#define bmOUT bmBIT3
#define bmIN bmBIT2
#define bmHS bmBIT1
#define bmHSSTALL bmBIT0
/* End Point Control & Status Registers */
#define bmEPSTALL bmBIT0
#define bmEPBUSY bmBIT1
/* Fast Transfer Register */
#define bmFISO bmBIT7
#define bmFBLK bmBIT6
#define bmRPOL bmBIT5
#define bmRMOD1 bmBIT4
#define bmRMOD0 bmBIT3
#define bmWPOL bmBIT2
#define bmWMOD1 bmBIT1
#define bmWMOD0 bmBIT0
/* Endpoint Pairing Register */
#define bmISOSEND0 bmBIT7
#define bmPR6OUT bmBIT5
#define bmPR4OUT bmBIT4
#define bmPR2OUT bmBIT3
#define bmPR6IN bmBIT2
#define bmPR4IN bmBIT1
#define bmPR2IN bmBIT0
//-----------------------------------------------------------------------------
// Macros
//-----------------------------------------------------------------------------*/
// Convert End point ID (d0000eee) to EPIO offset */
#define EPID(id) (((~id & 0x80) >> 4) + (id & 0x07))
#endif /* __EZREGS_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -