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.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /*
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 171:3a7713b1edbc 3 * All rights reserved.
AnnaBridge 171:3a7713b1edbc 4 *
AnnaBridge 171:3a7713b1edbc 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 171:3a7713b1edbc 6 * are permitted provided that the following conditions are met:
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 171:3a7713b1edbc 9 * of conditions and the following disclaimer.
AnnaBridge 171:3a7713b1edbc 10 *
AnnaBridge 171:3a7713b1edbc 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 171:3a7713b1edbc 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 171:3a7713b1edbc 13 * other materials provided with the distribution.
AnnaBridge 171:3a7713b1edbc 14 *
AnnaBridge 171:3a7713b1edbc 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 171:3a7713b1edbc 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 171:3a7713b1edbc 17 * software without specific prior written permission.
AnnaBridge 171:3a7713b1edbc 18 *
AnnaBridge 171:3a7713b1edbc 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 171:3a7713b1edbc 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 171:3a7713b1edbc 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 171:3a7713b1edbc 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 171:3a7713b1edbc 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 171:3a7713b1edbc 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 171:3a7713b1edbc 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 171:3a7713b1edbc 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 171:3a7713b1edbc 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 171:3a7713b1edbc 29 */
AnnaBridge 171:3a7713b1edbc 30 #ifndef _FSL_RNGA_DRIVER_H_
AnnaBridge 171:3a7713b1edbc 31 #define _FSL_RNGA_DRIVER_H_
AnnaBridge 171:3a7713b1edbc 32
AnnaBridge 171:3a7713b1edbc 33 #include "fsl_common.h"
AnnaBridge 171:3a7713b1edbc 34
AnnaBridge 171:3a7713b1edbc 35 #if defined(FSL_FEATURE_SOC_RNG_COUNT) && FSL_FEATURE_SOC_RNG_COUNT
AnnaBridge 171:3a7713b1edbc 36 /*!
AnnaBridge 171:3a7713b1edbc 37 * @addtogroup rnga
AnnaBridge 171:3a7713b1edbc 38 * @{
AnnaBridge 171:3a7713b1edbc 39 */
AnnaBridge 171:3a7713b1edbc 40
AnnaBridge 171:3a7713b1edbc 41
AnnaBridge 171:3a7713b1edbc 42 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 43 * Definitions
AnnaBridge 171:3a7713b1edbc 44 *******************************************************************************/
AnnaBridge 171:3a7713b1edbc 45
AnnaBridge 171:3a7713b1edbc 46 /*! @name Driver version */
AnnaBridge 171:3a7713b1edbc 47 /*@{*/
AnnaBridge 171:3a7713b1edbc 48 /*! @brief RNGA driver version 2.0.1. */
AnnaBridge 171:3a7713b1edbc 49 #define FSL_RNGA_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
AnnaBridge 171:3a7713b1edbc 50 /*@}*/
AnnaBridge 171:3a7713b1edbc 51
AnnaBridge 171:3a7713b1edbc 52 /*! @brief RNGA working mode */
AnnaBridge 171:3a7713b1edbc 53 typedef enum _rnga_mode
AnnaBridge 171:3a7713b1edbc 54 {
AnnaBridge 171:3a7713b1edbc 55 kRNGA_ModeNormal = 0U, /*!< Normal Mode. The ring-oscillator clocks are active; RNGA generates entropy
AnnaBridge 171:3a7713b1edbc 56 (randomness) from the clocks and stores it in shift registers.*/
AnnaBridge 171:3a7713b1edbc 57 kRNGA_ModeSleep = 1U, /*!< Sleep Mode. The ring-oscillator clocks are inactive; RNGA does not generate entropy.*/
AnnaBridge 171:3a7713b1edbc 58 } rnga_mode_t;
AnnaBridge 171:3a7713b1edbc 59
AnnaBridge 171:3a7713b1edbc 60 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 61 * API
AnnaBridge 171:3a7713b1edbc 62 *******************************************************************************/
AnnaBridge 171:3a7713b1edbc 63
AnnaBridge 171:3a7713b1edbc 64 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 65 extern "C" {
AnnaBridge 171:3a7713b1edbc 66 #endif
AnnaBridge 171:3a7713b1edbc 67
AnnaBridge 171:3a7713b1edbc 68 /*!
AnnaBridge 171:3a7713b1edbc 69 * @brief Initializes the RNGA.
AnnaBridge 171:3a7713b1edbc 70 *
AnnaBridge 171:3a7713b1edbc 71 * This function initializes the RNGA.
AnnaBridge 171:3a7713b1edbc 72 * When called, the RNGA entropy generation starts immediately.
AnnaBridge 171:3a7713b1edbc 73 *
AnnaBridge 171:3a7713b1edbc 74 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 75 */
AnnaBridge 171:3a7713b1edbc 76 void RNGA_Init(RNG_Type *base);
AnnaBridge 171:3a7713b1edbc 77
AnnaBridge 171:3a7713b1edbc 78 /*!
AnnaBridge 171:3a7713b1edbc 79 * @brief Shuts down the RNGA.
AnnaBridge 171:3a7713b1edbc 80 *
AnnaBridge 171:3a7713b1edbc 81 * This function shuts down the RNGA.
AnnaBridge 171:3a7713b1edbc 82 *
AnnaBridge 171:3a7713b1edbc 83 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 84 */
AnnaBridge 171:3a7713b1edbc 85 void RNGA_Deinit(RNG_Type *base);
AnnaBridge 171:3a7713b1edbc 86
AnnaBridge 171:3a7713b1edbc 87 /*!
AnnaBridge 171:3a7713b1edbc 88 * @brief Gets random data.
AnnaBridge 171:3a7713b1edbc 89 *
AnnaBridge 171:3a7713b1edbc 90 * This function gets random data from the RNGA.
AnnaBridge 171:3a7713b1edbc 91 *
AnnaBridge 171:3a7713b1edbc 92 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 93 * @param data pointer to user buffer to be filled by random data
AnnaBridge 171:3a7713b1edbc 94 * @param data_size size of data in bytes
AnnaBridge 171:3a7713b1edbc 95 * @return RNGA status
AnnaBridge 171:3a7713b1edbc 96 */
AnnaBridge 171:3a7713b1edbc 97 status_t RNGA_GetRandomData(RNG_Type *base, void *data, size_t data_size);
AnnaBridge 171:3a7713b1edbc 98
AnnaBridge 171:3a7713b1edbc 99 /*!
AnnaBridge 171:3a7713b1edbc 100 * @brief Feeds the RNGA module.
AnnaBridge 171:3a7713b1edbc 101 *
AnnaBridge 171:3a7713b1edbc 102 * This function inputs an entropy value that the RNGA uses to seed its
AnnaBridge 171:3a7713b1edbc 103 * pseudo-random algorithm.
AnnaBridge 171:3a7713b1edbc 104 *
AnnaBridge 171:3a7713b1edbc 105 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 106 * @param seed input seed value
AnnaBridge 171:3a7713b1edbc 107 */
AnnaBridge 171:3a7713b1edbc 108 void RNGA_Seed(RNG_Type *base, uint32_t seed);
AnnaBridge 171:3a7713b1edbc 109
AnnaBridge 171:3a7713b1edbc 110 /*!
AnnaBridge 171:3a7713b1edbc 111 * @brief Sets the RNGA in normal mode or sleep mode.
AnnaBridge 171:3a7713b1edbc 112 *
AnnaBridge 171:3a7713b1edbc 113 * This function sets the RNGA in sleep mode or normal mode.
AnnaBridge 171:3a7713b1edbc 114 *
AnnaBridge 171:3a7713b1edbc 115 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 116 * @param mode normal mode or sleep mode
AnnaBridge 171:3a7713b1edbc 117 */
AnnaBridge 171:3a7713b1edbc 118 void RNGA_SetMode(RNG_Type *base, rnga_mode_t mode);
AnnaBridge 171:3a7713b1edbc 119
AnnaBridge 171:3a7713b1edbc 120 /*!
AnnaBridge 171:3a7713b1edbc 121 * @brief Gets the RNGA working mode.
AnnaBridge 171:3a7713b1edbc 122 *
AnnaBridge 171:3a7713b1edbc 123 * This function gets the RNGA working mode.
AnnaBridge 171:3a7713b1edbc 124 *
AnnaBridge 171:3a7713b1edbc 125 * @param base RNGA base address
AnnaBridge 171:3a7713b1edbc 126 * @return normal mode or sleep mode
AnnaBridge 171:3a7713b1edbc 127 */
AnnaBridge 171:3a7713b1edbc 128 rnga_mode_t RNGA_GetMode(RNG_Type *base);
AnnaBridge 171:3a7713b1edbc 129
AnnaBridge 171:3a7713b1edbc 130 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 131 }
AnnaBridge 171:3a7713b1edbc 132 #endif
AnnaBridge 171:3a7713b1edbc 133
AnnaBridge 171:3a7713b1edbc 134 /*! @}*/
AnnaBridge 171:3a7713b1edbc 135
AnnaBridge 171:3a7713b1edbc 136 #endif /* FSL_FEATURE_SOC_RNG_COUNT */
AnnaBridge 171:3a7713b1edbc 137 #endif /* _FSL_RNGA_H_*/