1/* @TAG(CUSTOM) *//**
2 * \file  hw_types.h
3 *
4 * \brief Common type definitions and macros
5 */
6
7/*
8* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
9*/
10/*
11*  Redistribution and use in source and binary forms, with or without
12*  modification, are permitted provided that the following conditions
13*  are met:
14*
15*    Redistributions of source code must retain the above copyright
16*    notice, this list of conditions and the following disclaimer.
17*
18*    Redistributions in binary form must reproduce the above copyright
19*    notice, this list of conditions and the following disclaimer in the
20*    documentation and/or other materials provided with the
21*    distribution.
22*
23*    Neither the name of Texas Instruments Incorporated nor the names of
24*    its contributors may be used to endorse or promote products derived
25*    from this software without specific prior written permission.
26*
27*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38*
39*/
40
41#pragma once
42
43//*****************************************************************************
44//
45// Define a boolean type, and values for true and false.
46//
47//*****************************************************************************
48typedef unsigned char tBoolean;
49
50#ifndef true
51#define true 1
52#endif
53
54#ifndef false
55#define false 0
56#endif
57
58#ifndef NULL
59#define NULL ((void*) 0)
60#endif
61//*****************************************************************************
62//
63// Macros for hardware access, both direct and via the bit-band region.
64//
65//*****************************************************************************
66#define HWREG(x)                                                              \
67        (*((volatile unsigned int *)(x)))
68#define HWREGH(x)                                                             \
69        (*((volatile unsigned short *)(x)))
70#define HWREGB(x)                                                             \
71        (*((volatile unsigned char *)(x)))
72#define HWREGBITW(x, b)                                                       \
73        HWREG(((unsigned int)(x) & 0xF0000000) | 0x02000000 |                \
74              (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2))
75#define HWREGBITH(x, b)                                                       \
76        HWREGH(((unsigned int)(x) & 0xF0000000) | 0x02000000 |               \
77               (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2))
78#define HWREGBITB(x, b)                                                       \
79        HWREGB(((unsigned int)(x) & 0xF0000000) | 0x02000000 |               \
80               (((unsigned int)(x) & 0x000FFFFF) << 5) | ((b) << 2))
81
82#define TRUE    1
83#define FALSE   0
84
85