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

📄 s12_sci.h

📁 PWM Generation Using HCS12 Timer Channels
💻 H
字号:
/*****************************************************************************/
/*                                             COPYRIGHT (c) MOTOROLA 2002   */
/*                                                                           */
/* File Name          :    $RCSfile: s12_sci.h,v $							 */
/*                                                                           */
/* Current Revision :      $Revision: 1.2 $                                  */
/*                                                                           */
/* PURPOSE: header file for HCS12 SCI register block	   			 		 */
/*                                                                           */
/*  ***********************************************************************  */
/*  *  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 SCI register block as a datastructure of        */
/*               type tSCI.                                                  */
/* 																		     */
/* SCI module base address (out of reset) -                                  */
/*                                                                           */
/* S12DP256      : (SCI0) 0x00C8, (SCI1) 0x00D0                              */
/*																			 */
/* 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  	09/05/00                                                 */
/* 1.01	r32151  	10/05/00  	- fixed missing terminator on 2 comments     */
/*     							- Changed #include <s12_common.h> 		     */
/* 							      to #include "s12_common.h"			     */
/* 1.02 r32151      28/01/02	- changed bit name in tSCISR1 from 'or' to   */
/*                                'orf' to avoid clash with C reserved word. */
/* 1.1  r32151      11/03/02	- Added disclaimer and reformated file info. */
/*                              - Modified revision numbering to match RCS   */
/* 1.2  r32151      14/03/02	- made all registers volatile 	 			 */
/*                              - changed tU08 declarations in structure to  */
/*                                tREG08 to standardise all accesses as      */
/*                                using .bit or .byte format                 */
/*                                                                           */
/*===========================================================================*/
/* 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_SCI_H			/*prevent duplicated includes */
#define S12_SCI_H

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

typedef union uSCIBDH
  {
  tU08	byte;
  struct
    {
    tU08 sbr8	:1;		/*msb baud rate select bits	*/
    tU08 sbr9	:1;
    tU08 sbr10	:1;
    tU08 sbr11	:1;
    tU08 sbr12	:1;
    tU08 		:3;		/*not used */
    }bit;
  }tSCIBDH;

#define SBR8	0x01	/*bit masks	*/
#define SBR9	0x02
#define SBR10	0x04
#define SBR11	0x08
#define SBR12	0x10

typedef union
  {
  tU16	word;
  struct
    {
    tSCIBDH	msb;
    tU08	lsb;
    }byte;
  }tSCIBD;

typedef union uSCICR1
  {
  tU08	byte;
  struct
    {
    tU08 pt			:1;		/*parity type */
    tU08 pe			:1;		/*parity enable	*/
    tU08 ilt		:1;		/*idle line type */
    tU08 wake		:1;		/*wake up by address mark/idle */
    tU08 m			:1;		/*mode select */
    tU08 rsrc		:1;		/*receiver source */
    tU08 sciswai	:1;		/*stop in wait mode	*/
    tU08 loops		:1;		/*loop mode/single wire mode enable	*/
    }bit;
  }tSCICR1;

#define PT		0x01	/*bit masks	*/
#define PE		0x02
#define ILT		0x04
#define WAKE	0x08
#define M	    0x10
#define RSRC	0x20
#define SCISWAI	0x40
#define LOOPS	0x80

typedef union uSCICR2
  {
  tU08	byte;
  struct
    {
    tU08 sbk	:1;		/*send break character */
    tU08 rwu	:1;		/*receiver wake-up control */
    tU08 re		:1;		/*receiver enable */
    tU08 te		:1;		/*transmitter enable */
    tU08 ilie	:1;		/*idle line interrupt enable */
    tU08 rie	:1;		/*receiver interrupt enable	*/
    tU08 tcie	:1;		/*transmit complete interrupt enable */
    tU08 tie	:1;		/*transmit interrupt enable	*/
    }bit;
  }tSCICR2;

#define SBK		0x01	/*bit masks	*/
#define RWU		0x02
#define RE		0x04
#define TE		0x08
#define ILIE	0x10
#define RIE		0x20
#define TCIE	0x40
#define TIE		0x80

typedef union uSCISR1
  {
  tU08	byte;
  struct
    {
    tU08 pf		:1;		/*parity error flag	*/
    tU08 fe		:1;		/*framing error flag */
    tU08 nf		:1;		/*noise error flag */
    tU08 orf	:1;		/*overrun error flag - 'or' in specification */
    tU08 idle	:1;		/*idle line detected flag */
    tU08 rdrf	:1;		/*receive data register full flag */
    tU08 tc		:1;		/*transmit complete flag */
    tU08 tdre	:1;		/*transmit data register empty flag	*/
    }bit;
  }tSCISR1;

#define PF		0x01	/*bit masks	*/
#define FE		0x02
#define NF		0x04
#define ORF		0x08	/* 'OR' in specification */
#define IDLE	0x10
#define RDRF	0x20
#define TC		0x40
#define TDRE	0x80

typedef union uSCISR2
  {
  tU08	byte;
  struct
    {
    tU08 raf	:1;		/*receiver active flag */
	tU08 txdir	:1;		/*receiver active flag */
    tU08		:6;		/*not used */
    }bit;
  }tSCISR2;

#define RAF		0x01	/*bit masks	*/
#define TXDIR	0x02	/*bit masks	*/

typedef union uSCIDRH
  {
  tU08	byte;
  struct
    {
    tU08		:6;		/*not used */
    tU08 t8		:1;		/*transmit bit 8 */
    tU08 r8		:1;		/*receive bit 8	*/
    }bit;
  }tSCIDRH;

#define T8		0x40	/*bit masks	*/
#define R8		0x80

typedef struct				/*sci datastructure	*/
  {
  volatile tSCIBD	scibd;	/*WORD - sci baud rate register(s) */
  volatile tSCICR1	scicr1;	/*sci control register 1 */
  volatile tSCICR2	scicr2;	/*sci control register 2 */
  volatile tSCISR1	scisr1;	/*sci status register 1	*/
  volatile tSCISR2	scisr2;	/*sci status register 2	*/
  volatile tSCIDRH	scidrh;	/*sci data register high */
  volatile tREG08	scidrl;	/*sci data register low	*/
  }tSCI;


#endif /*S12_SCI_H */

⌨️ 快捷键说明

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