123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /************************************************************************
- Project: Welling Motor Control Paltform
- Filename: typedefine.h
- Partner Filename: N/A
- Description: Data type define
- Complier: IAR Embedded Workbench for ARM 7.80.4
- CPU TYPE : GD32F1x0
- *************************************************************************
- Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
- All rights reserved.
- *************************************************************************
- *************************************************************************
- Revising History (ECL of this file):
- ************************************************************************/
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives
- *************************************************************************/
- #ifndef TYPEDEFINE_H
- #define TYPEDEFINE_H
- /************************************************************************
- Definitions & Macros (N/A)
- ************************************************************************/
- /************************************************************************
- Typedefs & Structures Defines
- ************************************************************************/
- typedef signed char _SBYTE;
- typedef unsigned char _UBYTE;
- typedef signed short _SWORD;
- typedef unsigned short _UWORD;
- typedef signed int _SINT;
- typedef unsigned int _UINT;
- typedef signed long _SLONG;
- typedef unsigned long _ULONG;
- typedef signed long long _SQWORD;
- typedef unsigned long long _UQWORD;
- typedef void VOID;
- typedef unsigned char UBYTE; // One byte unsigned
- typedef signed char SBYTE; // One byte signed
- typedef unsigned short UWORD; // Two bytes unsigned
- typedef signed short SWORD; // Two bytes signed
- typedef unsigned long ULONG; // Four bytes unsigned
- typedef signed long SLONG; // Four bytes signed
- typedef signed long long SQWORD;
- typedef unsigned long long UQWORD;
- #define _IQ30(A) (SLONG)(A * 1073741824L) // Q15
- #define _IQ21(A) (SLONG)(A * 2097152L) // Q15
- #define _IQ20(A) (SLONG)(A * 1048576L) // Q14
- #define _IQ19(A) (SLONG)(A * 524288L) // Q13
- #define _IQ18(A) (SLONG)(A * 262144L) // Q12
- #define _IQ17(A) (SLONG)(A * 131072L) // Q11
- #define _IQ16(A) (SLONG)(A * 65536L) // Q10
- #define _IQ15(A) (SLONG)(A * 32768L) // Q15
- #define _IQ14(A) (SLONG)(A * 16384L) // Q14
- #define _IQ13(A) (SLONG)(A * 8192L) // Q13
- #define _IQ12(A) (SLONG)(A * 4096L) // Q12
- #define _IQ11(A) (SLONG)(A * 2048L) // Q11
- #define _IQ10(A) (SLONG)(A * 1024L) // Q10
- #define _IQ9(A) (SLONG)(A * 512L) // Q9
- #define _IQ8(A) (SLONG)(A * 256L) // Q8
- #define _IQ7(A) (SLONG)(A * 128L) // Q7
- #define _IQ6(A) (SLONG)(A * 64L) // Q6
- #define _IQ5(A) (SLONG)(A * 32L) // Q5
- #define _IQ4(A) (SLONG)(A * 16L) // Q4
- #define _IQ3(A) (SLONG)(A * 8L) // Q3
- #define _IQ2(A) (SLONG)(A * 4L) // Q2
- #define _IQ1(A) (SLONG)(A * 2L) // Q1
- #define _IQ0(A) (SLONG)(A * 1L) // Q0
- #define _IQ(A) _IQ14(A) // Global IQ
- typedef enum
- {
- FALSE = 0,
- TRUE = !FALSE
- } BOOL;
- #ifndef NULL /* set null ((void *)0) */
- #define NULL (void *)0
- #endif
- /*---------------------------------------------------------------------*/
- typedef union
- {
- struct
- {
- UBYTE low;
- SBYTE hi;
- } sb;
- SWORD sw;
- } SWORD_UNION;
- /*---------------------------------------------------------------------*/
- typedef union
- {
- struct
- {
- UWORD low;
- SWORD hi;
- } sw;
- SLONG sl;
- } SLONG_UNION;
- /*---------------------------------------------------------------------*/
- typedef union
- {
- struct
- {
- UWORD low;
- UWORD hi;
- } uw;
- ULONG ul;
- } ULONG_UNION;
- /*---------------------------------------------------------------------*/
- typedef union
- {
- struct
- {
- UBYTE b0 : 1;
- UBYTE b1 : 1;
- UBYTE b2 : 1;
- UBYTE b3 : 1;
- UBYTE b4 : 1;
- UBYTE b5 : 1;
- UBYTE b6 : 1;
- UBYTE b7 : 1;
- } bit;
- UBYTE ub;
- } UBYTE_UNION;
- /*---------------------------------------------------------------------*/
- typedef union
- {
- struct
- {
- UWORD b0 : 1;
- UWORD b1 : 1;
- UWORD b2 : 1;
- UWORD b3 : 1;
- UWORD b4 : 1;
- UWORD b5 : 1;
- UWORD b6 : 1;
- UWORD b7 : 1;
- UWORD b8 : 1;
- UWORD b9 : 1;
- UWORD b10 : 1;
- UWORD b11 : 1;
- UWORD b12 : 1;
- UWORD b13 : 1;
- UWORD b14 : 1;
- UWORD b15 : 1;
- } bit;
- struct
- {
- UBYTE low;
- UBYTE hi;
- } ub;
- UWORD uw;
- } UWORD_UNION;
- typedef union
- {
- struct
- {
- ULONG low;
- ULONG hi;
- } ul;
- UQWORD uq;
- } UQWORD_UNION;
- /************************************************************************
- Exported Variables (N/A)
- ************************************************************************/
- /************************************************************************
- Ram Allocation (N/A)
- ************************************************************************/
- /************************************************************************
- Exported Function Call Prototypes (N/A)
- ************************************************************************/
- /************************************************************************
- Local Function Call Prototypes (N/A)
- ************************************************************************/
- /************************************************************************
- Flag Define (N/A)
- ************************************************************************/
- #endif
- /************************************************************************
- Copyright (c) 2017 Welling Motor Technology(Shanghai) Co. Ltd.
- All rights reserved.
- *************************************************************************
- End of this File (EOF)!
- Do not put anything after this part!
- ************************************************************************/
|