📄 mcu.h
字号:
/*============================================================================
____________________________________________________________________________
______________________________________________
SSSS M M CCCC Standard Microsystems Corporation
S MM MM SSSS C Austin Design Center
SSS M M M S C 11000 N. Mopac Expressway
S M M SSS C Stonelake Bldg. 6, Suite 500
SSSS M M S CCCC Austin, Texas 78759
SSSS ______________________________________________
____________________________________________________________________________
Copyright(C) 1999, Standard Microsystems Corporation
All Rights Reserved.
This program code listing is proprietary to SMSC and may not be copied,
distributed, or used without a license to do so. Such license may have
Limited or Restricted Rights. Please refer to the license for further
clarification.
____________________________________________________________________________
Notice: The program contained in this listing is a proprietary trade
secret of SMSC, Hauppauge, New York, and is copyrighted
under the United States Copyright Act of 1976 as an unpublished work,
pursuant to Section 104 and Section 408 of Title XVII of the United
States code. Unauthorized copying, adaption, distribution, use, or
display is prohibited by this law.
____________________________________________________________________________
Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subparagraph(c)(1)(ii) of the Rights
in Technical Data and Computer Software clause at DFARS 52.227-7013.
Contractor/Manufacturer is Standard Microsystems Corporation,
80 Arkay Drive, Hauppauge, New York, 1178-8847.
____________________________________________________________________________
____________________________________________________________________________
mcu.h - mcu specific declarations for the usb97c100, usb97c102, usb97cFDC,
and usb97c200.
____________________________________________________________________________
comments tbd
____________________________________________________________________________
Revision History
Date Who Comment
________ ___ _____________________________________________________________
07/16/99 tbh -initial version
01/02/01 tbh -back port for the '100
03/15/01 tbh -merged 10x and 20x versions back into single file
for improved maintainability
-converted api macros into functions to facilitate
implementation, and facilitate debugging with an ice
-all regisers are accessed via wrappers, facilitating
relocation to different memory spaces (fpga vs asic, etc),
and for self documenting mnemonics
-register naming convention changed from using a prefix to
indicate the memory space of the register to using a prefix
to indicate the type of register: cpu, mcu, isa
07/27/01 tbh -tweak port for 20x family
08/03/01 tbh -fixed bug in _mcu_register_setbit() and _mcu_register_clrbit().
the __bitix macro arg wasn't in parens, causing incorrect
evaluation during macro expansion. added parens. fixed
08/29/01 tbh added mcu_reboot()
08/30/01 tbh changed mcu_reboot() into a macro.
09/05/01 tbh - reworked the t_mcu_register definition macros to get the regs
in sfr declarations working again. moved all register
definitions from mcu.c and added macros to munge them as
externals, or sfrs, or allocated, as necessary.
09/17/01 cds - switched mcu_dot_c logic to extern the t_mcu_register typedef
when not included by mcu.c.
- removed registers from the 210 that are external to the mcu
(all the flash media controller-specific registers). SFR
registers for the 210 were untouched.
11/05/01 cds - updated 210 registers to new spec defs.
11/27/01 cds - added new 210 registers & masks (x_gpiob_dir, x_gpiob_in, x_gpiob_out,
and x_fmc_err
- updated and added register bit definitions to match rev 0.5 of the 210
spec. (x_sm_stat, x_sm_stat_msk, x_ms_stat, x_ms_stat_msk, x_sd_stat,
x_sd_stat_msk, x_fmc_ctl, x_fmc_mode_ctl, x_media_sts, x_crd_stat,
x_fmc_clk_ctl, x_cfc_stat, x_cfc_stat_msk, x_cfc_ata_mode_ctl, x_fmc_out_ctl)
- split x_wu_src1 register & bit definitions into 201 and 210 versions
because bit definitions were shifted. (sfr addr same, could be confusing)
Added new 210-specific bit definitions
12/10/01 rcc - Fixed #define kbm_clksel_clk_valid 0x04 was 0x10 which is wrong
02/12/02 tbh - modified _mcu_register_set/clr_bits macros for use with broken sfrs to
read-modify-write much more slowly to avoid sfr corruption.
02/13/02 rcc - Added #defines so SFR registers are always in XDATA space for 201
but not for other devices.
03/13/02 tbh added macro versions of mcu_begin/end_critical_section(),
redefined those functions to use the macros. _ea became g_ea
06/19/02 tbh added kbm_sdc_stat_flash_prg_err
09/19/02 tbh typo - disable was diable
09/20/02 tbh purged stale ifdefs
10/22/02 cds - added x_pwr_mgmt_ctl register for 97223
- added kbm_smc_stat_mult_emu_err, kbm_msc_stat_mult_emu_err for 97223
10/31/02 ds added mcu_clk bits [3:2] to x_clock_sel register for 97223
12/13/02 cds - updated the pwr_mgmt_ctl & fmc_intf_en register defs for 97223
05/13/03 sbs - added 97226 (223 Nand).
06/06/03 ds added a bitmask to clear all fmc_out_ctl bits.
07/01/03 pjc added kbm_sie_conf_bus_pwr_en for 97c223.
07/11/03 am add hooks for TEST_REG_3 (XDATA 0x3F22) write access for
210/223/226/242 (20x family except 243).
============================================================================*/
//------------------------------------------------------------------------------
// mcu registers
#ifdef k_20x_family
#define k_sfr_mcuregs
#endif
#ifdef k_sfr_mcuregs
#define t_mcu_register sfr
#define at_mcu(__addr) = 0x##__addr
typedef t_data_ref t_mcu_register_ref;
#else
#ifndef __mcu_dot_c__
#define t_mcu_register extern unsigned char volatile xdata
typedef t_xdata_ref t_mcu_register_ref;
#define at_mcu(__addr)
#else
#define t_mcu_register unsigned char volatile xdata
typedef t_xdata_ref t_mcu_register_ref;
#ifdef k_10x_family
#define at_mcu(__addr) _at_ 0x##__addr
#endif
#ifdef k_20x_family
#define at_mcu(__addr) _at_ 0x01##__addr
#endif
#endif
#endif
//+-----------------------------------------------------------------------------
// Name:
// _mcu_register_rd
//
// Declaration:
// t_datum _mcu_register_rd(t_mcu_register reg);
//
// Purpose:
// Read a datum from a mcu specific register.
//
// Arguments:
// reg - the t_mcu_register to be read.
//
// Return:
// The t_datum stored at the register location.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _mcu_register_rd(__ref) ((__ref))
//+-----------------------------------------------------------------------------
// Name:
// _mcu_register_wr
//
// Declaration:
// void _mcu_register_wr(t_mcu_register reg, t_datum datum);
//
// Purpose:
// Write a datum to a mcu specific register.
//
// Arguments:
// reg - the t_mcu_register to be written.
// datum - the t_datum to write to it.
//
// Return:
// None.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _mcu_register_wr(__ref, __datum) (__ref)=(__datum)
//+-----------------------------------------------------------------------------
// Name:
// _mcu_register_setbit
//
// Declaration:
// void _mcu_register_setbit(t_mcu_register reg, t_bit_ix bitix);
//
// Purpose:
// Set a specific bit in a mcu register a logic one level.
//
// Arguments:
// reg - the t_mcu_register to be written.
// bitix - a t_bit_ix representing the index of the bit to set.
//
// Return:
// None.
//
// Notes:
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _mcu_register_setbit(__ref, __bitix) _mcu_register_wr((__ref), _mcu_register_rd((__ref)) |(1 << (__bitix)))
//+-----------------------------------------------------------------------------
// Name:
// _mcu_register_clrbit
//
// Declaration:
// void _mcu_register_clrbit(t_mcu_register reg, t_bit_ix bitix);
//
// Purpose:
// Clear a specific bit in a mcu register a logic zero level.
//
// Arguments:
// reg - the t_mcu_register to be written.
// bitix - a t_bit_ix representing the index of the bit to clear.
//
// Return:
// None.
//
// Notes:
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _mcu_register_clrbit(__ref, __bitix) _mcu_register_wr((__ref), _mcu_register_rd((__ref)) & ~(1 << (__bitix)))
//+-----------------------------------------------------------------------------
// Name:
// _mcu_register_set_bits
//
// Declaration:
// void _mcu_register_set_bits(t_mcu_register reg, t_bit_mask bitmsk);
//
// Purpose:
// Set a group of bits in a mcu register to a logic one level.
//
// Arguments:
// reg - the t_mcu_register to be written.
// bitmsk - a t_bit_mask containing 1's in the bit positions of the bits to be set.
//
// Return:
// None.
//
// Notes:
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _mcu_register_set_bits(__ref, __bitmsk) _mcu_register_wr((__ref), _mcu_register_rd((__ref)) |(__bitmsk))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -