Last change
on this file since 12682 was 10588, checked in by neise, 14 years ago |
added MSR Firmware
MSR is the little brother of FSC
|
File size:
1.6 KB
|
Line | |
---|
1 | /************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* Several helpful definitions */
|
---|
4 | /* */
|
---|
5 | /* Author: Peter Dannegger */
|
---|
6 | /* */
|
---|
7 | /************************************************************************/
|
---|
8 | #ifndef _mydefs_h_
|
---|
9 | #define _mydefs_h_
|
---|
10 |
|
---|
11 |
|
---|
12 | // Easier type writing:
|
---|
13 |
|
---|
14 | typedef unsigned char u8;
|
---|
15 | typedef signed char s8;
|
---|
16 | typedef unsigned short u16;
|
---|
17 | typedef signed short s16;
|
---|
18 | typedef unsigned long u32;
|
---|
19 | typedef signed long s32;
|
---|
20 |
|
---|
21 |
|
---|
22 | // Access bits like variables:
|
---|
23 |
|
---|
24 | struct bits {
|
---|
25 | u8 b0:1;
|
---|
26 | u8 b1:1;
|
---|
27 | u8 b2:1;
|
---|
28 | u8 b3:1;
|
---|
29 | u8 b4:1;
|
---|
30 | u8 b5:1;
|
---|
31 | u8 b6:1;
|
---|
32 | u8 b7:1;
|
---|
33 | } __attribute__((__packed__));
|
---|
34 |
|
---|
35 | #define SBIT_(port,pin) ((*(volatile struct bits*)&port).b##pin)
|
---|
36 | #define SBIT(x,y) SBIT_(x,y)
|
---|
37 |
|
---|
38 |
|
---|
39 | // Optimization improvements
|
---|
40 |
|
---|
41 | // always inline function x:
|
---|
42 |
|
---|
43 | #define AIL(x) static x __attribute__ ((always_inline)); static x
|
---|
44 |
|
---|
45 |
|
---|
46 | // never inline function x:
|
---|
47 |
|
---|
48 | #define NIL(x) x __attribute__ ((noinline)); x
|
---|
49 |
|
---|
50 |
|
---|
51 | // volatile access (reject unwanted removing access):
|
---|
52 |
|
---|
53 | #define vu8(x) (*(volatile u8*)&(x))
|
---|
54 | #define vs8(x) (*(volatile s8*)&(x))
|
---|
55 | #define vu16(x) (*(volatile u16*)&(x))
|
---|
56 | #define vs16(x) (*(volatile s16*)&(x))
|
---|
57 | #define vu32(x) (*(volatile u32*)&(x))
|
---|
58 | #define vs32(x) (*(volatile s32*)&(x))
|
---|
59 |
|
---|
60 |
|
---|
61 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.