IEC60730_system_config.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 
33 #ifndef __IEC60730_SYSTEM_CONFIG_H__
34 #define __IEC60730_SYSTEM_CONFIG_H__
35 
36 //*****************************************************************************
37 //
38 //The following include contains all the users configuration to build
39 //the IEC60730 library and determine which modules are available in the
40 //selected MSP430 device.
41 //
42 //*****************************************************************************
43 
44 #include "IEC60730_user_config.h"
45 #include <msp430.h>
46 
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53 
54 
55 //***************************************************************************************
56 //
57 // Definitions for Oscillator test this section is used to determine MAX and MIN values
58 // for the given main frequency taking into account the allowable frequnecy drift %
59 // specified in "IEC60730_user_config.h" file
60 //
61 //***************************************************************************************
62 #if defined(MAIN_CLOCK_FREQUENCY_1MHz)
63 #define MAIN_CLOCK_FREQUENCY 1000000
64 #elif defined(MAIN_CLOCK_FREQUENCY_8MHz)
65 #define MAIN_CLOCK_FREQUENCY 8000000
66 #elif defined(MAIN_CLOCK_FREQUENCY_12MHz)
67 #define MAIN_CLOCK_FREQUENCY 12000000
68 #endif
69 
70 #define ACLK_FREQUENCY (LFXT1_FREQUENCY/LFXT1_FREQUENCY_DIVIDER)
71 
72 
73 //***************************************************************************************
74 //
75 // The following value is selected to have an approximate 10 msec interval to verify
76 // correct frequnecy of MCLK
77 //
78 //***************************************************************************************
79 
80 #define CCRn_VALUE_FOR_10_mSEC ACLK_FREQUENCY/100
81 #define CYCLES_PER_PERIOD ((MAIN_CLOCK_FREQUENCY/MAIN_CLOCK_DIVIDER)/ACLK_FREQUENCY)
82 #define CYCLES_AVAILABLE_FOR_TEST (CYCLES_PER_PERIOD*CCRn_VALUE_FOR_10_mSEC)
83 
84 
85 //***************************************************************************************
86 //
87 // If Compiling project with IAR
88 //
89 //***************************************************************************************
90 #ifdef __ICC430__
91 //***************************************************************************************
92 //
93 // If library is built for MSP430 CPUX architecture
94 //
95 //***************************************************************************************
96 #if __CORE__
97 #define NUMBER_OF_CYLES_TO_INCREMENT_COUNTER 6
98 //***************************************************************************************
99 //
100 // If library is built for MSP430 CPU architecture
101 //
102 //***************************************************************************************
103 #else
104 #define NUMBER_OF_CYLES_TO_INCREMENT_COUNTER 6
105 #endif
106 #else
107 //***************************************************************************************
108 //
109 // If Compiling project with CCS
110 //
111 //***************************************************************************************
112 #if defined(__MSP430X__)
113 //***************************************************************************************
114 //
115 // If library is built for MSP430 CPUX architecture
116 //
117 //***************************************************************************************
118 #define NUMBER_OF_CYLES_TO_INCREMENT_COUNTER 6
119 //***************************************************************************************
120 //
121 // If library is built for MSP430 CPU architecture
122 //
123 //***************************************************************************************
124 #elif defined(__MSP430__)
125 #define NUMBER_OF_CYLES_TO_INCREMENT_COUNTER 7
126 #endif
127 #endif
128 
129 
130 #define FREQUENCY_COUNT (CYCLES_AVAILABLE_FOR_TEST/NUMBER_OF_CYLES_TO_INCREMENT_COUNTER)
131 #define FREQUENCY_COUNT_MAX (FREQUENCY_COUNT*(100 + PERCENT_FREQUENCY_DRIFT))/100
132 #define FREQUENCY_COUNT_MIN (FREQUENCY_COUNT*(100 - PERCENT_FREQUENCY_DRIFT))/100
133 
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif

Copyright 2015, Texas Instruments Incorporated