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

📄 s12_eeprom.h

📁 PWM Generation Using HCS12 Timer Channels
💻 H
字号:
/*****************************************************************************/
/*                                             COPYRIGHT (c) MOTOROLA 2002   */
/*                                                                           */
/* File Name          :    $RCSfile: s12_eeprom.h,v $  						 */
/*                                                                           */
/* Current Revision :      $Revision: 1.2 $									 */
/*                                                                           */
/*  ***********************************************************************  */
/*  *  THIS CODE IS ONLY INTENDED AS AN EXAMPLE OF CODE FOR THE           *  */
/*  *  METROWERKS COMPILER AND THE STAR12 EVB AND HAS ONLY BEEN GIVEN A   *  */
/*  *  MIMIMUM LEVEL OF TEST. IT IS PROVIDED 'AS SEEN' WITH NO GUARANTEES *  */
/*  *  AND NO PROMISE OF SUPPORT.                                         *  */
/*  ***********************************************************************  */
/*                                                                           */
/*                                                                           */
/* DESCRIPTION:  Defines the EEPROM control registers block as a 			 */
/*               datastructure of type tEEPROM.                              */
/* 																		     */
/* EEPROM control module base address (out of reset) -                       */
/*                                                                           */
/* S12DP256      : 0x0110                                                    */
/*																			 */
/* The datastructure compiled can be determined by the #define's S12DP256,   */
/* S12xxx, etc. These definitions can be found in "s12_common.h".            */
/* The MCU id can be #defined in a "target.h" header file or included as a   */
/* complier command line argument as -DS12DP256.                             */
/* Currently only S12DP256 is supported.									 */
/*																			 */
/* Multiple register descriptions are used when a differing bit structure    */
/* exists between parts. In the case of additional bit definitions within    */
/* the same register, then only the full register description is used.       */
/*                                                                           */
/*                                                                           */
/* AUTHOR: R32151            LOCATION: SPSEKB      LAST EDIT DATE: 14/03/02  */
/*                                                                           */
/* UPDATE HISTORY                                                            */
/* REV  AUTHOR       DATE       DESCRIPTION OF CHANGE                        */
/* ---  ------      --------    ---------------------                        */
/* 1.00	r32151  	11/05/00                                                 */
/* 1.01	r32151  	25/05/00  	- Corrected declaration of rsvee2 (reserved  */
/*                                area for test). 		                     */
/* 1.1  r32151      11/03/02	- Added disclaimer and reformated file info. */
/*                              - Modified revision numbering to match RCS   */
/* 1.2  r32151      14/03/02	- Declared all registers volatile 	 	     */
/*                                                                           */
/*===========================================================================*/
/* Motorola reserves the right to make changes without further notice to any */
/* product herein to improve reliability, function, or design. Motorola does */
/* not assume any  liability arising  out  of the  application or use of any */
/* product,  circuit, or software described herein;  neither  does it convey */
/* any license under its patent rights  nor the  rights of others.  Motorola */
/* products are not designed, intended,  or authorized for use as components */
/* in  systems  intended  for  surgical  implant  into  the  body, or  other */
/* applications intended to support life, or  for any  other application  in */
/* which the failure of the Motorola product  could create a situation where */
/* personal injury or death may occur. Should Buyer purchase or use Motorola */
/* products for any such intended  or unauthorized  application, Buyer shall */
/* indemnify and  hold  Motorola  and its officers, employees, subsidiaries, */
/* affiliates,  and distributors harmless against all claims costs, damages, */
/* and expenses, and reasonable  attorney  fees arising  out of, directly or */
/* indirectly,  any claim of personal injury  or death  associated with such */
/* unintended or unauthorized use, even if such claim alleges that  Motorola */
/* was negligent regarding the  design  or manufacture of the part. Motorola */
/* and the Motorola logo* are registered trademarks of Motorola Ltd.         */
/*****************************************************************************/

#ifndef S12_EEPROM_H			/*prevent duplicated includes */
#define S12_EEPROM_H

#ifndef S12_COMMON_H			/*prevent duplicated includes */
#include "s12_common.h"
#endif

typedef union uECLKDIV
  {
  tU08	byte;
  struct
    {
    tU08 ediv	:6;		/*clk divider */
    tU08 ediv8	:1;		/*clk /8 prescaler enable */
    tU08 edivld	:1;		/*clock divider loaded flag */
    }bit;
  }tECLKDIV;

#define EDIV	0x3F	/*bit masks	*/
#define EDIV8	0x40
#define EDIVLD	0x80

typedef union uECNFG
  {
  tU08	byte;
  struct
    {
    tU08		:4;		/*not used */
    tU08 eswai	:1;		/*eeprom stopped in wait mode */
    tU08		:1;		/*not used */
    tU08 ccie	:1;		/*command complete interrupt enable */
    tU08 cbeie	:1;		/*command buffer empty interrupt enable	*/
    }bit;
  }tECNFG;

#define ESWAI	0x10	/*bit masks	*/
#define CCIE	0x40	
#define CCBIE	0x80

typedef union uEPROT
  {
  tU08	byte;
  struct
    {
    tU08 ep			:3;		/*protection block size: (ep+1)*64 bytes */
    tU08 epdis		:1;		/*protection disable */
    tU08 			:3;		/*contain value of equivalent bits in protection byte */
    tU08 eopen		:1;		/*open block for program/erase */
    }bit;
  }tEPROT;

#define EP0		0x01	/*bit masks	*/
#define EP1		0x02
#define EP2		0x04	
#define EP		0x07	/*ep block mask */
#define EPDIS   0x08
#define EOPEN	0x80

typedef union uESTAT
  {
  tU08	byte;
  struct
    {
    tU08 		:2;		/*not used */
    tU08 blank	:1;		/*blank verify flag */
    tU08 		:1;		/*not used */
    tU08 accerr	:1;		/*access error flag */
    tU08 pviol	:1;		/*protection violation flag */
    tU08 ccif	:1;		/*command complete interrupt flag */
    tU08 cbeif	:1;		/*command buffer empty interrupt flag */
    }bit;
  }tESTAT;

#define BLANK	0x04	/*bit masks	*/
#define ACCERR	0x10
#define PVIOL 	0x20
#define CCIF	0x40
#define CBEIF	0x80

typedef union uECMD
  {
  tU08	byte;
  struct
    {
    tU08 mass	:1;		/*mass erase enable	*/
	tU08 		:1;		/*not used */
    tU08 erver	:1;		/*erase verify enable */
	tU08 		:2;		/*not used */
    tU08 prog	:1;		/*word programming */
    tU08 erase	:1;		/*erase control */
	tU08 		:1;		/*not used */
    }bit;
  }tECMD;

#define MASS	0x01	/*bit masks	*/
#define ERVER	0x04
#define PROG	0x20
#define ERASE	0x40


typedef struct						/*eeprom datastructure */
  {
  volatile tECLKDIV		eclkdiv;	/*eeprom clock divider register */
		   tU08			rsvee1[2];	/*reserved */
  volatile tECNFG		ecnfg;		/*eeprom configuration register */
  volatile tEPROT		eprot;		/*eeprom protection register */
  volatile tESTAT		estat;		/*eeprom status register */
  volatile tECMD		ecmd;		/*eeprom command buffer & status register */
		   tU08			rsvee2[5];	/*reserved */
  }tEEPROM;


#endif /*S12_EEPROM_H */

⌨️ 快捷键说明

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