The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_LPC546XX/TOOLCHAIN_IAR/fsl_fmeas.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 171:3a7713b1edbc | 1 | /* |
AnnaBridge | 171:3a7713b1edbc | 2 | * The Clear BSD License |
AnnaBridge | 171:3a7713b1edbc | 3 | * Copyright (c) 2016, Freescale Semiconductor, Inc. |
AnnaBridge | 171:3a7713b1edbc | 4 | * Copyright 2016-2017 NXP |
AnnaBridge | 171:3a7713b1edbc | 5 | * All rights reserved. |
AnnaBridge | 171:3a7713b1edbc | 6 | * |
AnnaBridge | 171:3a7713b1edbc | 7 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 171:3a7713b1edbc | 8 | * are permitted (subject to the limitations in the disclaimer below) provided |
AnnaBridge | 171:3a7713b1edbc | 9 | * that the following conditions are met: |
AnnaBridge | 171:3a7713b1edbc | 10 | * |
AnnaBridge | 171:3a7713b1edbc | 11 | * o Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 171:3a7713b1edbc | 12 | * of conditions and the following disclaimer. |
AnnaBridge | 171:3a7713b1edbc | 13 | * |
AnnaBridge | 171:3a7713b1edbc | 14 | * o Redistributions in binary form must reproduce the above copyright notice, this |
AnnaBridge | 171:3a7713b1edbc | 15 | * list of conditions and the following disclaimer in the documentation and/or |
AnnaBridge | 171:3a7713b1edbc | 16 | * other materials provided with the distribution. |
AnnaBridge | 171:3a7713b1edbc | 17 | * |
AnnaBridge | 171:3a7713b1edbc | 18 | * o Neither the name of the copyright holder nor the names of its |
AnnaBridge | 171:3a7713b1edbc | 19 | * contributors may be used to endorse or promote products derived from this |
AnnaBridge | 171:3a7713b1edbc | 20 | * software without specific prior written permission. |
AnnaBridge | 171:3a7713b1edbc | 21 | * |
AnnaBridge | 171:3a7713b1edbc | 22 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. |
AnnaBridge | 171:3a7713b1edbc | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 171:3a7713b1edbc | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 171:3a7713b1edbc | 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 171:3a7713b1edbc | 26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 171:3a7713b1edbc | 27 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 171:3a7713b1edbc | 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 171:3a7713b1edbc | 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 171:3a7713b1edbc | 30 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 171:3a7713b1edbc | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 171:3a7713b1edbc | 32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 171:3a7713b1edbc | 33 | */ |
AnnaBridge | 171:3a7713b1edbc | 34 | #ifndef _FSL_FMEAS_H_ |
AnnaBridge | 171:3a7713b1edbc | 35 | #define _FSL_FMEAS_H_ |
AnnaBridge | 171:3a7713b1edbc | 36 | |
AnnaBridge | 171:3a7713b1edbc | 37 | #include "fsl_common.h" |
AnnaBridge | 171:3a7713b1edbc | 38 | |
AnnaBridge | 171:3a7713b1edbc | 39 | /*! |
AnnaBridge | 171:3a7713b1edbc | 40 | * @addtogroup fmeas |
AnnaBridge | 171:3a7713b1edbc | 41 | * @{ |
AnnaBridge | 171:3a7713b1edbc | 42 | */ |
AnnaBridge | 171:3a7713b1edbc | 43 | |
AnnaBridge | 171:3a7713b1edbc | 44 | /*! @file */ |
AnnaBridge | 171:3a7713b1edbc | 45 | |
AnnaBridge | 171:3a7713b1edbc | 46 | /******************************************************************************* |
AnnaBridge | 171:3a7713b1edbc | 47 | * Definitions |
AnnaBridge | 171:3a7713b1edbc | 48 | *******************************************************************************/ |
AnnaBridge | 171:3a7713b1edbc | 49 | |
AnnaBridge | 171:3a7713b1edbc | 50 | /*! @name Driver version */ |
AnnaBridge | 171:3a7713b1edbc | 51 | /*@{*/ |
AnnaBridge | 171:3a7713b1edbc | 52 | /*! @brief Defines LPC Frequency Measure driver version 2.0.0. |
AnnaBridge | 171:3a7713b1edbc | 53 | * |
AnnaBridge | 171:3a7713b1edbc | 54 | * Change log: |
AnnaBridge | 171:3a7713b1edbc | 55 | * - Version 2.0.0 |
AnnaBridge | 171:3a7713b1edbc | 56 | * - initial version |
AnnaBridge | 171:3a7713b1edbc | 57 | */ |
AnnaBridge | 171:3a7713b1edbc | 58 | #define FSL_FMEAS_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
AnnaBridge | 171:3a7713b1edbc | 59 | /*@}*/ |
AnnaBridge | 171:3a7713b1edbc | 60 | |
AnnaBridge | 171:3a7713b1edbc | 61 | /******************************************************************************* |
AnnaBridge | 171:3a7713b1edbc | 62 | * API |
AnnaBridge | 171:3a7713b1edbc | 63 | *******************************************************************************/ |
AnnaBridge | 171:3a7713b1edbc | 64 | |
AnnaBridge | 171:3a7713b1edbc | 65 | #if defined(__cplusplus) |
AnnaBridge | 171:3a7713b1edbc | 66 | extern "C" { |
AnnaBridge | 171:3a7713b1edbc | 67 | #endif /* __cplusplus */ |
AnnaBridge | 171:3a7713b1edbc | 68 | |
AnnaBridge | 171:3a7713b1edbc | 69 | /*! |
AnnaBridge | 171:3a7713b1edbc | 70 | * @name FMEAS Functional Operation |
AnnaBridge | 171:3a7713b1edbc | 71 | * @{ |
AnnaBridge | 171:3a7713b1edbc | 72 | */ |
AnnaBridge | 171:3a7713b1edbc | 73 | |
AnnaBridge | 171:3a7713b1edbc | 74 | /*! |
AnnaBridge | 171:3a7713b1edbc | 75 | * @brief Starts a frequency measurement cycle. |
AnnaBridge | 171:3a7713b1edbc | 76 | * |
AnnaBridge | 171:3a7713b1edbc | 77 | * @param base : SYSCON peripheral base address. |
AnnaBridge | 171:3a7713b1edbc | 78 | */ |
AnnaBridge | 171:3a7713b1edbc | 79 | static inline void FMEAS_StartMeasure(SYSCON_Type *base) |
AnnaBridge | 171:3a7713b1edbc | 80 | { |
AnnaBridge | 171:3a7713b1edbc | 81 | base->FREQMECTRL = 0; |
AnnaBridge | 171:3a7713b1edbc | 82 | base->FREQMECTRL = (1UL << 31); |
AnnaBridge | 171:3a7713b1edbc | 83 | } |
AnnaBridge | 171:3a7713b1edbc | 84 | |
AnnaBridge | 171:3a7713b1edbc | 85 | /*! |
AnnaBridge | 171:3a7713b1edbc | 86 | * @brief Indicates when a frequency measurement cycle is complete. |
AnnaBridge | 171:3a7713b1edbc | 87 | * |
AnnaBridge | 171:3a7713b1edbc | 88 | * @param base : SYSCON peripheral base address. |
AnnaBridge | 171:3a7713b1edbc | 89 | * @return true if a measurement cycle is active, otherwise false. |
AnnaBridge | 171:3a7713b1edbc | 90 | */ |
AnnaBridge | 171:3a7713b1edbc | 91 | static inline bool FMEAS_IsMeasureComplete(SYSCON_Type *base) |
AnnaBridge | 171:3a7713b1edbc | 92 | { |
AnnaBridge | 171:3a7713b1edbc | 93 | return (bool)((base->FREQMECTRL & (1UL << 31)) == 0); |
AnnaBridge | 171:3a7713b1edbc | 94 | } |
AnnaBridge | 171:3a7713b1edbc | 95 | |
AnnaBridge | 171:3a7713b1edbc | 96 | /*! |
AnnaBridge | 171:3a7713b1edbc | 97 | * @brief Returns the computed value for a frequency measurement cycle |
AnnaBridge | 171:3a7713b1edbc | 98 | * |
AnnaBridge | 171:3a7713b1edbc | 99 | * @param base : SYSCON peripheral base address. |
AnnaBridge | 171:3a7713b1edbc | 100 | * @param refClockRate : Reference clock rate used during the frequency measurement cycle. |
AnnaBridge | 171:3a7713b1edbc | 101 | * |
AnnaBridge | 171:3a7713b1edbc | 102 | * @return Frequency in Hz. |
AnnaBridge | 171:3a7713b1edbc | 103 | */ |
AnnaBridge | 171:3a7713b1edbc | 104 | uint32_t FMEAS_GetFrequency(SYSCON_Type *base, uint32_t refClockRate); |
AnnaBridge | 171:3a7713b1edbc | 105 | |
AnnaBridge | 171:3a7713b1edbc | 106 | /*@}*/ |
AnnaBridge | 171:3a7713b1edbc | 107 | |
AnnaBridge | 171:3a7713b1edbc | 108 | #if defined(__cplusplus) |
AnnaBridge | 171:3a7713b1edbc | 109 | } |
AnnaBridge | 171:3a7713b1edbc | 110 | #endif /* __cplusplus */ |
AnnaBridge | 171:3a7713b1edbc | 111 | |
AnnaBridge | 171:3a7713b1edbc | 112 | /*! @}*/ |
AnnaBridge | 171:3a7713b1edbc | 113 | |
AnnaBridge | 171:3a7713b1edbc | 114 | #endif /* _FSL_FMEAS_H_ */ |