[460] | 1 | /*******************************************************************************
|
---|
| 2 | CLOCK PLIB
|
---|
| 3 |
|
---|
| 4 | Company:
|
---|
| 5 | Microchip Technology Inc.
|
---|
| 6 |
|
---|
| 7 | File Name:
|
---|
| 8 | plib_clock.h
|
---|
| 9 |
|
---|
| 10 | Summary:
|
---|
| 11 | CLOCK PLIB Header File.
|
---|
| 12 |
|
---|
| 13 | Description:
|
---|
| 14 | The Clock PLIB initializes all the oscillators based on the
|
---|
| 15 | requirements.
|
---|
| 16 |
|
---|
| 17 | *******************************************************************************/
|
---|
| 18 |
|
---|
| 19 | /*******************************************************************************
|
---|
| 20 | * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
|
---|
| 21 | *
|
---|
| 22 | * Subject to your compliance with these terms, you may use Microchip software
|
---|
| 23 | * and any derivatives exclusively with Microchip products. It is your
|
---|
| 24 | * responsibility to comply with third party license terms applicable to your
|
---|
| 25 | * use of third party software (including open source software) that may
|
---|
| 26 | * accompany Microchip software.
|
---|
| 27 | *
|
---|
| 28 | * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
---|
| 29 | * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
---|
| 30 | * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
---|
| 31 | * PARTICULAR PURPOSE.
|
---|
| 32 | *
|
---|
| 33 | * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
---|
| 34 | * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
---|
| 35 | * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
---|
| 36 | * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
---|
| 37 | * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
---|
| 38 | * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
---|
| 39 | * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
---|
| 40 | *******************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef PLIB_CLOCK_H
|
---|
| 43 | #define PLIB_CLOCK_H
|
---|
| 44 |
|
---|
| 45 | // *****************************************************************************
|
---|
| 46 | // *****************************************************************************
|
---|
| 47 | // Section: Included Files
|
---|
| 48 | // *****************************************************************************
|
---|
| 49 | // *****************************************************************************
|
---|
| 50 | /* This section lists the other files that are included in this file.
|
---|
| 51 | */
|
---|
| 52 | // DOM-IGNORE-BEGIN
|
---|
| 53 | #ifdef __cplusplus // Provide C++ Compatibility
|
---|
| 54 | extern "C" {
|
---|
| 55 | #endif
|
---|
| 56 |
|
---|
| 57 | // DOM-IGNORE-END
|
---|
| 58 |
|
---|
| 59 | // *****************************************************************************
|
---|
| 60 | // *****************************************************************************
|
---|
| 61 | // Section: Data Types
|
---|
| 62 | // *****************************************************************************
|
---|
| 63 | // *****************************************************************************
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | // *****************************************************************************
|
---|
| 68 | // *****************************************************************************
|
---|
| 69 | // Section: Interface Routines
|
---|
| 70 | // *****************************************************************************
|
---|
| 71 | // *****************************************************************************
|
---|
| 72 | /* The following functions make up the methods (set of possible operations) of
|
---|
| 73 | this interface.
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | // *****************************************************************************
|
---|
| 77 | /* Function:
|
---|
| 78 | void CLOCK_Initialize (void);
|
---|
| 79 |
|
---|
| 80 | Summary:
|
---|
| 81 | Initializes all the modules related to the system clock.
|
---|
| 82 |
|
---|
| 83 | Description:
|
---|
| 84 | This function initializes the clock as defined by the MHC and Clock Manager
|
---|
| 85 | selections. The function will configure the NVM Flash Wait states based on
|
---|
| 86 | the configured CPU operational frequency. It will then configure the
|
---|
| 87 | oscillators.
|
---|
| 88 |
|
---|
| 89 | For each of the clock sources (External Oscillator, Digital Phase Locked
|
---|
| 90 | Loop, Internal 48MHz Oscillator, External 32KHz oscillator and the Internal
|
---|
| 91 | 32KHz oscillator) enabled in MHC, the function will configure the clock
|
---|
| 92 | settings and will then wait till the clock is ready. In case of DPLL, the
|
---|
| 93 | function will wait till a lock is obtained.
|
---|
| 94 |
|
---|
| 95 | The function will then configure the Generic clock generators based on MHC
|
---|
| 96 | configurations. If a Generic Clock is enabled in MHC, this will be enabled
|
---|
| 97 | in the CLOCK_Initialize() function. The function will apply the CPU clock
|
---|
| 98 | divider and will wait for the Main Clock module to get ready. If the Main
|
---|
| 99 | Clock to the Peripheral APB and AHB interfaces was enabled in MHC, these
|
---|
| 100 | will be enabled in the CLOCK_Initialize() function. If the Peripheral Clock
|
---|
| 101 | Channels were enabled in MHC, these will be enabled in the
|
---|
| 102 | CLOCK_Initialize() function.
|
---|
| 103 |
|
---|
| 104 | The peripheral AHB and APB main clock and peripheral channel clocks will be
|
---|
| 105 | enabled when the peripheral specific initialize functions are called. This
|
---|
| 106 | will override the setting in MHC. The Generic Clock Generator source for
|
---|
| 107 | desired peripheral channel must be configured in MHC.
|
---|
| 108 |
|
---|
| 109 | Precondition:
|
---|
| 110 | MHC GUI should be configured with the right values. Incorrect configuration
|
---|
| 111 | of the Clock will result in incorrect peripheral behavior or a non
|
---|
| 112 | functional device.
|
---|
| 113 |
|
---|
| 114 | Parameters:
|
---|
| 115 | None.
|
---|
| 116 |
|
---|
| 117 | Returns:
|
---|
| 118 | None.
|
---|
| 119 |
|
---|
| 120 | Example:
|
---|
| 121 | <code>
|
---|
| 122 | CLOCK_Initialize();
|
---|
| 123 | </code>
|
---|
| 124 |
|
---|
| 125 | Remarks:
|
---|
| 126 | This function should be called before calling other Clock library functions.
|
---|
| 127 | */
|
---|
| 128 |
|
---|
| 129 | void CLOCK_Initialize (void);
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 | #ifdef __cplusplus // Provide C++ Compatibility
|
---|
| 133 | }
|
---|
| 134 | #endif
|
---|
| 135 |
|
---|
| 136 | #endif /* PLIB_CLOCK_H */
|
---|