www.pudn.com > ARM-Cortex-M3.zip > RegisterAccess.c, change:2007-11-22,size:2376b


/****************************************Copyright (c)***************************************************** 
**                               Guangzhou ZHIYUAN electronics Co.,LTD. 
**                                      
**                                 http:// www.embedtools.com 
** 
**--------------File Info---------------------------------------------------------------------------------- 
** File Name:          RegisterAccess.c 
** Last modified Date: 2007.11.9  
** Last Version:       V1.0 
** Description:        Stellaris系列单片机寄存器访问 
**  
**--------------------------------------------------------------------------------------------------------- 
** Created By:         kang qinhua 
** Created date:       2007.11.9 
** Version:            V1.0 
** Descriptions:       初始版本 
** 
**--------------------------------------------------------------------------------------------------------- 
** Modified by:         
** Modified date:       
** Version:             
** Description: 
** 
**********************************************************************************************************/ 
 
#define HWREG(x)			(*((volatile unsigned long *)(x))) 
#define HWREGH(x)			(*((volatile unsigned short *)(x))) 
#define HWREGB(x)			(*((volatile unsigned char *)(x))) 
 
/********************************************************************************************************** 
** Function name:      main 
** Descriptions:       主函数 
** input parameters:   无 
** output parameters:  无 
** Returned value:     无    
**********************************************************************************************************/ 
int main( void ) 
{ 
	unsigned long temp32; 
	 
	HWREG(0x20000000) = 0xAA55AA55;		                                /* 向0x20000000地址写0xAA55AA55 */ 
	temp32 = HWREG(0x20000000);			                                /* 读0x20000000地址内容         */ 
	if( temp32 != 0xAA55AA55 ) {			                            /* 比较写入与读出的内容是否一致 */ 
	    while(1) { 
	       ;					                                        /* 写入与读出不一致             */ 
	    } 
	} 
	while(1) { 
	    ; 
	} 
} 
/********************************************************************************************************* 
  END FILE 
*********************************************************************************************************/