Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers trng_api.h Source File

trng_api.h

00001 
00002 /** \addtogroup hal */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2016 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 #ifndef MBED_TRNG_API_H
00020 #define MBED_TRNG_API_H
00021 
00022 #include <stddef.h>
00023 #include "device.h"
00024 
00025 #if DEVICE_TRNG
00026 
00027 /** TRNG HAL structure. trng_s is declared in the target's HAL
00028  */
00029 typedef struct trng_s trng_t;
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 /**
00036  * \defgroup hal_trng TRNG hal functions
00037  * @{
00038  */
00039 
00040 /** Initialize the TRNG peripheral
00041  *
00042  * @param obj The TRNG object
00043  */
00044 void trng_init(trng_t *obj);
00045 
00046 /** Deinitialize the TRNG peripheral
00047  *
00048  * @param obj The TRNG object
00049  */
00050 void trng_free(trng_t *obj);
00051 
00052 /** Get random data from TRNG peripheral
00053  *
00054  * @param obj The TRNG object
00055  * @param output The pointer to an output array
00056  * @param length The size of output data, to avoid buffer overwrite
00057  * @param output_length The length of generated data
00058  * @return 0 success, -1 fail
00059  */
00060 int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length);
00061 
00062 /**@}*/
00063 
00064 #ifdef __cplusplus
00065 }
00066 #endif
00067 
00068 #endif
00069 
00070 #endif
00071 
00072 /** @}*/