Fraise
2.1
FRAmework for Interfacing Software and Electronics
typedefs.h
1
/*********************************************************************
2
*
3
* Microchip USB C18 Firmware Version 1.0
4
*
5
*********************************************************************
6
* FileName: typedefs.h
7
* Dependencies: See INCLUDES section below
8
* Processor: PIC18
9
* Compiler: C18 2.30.01+/sdcc
10
* Company: Microchip Technology, Inc.
11
*
12
* Software License Agreement
13
*
14
* The software supplied herewith by Microchip Technology Incorporated
15
* (the 'Company') for its PICmicroŽ Microcontroller is intended and
16
* supplied to you, the Company's customer, for use solely and
17
* exclusively on Microchip PICmicro Microcontroller products. The
18
* software is owned by the Company and/or its supplier, and is
19
* protected under applicable copyright laws. All rights are reserved.
20
* Any use in violation of the foregoing restrictions may subject the
21
* user to criminal sanctions under applicable laws, as well as to
22
* civil liability for the breach of the terms and conditions of this
23
* license.
24
*
25
* THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES,
26
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
27
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
28
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
29
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
30
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
31
*
32
* Author Date Comment
33
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
* Rawin Rojvanit 7/21/04 Original.
35
********************************************************************/
36
37
#ifndef TYPEDEFS_H
38
#define TYPEDEFS_H
39
40
41
typedef
unsigned
char
byte;
// 8-bit
42
typedef
unsigned
int
word;
// 16-bit
43
typedef
unsigned
long
dword;
// 32-bit
44
45
typedef
union
_BYTE
46
{
47
/*byte _byte;*/
48
struct
{
49
unsigned
_byte: 8;
// by calling something._byte, you get the whole bitfield as 8-bit number
50
};
51
struct
52
{
53
unsigned
b0: 1;
54
unsigned
b1: 1;
55
unsigned
b2: 1;
56
unsigned
b3: 1;
57
unsigned
b4: 1;
58
unsigned
b5: 1;
59
unsigned
b6: 1;
60
unsigned
b7: 1;
61
};
62
}
BYTE
;
63
64
typedef
union
_WORD
65
{
66
word _word;
67
struct
68
{
69
byte
byte0;
70
byte
byte1;
71
};
72
struct
73
{
74
BYTE
Byte0;
75
BYTE
Byte1;
76
};
77
struct
78
{
79
BYTE
LowB;
80
BYTE
HighB;
81
};
82
struct
83
{
84
byte
v[2];
85
};
86
}
WORD
;
87
#define LSB(a) ((a).v[0])
88
#define MSB(a) ((a).v[1])
89
90
typedef
union
_DWORD
91
{
92
dword _dword;
93
struct
94
{
95
byte
byte0;
96
byte
byte1;
97
byte
byte2;
98
byte
byte3;
99
};
100
struct
101
{
102
word word0;
103
word word1;
104
};
105
struct
106
{
107
BYTE
Byte0;
108
BYTE
Byte1;
109
BYTE
Byte2;
110
BYTE
Byte3;
111
};
112
struct
113
{
114
WORD
Word0;
115
WORD
Word1;
116
};
117
struct
118
{
119
byte
v[4];
120
};
121
}
DWORD
;
122
#define LOWER_LSB(a) ((a).v[0])
123
#define LOWER_MSB(a) ((a).v[1])
124
#define UPPER_LSB(a) ((a).v[2])
125
#define UPPER_MSB(a) ((a).v[3])
126
127
typedef
void(*pFunc)(void);
128
129
130
typedef
enum
_BOOL { FALSE = 0, TRUE } BOOL;
131
132
#define OK TRUE
133
#define FAIL FALSE
134
135
#endif //TYPEDEFS_H
_BYTE
Definition:
typedefs.h:45
_DWORD
Definition:
typedefs.h:90
_WORD
Definition:
typedefs.h:64
pic
core
typedefs.h
Generated on Fri Mar 29 2024 12:27:22 for Fraise by
1.8.17