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

📄 types.h

📁 基于FREESCALE MC56F802 BLDC的源程序
💻 H
字号:
/*****************************************************************************
*
* Motorola Inc.
* (c) Copyright 2000 Motorola, Inc.
* ALL RIGHTS RESERVED.
*
******************************************************************************
*
* File Name: types.h
*
* Description: structures, prototypes, definitions for portable code
*              ITU definition of intrinsic functions
*
* Modules Included:
*
*****************************************************************************/


#ifndef __TYPES_H
#define __TYPES_H

#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************
* Target designation
*******************************************************/

/* MetroWerks defines __m56800__ */


/*******************************************************
* C Constructs
*******************************************************/

#define ITU_INTRINSICS


/*******************************************************
* Basic Types 
*******************************************************/

/* Generic word types for ITU compatibility */
typedef short          Word16;
typedef unsigned short UWord16;
typedef long           Word32;
typedef unsigned long  UWord32;

typedef int            Int16;
typedef unsigned int   UInt16;
typedef long           Int32;
typedef unsigned long  UInt32;

/* Fractional data types for portability */
typedef short          Frac16;
typedef long           Frac32;

typedef struct {
   Frac16     real;
   Frac16     imag;
} CFrac16;

typedef struct {
   Frac32     real;
   Frac32     imag;
} CFrac32;


/* Useful definitions */

/* Convert int/float to Frac16; constant x generates compile time constant */
//#define FRAC16(x) ((Frac16)((x) < (1- 2^(-15)) ? ((x) >= -1 ? (x)*0x8000 : 0x8000) : 0x7FFF))
#define FRAC16(x) ((Frac16)((x) < 0.999969482421875 ? ((x) >= -1 ? (x)*0x8000 : 0x8000) : 0x7FFF))


/* Miscellaneous types */
typedef int            Flag;

typedef int            Result;

#ifndef COMPILER_HAS_BOOL
typedef int            bool;
#endif



/*******************************************************
* Constants
*******************************************************/
/* Function Result Values */
#define PASS           0
#define FAIL           -1

#ifndef COMPILER_HAS_BOOL
#define true           1
#define false          0
#endif

#ifndef NULL
#define NULL           ((void *)0)  /* or for C++   #define NULL 0    */
#endif

/*******************************************************
* Implementation Limits 
*******************************************************/
#define PORT_MAX_VECTOR_LEN  8192



/******************************************************/
/* Name mappings for DSP code portability             */
/******************************************************/

/* void setnostat (void); */
#define setnosat   archSetNoSat

/* void setstat32 (void); */
#define setsat32   archSetSat32

/* void Stop (void); */
#define Stop        archStop

/* void Trap (void); */
#define Trap        archTrap

/* void Wait (void); */
#define Wait        archWait

/* void EnableInt (void); */
#define EnableInt   archEnableInt

/* void DisableInt (void); */
#define DisableInt  archDisableInt



#define MAX_32 (Word32)0x7fffffffL
#define MIN_32 (Word32)0x80000000L

#define MAX_16 (Word16)0x7fff
#define MIN_16 (Word16)0x8000



/******************************************************* 

   Predefined basic intrinsics. 

   Builtin support for these functions will be implemented 
   in the CodeWarrior C compiler code generator in Release 3.0.

   The intrinsic functions are defined in the compiler
   defined functions name space. They are redefined here
   according to the ETSI naming convention.

 ******************************************************/

/************************************/
/* Fractional arithmetic primitives */
/************************************/

#define add             __add
#define sub             __sub
#define abs_s           __abs
#define mult            __mult
#define mult_r          __mult_r
#define negate          __negate
#define extract_h       __extract_h
#define round           __round
#define extract_l       __extract_l
#define shl             __shl
#define shr             __shr
#define shr_r           __shr_r
#define div_s           __div

/*****************************************/
/* Long Fractional arithmetic primitives */
/*****************************************/

#define L_add           _L_add
#define L_sub           _L_sub
#define L_negate        _L_negate
#define L_abs           __labs
#define mac_r           __mac_r
#define msu_r           __msu_r
#define L_mult          _L_mult
#define L_mac           _L_mac
#define L_msu           _L_msu
#define L_shl           _L_shl
#define L_shr           _L_shr
#define L_shr_r         _L_shr_r
#define L_deposit_l     _L_deposit_l
#define L_deposit_h     _L_deposit_h
#define norm_s          __norm_s
#define norm_l          __norm_l

/* defined by MetroWerks but not by ITU */
#define div_ls          __div_ls
#define L_mult_ls       _L_mult_ls



#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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