1 /*********************************************************************************************************************
2  * @file     system_XMC4800.h
3  * @brief    Device specific initialization for the XMC4800-Series according to CMSIS
4  * @version  V1.0
5  * @date     22 May 2015
6  *
7  * @cond
8  *********************************************************************************************************************
9  * Copyright (c) 2015-2020, Infineon Technologies AG
10  * All rights reserved.
11  *
12  * Boost Software License - Version 1.0 - August 17th, 2003
13  *
14  * Permission is hereby granted, free of charge, to any person or organization
15  * obtaining a copy of the software and accompanying documentation covered by
16  * this license (the "Software") to use, reproduce, display, distribute,
17  * execute, and transmit the Software, and to prepare derivative works of the
18  * Software, and to permit third-parties to whom the Software is furnished to
19  * do so, all subject to the following:
20  *
21  * The copyright notices in the Software and this entire statement, including
22  * the above license grant, this restriction and the following disclaimer,
23  * must be included in all copies of the Software, in whole or in part, and
24  * all derivative works of the Software, unless such copies or derivative
25  * works are solely in the form of machine-executable object code generated by
26  * a source language processor.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
31  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
32  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
33  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34  * DEALINGS IN THE SOFTWARE.
35  *
36  * To improve the quality of the software, users are encouraged to share
37  * modifications, enhancements or bug fixes with Infineon Technologies AG
38  * at XMCSupport@infineon.com.
39  *********************************************************************************************************************
40  *
41  **************************** Change history *********************************
42  * V1.0, 22 May 2015, JFT, Initial version
43  *****************************************************************************
44  * @endcond
45  */
46 
47 #ifndef SYSTEM_XMC4800_H
48 #define SYSTEM_XMC4800_H
49 
50 /*******************************************************************************
51  * HEADER FILES
52  *******************************************************************************/
53 
54 #include <stdint.h>
55 
56 /*******************************************************************************
57  * MACROS
58  *******************************************************************************/
59 
60 #define	OFI_FREQUENCY        (24000000UL)  /**< 24MHz Backup Clock (fOFI) frequency. */
61 #define OSI_FREQUENCY        (32768UL)    /**< 32KHz Internal Slow Clock source (fOSI) frequency. */
62 
63 /*******************************************************************************
64  * GLOBAL VARIABLES
65  *******************************************************************************/
66 
67 extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
68 extern uint8_t g_chipid[16];
69 
70 /*******************************************************************************
71  * API PROTOTYPES
72  *******************************************************************************/
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 /**
79  * @brief Initialize the system
80  *
81  */
82 void SystemInit(void);
83 
84 /**
85  * @brief Initialize CPU settings
86  *
87  */
88 void SystemCoreSetup(void);
89 
90 /**
91  * @brief Initialize clock
92  *
93  */
94 void SystemCoreClockSetup(void);
95 
96 /**
97  * @brief Update SystemCoreClock variable
98  *
99  */
100 void SystemCoreClockUpdate(void);
101 
102 /**
103  * @brief Returns frequency of the high performace oscillator
104  * User needs to overload this function to return the correct oscillator frequency
105  */
106 uint32_t OSCHP_GetFrequency(void);
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif
113