1 /** \ingroup MODULHAL
2  * \ingroup MODULBIOS
3  * \file hw_compiler_specific.h
4  * \brief
5 */
6 /*
7  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
8  *
9  *
10  *  Redistribution and use in source and binary forms, with or without
11  *  modification, are permitted provided that the following conditions
12  *  are met:
13  *
14  *    Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  *    Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the
20  *    distribution.
21  *
22  *    Neither the name of Texas Instruments Incorporated nor the names of
23  *    its contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef HW_COMPILER_SPECIFIC_H
40 #define HW_COMPILER_SPECIFIC_H
41 
42     #define eZ_FET_WITH_DCDC                0xAAAA
43     #define eZ_FET_NO_DCDC                  0xAAAB
44     #define eZ_FET_WITH_DCDC_NO_FLOWCTL     0xAAAC
45     #define MSP_FET_WITH_DCDC               0xBBBB
46     #define MSP_FET_WITH_DCDC_V2x           0xBBBC
47     #define eZ_FET_WITH_DCDC_V2x            0xAAAD
48 
49 
50     #include "msp430.h"
51     #include "intrinsics.h"
52 
53     #define BAUDRATE           460800          // communication speed to TUSB3410
54 
55     #define CRYSTAL_U1         8000000         // externally connected HF crystal
56     #define CRYSTAL_E2         12000000         // externally connected HF crystal
57     #define BAUDMOD_U1         0x52            // corresponding modulation register value
58     #define BAUDMOD_E2         0x00            // corresponding modulation register value
59     #define USB_READ U0RXBUF
60     #define USB_WRITE U0TXBUF
61 
62     #define INFO_U1_HW_0 0xFF55
63     #define INFO_U1_HW_1 0x0140
64 
65     #define CONCAT0(x,y) x##y
66     #define CONCAT(x,y) CONCAT0(x,y)
67     #define PRAGMA(x) _Pragma(#x)
68     #define DIAG_SUPPRESS(x) PRAGMA(diag_suppress=x)
69     #define DIAG_DEFAULT(x) PRAGMA(diag_default=x)
70     #define REQUIRED(x) PRAGMA(required=x)
71     #define INTERRUPT(x) PRAGMA(vector=x) __interrupt
72     #define INTERRUPT_PROTO __interrupt
73     #define INLINE(x) PRAGMA(inline=x)
74 
75 #if defined(eZ_FET) || defined(MSP_FET)
76     #define VAR_AT(x, y) __no_init __data20 x @ y
77     #define CONST_AT(x, y) const __data20 x @ y
78 #endif
79 
80 #ifdef MSP430_UIF
81     #define VAR_AT(x, y) __no_init x @ y
82     #define CONST_AT(x, y) const x @ y
83 #endif
84 
85     #define RO_PLACEMENT __ro_placement
86     #define NO_INIT __no_init
87     #define RO_PLACEMENT_NO_INIT __ro_placement __no_init
88 
89 #ifdef MSP430_UIF
90     #define ENABLE_INTERRUPT __enable_interrupt()
91     #define DISABLE_INTERRUPT __disable_interrupt()
92 #endif
93 
94     #define NO_OPERATION __no_operation()
95     #define PTR_FOR_CMP unsigned long
96 
97     #if defined(eZ_FET) || defined(MSP_FET)
98 
99         #ifdef eZ_FET
100             #define COM_CLEARCTS           {P2OUT &=~ BIT7;}
101             #define COM_SETCTS             {P2OUT |= BIT7;}
102             #define COM_SEMAPHOREADRESS    0x4200
103         #endif
104 
105         #ifdef MSP_FET
106             #define COM_CLEARCTS           {P9OUT &=~ BIT5;}
107             #define COM_SETCTS             {P9OUT |= BIT5;}
108             #define COM_SEMAPHOREADRESS    0x4A00
109         #endif
110 
111         #define COM_CTSSTATUS      {if(*((unsigned int*)COM_SEMAPHOREADRESS)){COM_SETCTS;}else {COM_CLEARCTS;}}
112 
113         #define _DINT_FET()        {COM_CLEARCTS; __disable_interrupt();}
114         #define _EINT_FET()        {__enable_interrupt();COM_CTSSTATUS;}
115 
116         #define _DISABLE_UART()    {COM_CLEARCTS;}
117         #define _ENABLE_UART()     {COM_CTSSTATUS;}
118     #endif
119 #endif
120