OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [LuminaryMicro/] [hw_types.h] - Blame information for rev 615

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 610 jeremybenn
//*****************************************************************************
2
//
3
// hw_types.h - Common types and macros.
4
//
5
// Copyright (c) 2005-2008 Luminary Micro, Inc.  All rights reserved.
6
// 
7
// Software License Agreement
8
// 
9
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10
// exclusively on LMI's microcontroller products.
11
// 
12
// The software is owned by LMI and/or its suppliers, and is protected under
13
// applicable copyright laws.  All rights are reserved.  You may not combine
14
// this software with "viral" open-source software in order to form a larger
15
// program.  Any use in violation of the foregoing restrictions may subject
16
// the user to criminal sanctions under applicable laws, as well as to civil
17
// liability for the breach of the terms and conditions of this license.
18
// 
19
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
20
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
21
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
22
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
23
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
24
// 
25
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
26
//
27
//*****************************************************************************
28
 
29
#ifndef __HW_TYPES_H__
30
#define __HW_TYPES_H__
31
 
32
//*****************************************************************************
33
//
34
// Define a boolean type, and values for true and false.
35
//
36
//*****************************************************************************
37
typedef unsigned char tBoolean;
38
 
39
#ifndef true
40
#define true 1
41
#endif
42
 
43
#ifndef false
44
#define false 0
45
#endif
46
 
47
//*****************************************************************************
48
//
49
// Macros for hardware access, both direct and via the bit-band region.
50
//
51
//*****************************************************************************
52
#define HWREG(x)                                                              \
53
        (*((volatile unsigned long *)(x)))
54
#define HWREGH(x)                                                             \
55
        (*((volatile unsigned short *)(x)))
56
#define HWREGB(x)                                                             \
57
        (*((volatile unsigned char *)(x)))
58
#define HWREGBITW(x, b)                                                       \
59
        HWREG(((unsigned long)(x) & 0xF0000000) | 0x02000000 |                \
60
              (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
61
#define HWREGBITH(x, b)                                                       \
62
        HWREGH(((unsigned long)(x) & 0xF0000000) | 0x02000000 |               \
63
               (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
64
#define HWREGBITB(x, b)                                                       \
65
        HWREGB(((unsigned long)(x) & 0xF0000000) | 0x02000000 |               \
66
               (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
67
 
68
//*****************************************************************************
69
//
70
// Helper Macros for determining silicon revisions, etc.
71
//
72
// These macros will be used by Driverlib at "run-time" to create necessary
73
// conditional code blocks that will allow a single version of the Driverlib
74
// "binary" code to support multiple(all) Stellaris silicon revisions.
75
//
76
// It is expected that these macros will be used inside of a standard 'C'
77
// conditional block of code, e.g.
78
//
79
//     if(CLASS_IS_SANDSTORM)
80
//     {
81
//         do some Sandstorm-class specific code here.
82
//     }
83
//
84
// By default, these macros will be defined as run-time checks of the
85
// appropriate register(s) to allow creation of run-time conditional code
86
// blocks for a common DriverLib across the entire Stellaris family.
87
//
88
// However, if code-space optimization is required, these macros can be "hard-
89
// coded" for a specific version of Stellaris silicon.  Many compilers will
90
// then detect the "hard-coded" conditionals, and appropriately optimize the
91
// code blocks, eliminating any "unreachable" code.  This would result in
92
// a smaller Driverlib, thus producing a smaller final application size, but
93
// at the cost of limiting the Driverlib binary to a specific Stellaris
94
// silicon revision.
95
//
96
//*****************************************************************************
97
#ifndef CLASS_IS_SANDSTORM
98
#define CLASS_IS_SANDSTORM                                                    \
99
        (((HWREG(SYSCTL_DID0) & SYSCTL_DID0_VER_M) == SYSCTL_DID0_VER_0) ||   \
100
         ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \
101
          (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_SANDSTORM)))
102
#endif
103
 
104
#ifndef CLASS_IS_FURY
105
#define CLASS_IS_FURY                                                        \
106
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \
107
         (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_FURY))
108
#endif
109
 
110
#ifndef CLASS_IS_DUSTDEVIL
111
#define CLASS_IS_DUSTDEVIL                                                   \
112
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \
113
         (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_DUSTDEVIL))
114
#endif
115
 
116
#ifndef REVISION_IS_A0
117
#define REVISION_IS_A0                                                     \
118
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \
119
         (SYSCTL_DID0_MAJ_REVA | SYSCTL_DID0_MIN_0))
120
#endif
121
 
122
#ifndef REVISION_IS_A2
123
#define REVISION_IS_A2                                                     \
124
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \
125
         (SYSCTL_DID0_MAJ_REVA | SYSCTL_DID0_MIN_2))
126
#endif
127
 
128
#ifndef REVISION_IS_C1
129
#define REVISION_IS_C1                                                     \
130
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \
131
         (SYSCTL_DID0_MAJ_REVC | SYSCTL_DID0_MIN_1))
132
#endif
133
 
134
#ifndef REVISION_IS_C2
135
#define REVISION_IS_C2                                                     \
136
        ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \
137
         (SYSCTL_DID0_MAJ_REVC | SYSCTL_DID0_MIN_2))
138
#endif
139
 
140
//*****************************************************************************
141
//
142
// Deprecated silicon class and revision detection macros.
143
//
144
//*****************************************************************************
145
#ifndef DEPRECATED
146
#define DEVICE_IS_SANDSTORM     CLASS_IS_SANDSTORM
147
#define DEVICE_IS_FURY          CLASS_IS_FURY
148
#define DEVICE_IS_REVA2         REVISION_IS_A2
149
#define DEVICE_IS_REVC1         REVISION_IS_C1
150
#define DEVICE_IS_REVC2         REVISION_IS_C2
151
#endif
152
 
153
#endif // __HW_TYPES_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.