📄 sd.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.
____________________________________________________________________________
____________________________________________________________________________
sd.h - Lun Specific header for the Secure Digital Device
____________________________________________________________________________
comments tbd
____________________________________________________________________________
Revision History
Date Who Comment
________ ___ _____________________________________________________________
09/17/01 cds initial version - all xdata registers are initially defined
here. I've had mixed feelings about splitting up these
registers into the various controller specific headers, but
that may prove confusing and/or difficult to maintain, so
I think it would be best to have all the registers defined
here, then access to registers (via macros or whatever)
can be defined by a file specifically for the controller
11/27/01 cds overrode _lun_enable_mux with fmc code to enable lun data mux
without caller needing to know what specific device is at that
lun.
04/10/02 tbh added register set/clr bit macros
05/28/02 ds Made cosmetic changes to the header
============================================================================*/
//------------------------------------------------------------------------------
// flash memory controller registers
#ifndef __sd_dot_h__
#define __sd_dot_h__
#ifndef __sd_dot_c__
#define t_sd_register extern unsigned char volatile xdata
#define at_sd(__addr)
#else
#define t_sd_register unsigned char volatile xdata
#define at_sd(__addr) _at_ 0x30##__addr
#endif
typedef t_xdata_ref t_sd_register_ref;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_rd(__ref) ((__ref))
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_wr(__ref, __datum) (__ref)=(__datum)
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_setbit(__ref, __bitix) _sd_register_wr((__ref), _sd_register_rd((__ref)) |(1 << (__bitix)))
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_clrbit(__ref, __bitix) _sd_register_wr((__ref), _sd_register_rd((__ref)) & ~(1 << (__bitix)))
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_set_bits(__ref, __bitmsk) _sd_register_wr((__ref), _sd_register_rd((__ref)) |(__bitmsk))
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define _sd_register_clr_bits(__ref, __bitmsk) _sd_register_wr((__ref), _sd_register_rd((__ref)) & ~(__bitmsk))
extern unsigned char volatile xdata sdc_data; // rw SDC Data Register
extern unsigned char volatile xdata sdc_mode_ctl; // rw SDC Model Control Register
extern unsigned char volatile xdata sdc_ctl; // rw SDC Control Register
extern unsigned char volatile xdata sdc_cmd_rsp_buf[17];
extern uint8 xdata temp_buf[64];
//RCA bytes
extern uint8 xdata g_sdc_rca_h ;
extern uint8 xdata g_sdc_rca_l ;
extern uint8 xdata State;
extern uint8 xdata _sd_data_xfer_cmd;
extern uint8 xdata _sd_card_active;//This is a flag to know if the card is not responding
extern uint8 xdata _sd_data_loaded; //Tells me if the buffers are already loaded
//Some useful macros
#define _sd_copy_buf_to_xdata(); \
{ \
temp_buf[0] = _mcu_register_rd(x_sram_data); \
temp_buf[1] = _mcu_register_rd(x_sram_data); \
temp_buf[2] = _mcu_register_rd(x_sram_data); \
temp_buf[3] = _mcu_register_rd(x_sram_data); \
temp_buf[4] = _mcu_register_rd(x_sram_data); \
temp_buf[5] = _mcu_register_rd(x_sram_data); \
temp_buf[6] = _mcu_register_rd(x_sram_data); \
temp_buf[7] = _mcu_register_rd(x_sram_data); \
temp_buf[8] = _mcu_register_rd(x_sram_data); \
temp_buf[9] = _mcu_register_rd(x_sram_data); \
temp_buf[10] = _mcu_register_rd(x_sram_data); \
temp_buf[11] = _mcu_register_rd(x_sram_data); \
temp_buf[12] = _mcu_register_rd(x_sram_data); \
temp_buf[13] = _mcu_register_rd(x_sram_data); \
temp_buf[14] = _mcu_register_rd(x_sram_data); \
temp_buf[15] = _mcu_register_rd(x_sram_data); \
temp_buf[16] = _mcu_register_rd(x_sram_data); \
temp_buf[17] = _mcu_register_rd(x_sram_data); \
temp_buf[18] = _mcu_register_rd(x_sram_data); \
temp_buf[19] = _mcu_register_rd(x_sram_data); \
temp_buf[20] = _mcu_register_rd(x_sram_data); \
temp_buf[21] = _mcu_register_rd(x_sram_data); \
temp_buf[22] = _mcu_register_rd(x_sram_data); \
temp_buf[23] = _mcu_register_rd(x_sram_data); \
temp_buf[24] = _mcu_register_rd(x_sram_data); \
temp_buf[25] = _mcu_register_rd(x_sram_data); \
temp_buf[26] = _mcu_register_rd(x_sram_data); \
temp_buf[27] = _mcu_register_rd(x_sram_data); \
temp_buf[28] = _mcu_register_rd(x_sram_data); \
temp_buf[29] = _mcu_register_rd(x_sram_data); \
temp_buf[30] = _mcu_register_rd(x_sram_data); \
temp_buf[31] = _mcu_register_rd(x_sram_data); \
temp_buf[32] = _mcu_register_rd(x_sram_data); \
temp_buf[33] = _mcu_register_rd(x_sram_data); \
temp_buf[34] = _mcu_register_rd(x_sram_data); \
temp_buf[35] = _mcu_register_rd(x_sram_data); \
temp_buf[36] = _mcu_register_rd(x_sram_data); \
temp_buf[37] = _mcu_register_rd(x_sram_data); \
temp_buf[38] = _mcu_register_rd(x_sram_data); \
temp_buf[39] = _mcu_register_rd(x_sram_data); \
temp_buf[40] = _mcu_register_rd(x_sram_data); \
temp_buf[41] = _mcu_register_rd(x_sram_data); \
temp_buf[42] = _mcu_register_rd(x_sram_data); \
temp_buf[43] = _mcu_register_rd(x_sram_data); \
temp_buf[44] = _mcu_register_rd(x_sram_data); \
temp_buf[45] = _mcu_register_rd(x_sram_data); \
temp_buf[46] = _mcu_register_rd(x_sram_data); \
temp_buf[47] = _mcu_register_rd(x_sram_data); \
temp_buf[48] = _mcu_register_rd(x_sram_data); \
temp_buf[49] = _mcu_register_rd(x_sram_data); \
temp_buf[50] = _mcu_register_rd(x_sram_data); \
temp_buf[51] = _mcu_register_rd(x_sram_data); \
temp_buf[52] = _mcu_register_rd(x_sram_data); \
temp_buf[53] = _mcu_register_rd(x_sram_data); \
temp_buf[54] = _mcu_register_rd(x_sram_data); \
temp_buf[55] = _mcu_register_rd(x_sram_data); \
temp_buf[56] = _mcu_register_rd(x_sram_data); \
temp_buf[57] = _mcu_register_rd(x_sram_data); \
temp_buf[58] = _mcu_register_rd(x_sram_data); \
temp_buf[59] = _mcu_register_rd(x_sram_data); \
temp_buf[60] = _mcu_register_rd(x_sram_data); \
temp_buf[61] = _mcu_register_rd(x_sram_data); \
temp_buf[62] = _mcu_register_rd(x_sram_data); \
temp_buf[63] = _mcu_register_rd(x_sram_data); \
}
#define _sd_copy_xdata_to_buf(); \
{ \
_mcu_register_wr(x_sram_data, temp_buf[0]); \
_mcu_register_wr(x_sram_data, temp_buf[1]); \
_mcu_register_wr(x_sram_data, temp_buf[2]); \
_mcu_register_wr(x_sram_data, temp_buf[3]); \
_mcu_register_wr(x_sram_data, temp_buf[4]); \
_mcu_register_wr(x_sram_data, temp_buf[5]); \
_mcu_register_wr(x_sram_data, temp_buf[6]); \
_mcu_register_wr(x_sram_data, temp_buf[7]); \
_mcu_register_wr(x_sram_data, temp_buf[8]); \
_mcu_register_wr(x_sram_data, temp_buf[9]); \
_mcu_register_wr(x_sram_data, temp_buf[10]); \
_mcu_register_wr(x_sram_data, temp_buf[11]); \
_mcu_register_wr(x_sram_data, temp_buf[12]); \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -