PIC24 Support Libraries
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
lib
include
pic24_generic.h
Go to the documentation of this file.
1
/*
2
* "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
3
* All rights reserved.
4
* (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
5
* (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
6
* (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
7
*
8
* Permission to use, copy, modify, and distribute this software and its
9
* documentation for any purpose, without fee, and without written agreement is
10
* hereby granted, provided that the above copyright notice, the following
11
* two paragraphs and the authors appear in all copies of this software.
12
*
13
* IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
14
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
15
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
16
* HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
*
18
* THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21
* ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
22
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
23
*
24
* Please maintain this header in its entirety when copying/modifying
25
* these files.
26
*
27
*
28
*/
29
30
31
// Documentation for this file. If the \file tag isn't present,
32
// this file won't be documented.
33
/** \file
34
* Typedefs and structures to allow for generic 8-, 16-, 32-, and 64-bit
35
* variables.
36
*/
37
38
#ifndef _PIC24_GENERIC_H_
39
#define _PIC24_GENERIC_H_
40
41
/** Older compiler versions did not have C99 fixed-width type
42
definitions. Provide them if necessary. */
43
#if __C30_VERSION__ < 325
44
45
/** unsigned 8-bit integers
46
* \note Prefix for all uint8s is <em>u8_</em>
47
*/
48
typedef
unsigned
char
uint8_t
;
//8 bits
49
/** unsigned 16-bit integers
50
* \note Prefix for all uint16s is <em>u16_</em>
51
*/
52
typedef
unsigned
int
uint16_t
;
//16 bits
53
/** unsigned 32-bit integers
54
* \note Prefix for all uint32s is <em>u32_</em>
55
*/
56
typedef
unsigned
long
uint32_t
;
//32 bits
57
/** unsigned 64-bit integers
58
* \note Prefix for all uint64s is <em>u64_</em>
59
*/
60
typedef
unsigned
long
long
uint64_t
;
//64 bits
61
62
/** signed 8-bit integers
63
* \note Prefix for all int8s is <em>i8_</em>
64
*/
65
typedef
signed
char
int8_t
;
//8 bits
66
/** signed 16-bit integers
67
* \note Prefix for all int16s is <em>i16_</em>
68
*/
69
typedef
signed
int
int16_t
;
//16 bits
70
/** signed 32-bit integers
71
* \note Prefix for all int32s is <em>i32_</em>
72
*/
73
typedef
signed
long
int32_t
;
//32 bits
74
/** signed 64-bit integers
75
* \note Prefix for all int64s is <em>i64_</em>
76
*/
77
typedef
signed
long
long
int64_t
;
//64 bits
78
79
/** Signed integer wide enough to hold pointers. */
80
typedef
signed
int
intptr_t
;
81
82
/** Signed integer wide enough to hold pointers. */
83
typedef
unsigned
int
uintptr_t
;
84
85
/** A processor-sized signed int. */
86
typedef
signed
int
int_t
;
87
88
/** A processor-sized unsigned int. */
89
typedef
unsigned
int
uint_t
;
90
91
/** A datatype for Boolean values. Choose speed, rather than size. */
92
typedef
uint_t
bool_t
;
93
94
#else
95
#include <stdint.h>
96
#endif
97
98
99
/** This section provides pre-C99 fixed-width type definitions. Deprecated. */
100
101
/** unsigned 8-bit integers
102
* \note Prefix for all uint8s is <em>u8_</em>
103
*/
104
typedef
unsigned
char
uint8
;
//8 bits
105
/** unsigned 16-bit integers
106
* \note Prefix for all uint16s is <em>u16_</em>
107
*/
108
typedef
unsigned
int
uint16
;
//16 bits
109
/** unsigned 32-bit integers
110
* \note Prefix for all uint32s is <em>u32_</em>
111
*/
112
typedef
unsigned
long
uint32
;
//32 bits
113
/** unsigned 64-bit integers
114
* \note Prefix for all uint64s is <em>u64_</em>
115
*/
116
typedef
unsigned
long
long
uint64
;
//64 bits
117
118
/** signed 8-bit integers
119
* \note Prefix for all int8s is <em>i8_</em>
120
*/
121
typedef
signed
char
int8
;
//8 bits
122
/** signed 16-bit integers
123
* \note Prefix for all int16s is <em>i16_</em>
124
*/
125
typedef
signed
int
int16
;
//16 bits
126
/** signed 32-bit integers
127
* \note Prefix for all int32s is <em>i32_</em>
128
*/
129
typedef
signed
long
int32
;
//32 bits
130
/** signed 64-bit integers
131
* \note Prefix for all int64s is <em>i64_</em>
132
*/
133
typedef
signed
long
long
int64
;
//64 bits
134
135
136
/// Other definitions
137
138
/// A union type for byte or word access for 16 bit values.
139
typedef
union
_union16 {
140
uint16_t
u16;
141
uint8_t
u8[2];
142
}
union16
;
143
144
/// A union type for byte, word, or dword access for 32 bit values.
145
typedef
union
_union32 {
146
uint32_t
u32;
147
148
struct
{
149
uint16_t
ls16;
150
uint16_t
ms16;
151
} u16;
152
153
uint8_t
u8[4];
154
}
union32
;
155
156
/// A union type for byte, word, or dword access for 64 bit values.
157
typedef
union
_union64 {
158
uint32_t
u32[2];
159
uint16_t
u16[4];
160
uint8_t
u8[8];
161
}
union64
;
162
163
164
#endif
Generated by
1.8.4