DSO138_SourceCodes_v037.rar
[DSO138] / Common.h
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 //      Filename:       Common.h
4 //      Version:                
5 //      Data:           
6 //
7 //      Author:         Liu, Zemin
8 //      Company:        JYE Tech
9 //
10 //-----------------------------------------------------------------------------
11 //
12 //      Target:                 STM32F103C8 
13 //      Tool chain:     CodeSourcery G++
14 //
15 //
16 //-----------------------------------------------------------------------------
17 //      Required files:
18 //
19 //-----------------------------------------------------------------------------
20 //      Notes:
21 //
22 //
23 //-----------------------------------------------------------------------------
24 //      Revision History:
25 //
26 ///////////////////////////////////////////////////////////////////////////////
27 //
28
29 #ifndef Common_h
30
31 #define Common_h
32
33 typedef unsigned char           U8;
34 typedef signed char             S8;
35 typedef unsigned short int      U16;
36 typedef signed short int        S16;
37 typedef unsigned long           U32;
38 typedef signed long             S32;
39
40 typedef void    (*FuncPointer)(U8); 
41 typedef void    (*CmdFuncPointer)(void); 
42 typedef void    (*StateAction)(void); 
43
44 // -- Control debug code generation
45 //#define       _Debug_
46
47 // ============= Macro definitions ===========================
48
49 #define BitSet(word, bit_mask)          ((word) |= (bit_mask))
50 #define BitClr(word, bit_mask)          ((word) &= ~(bit_mask))
51 #define BitTest(word, bit_mask)         ((word) & (bit_mask))
52 #define BitAnd(word, bit_mask)          ((word) &= (bit_mask))
53 #define BitOr(word, bit_mask)           ((word) |= (bit_mask))
54 #define BitXor(word, bit_mask)          ((word) ^= (bit_mask))
55
56 #define Port_BitSet(port, bit_mask)     (port->BSRR = bit_mask)
57 #define Port_BitClr(port, bit_mask)     (port->BRR = bit_mask)
58
59 #define SetToLow(port, bit_mask)                (port->BRR = bit_mask)          
60 #define SetToHigh(port, bit_mask)       (port->BSRR = bit_mask)         
61
62
63 // ===========================================================
64 //      Function Prototype Declarations
65 // ===========================================================
66 //
67 void    Delay(U16 count);
68
69 #endif // Common_h 
70