RTC auf true
hal/trng_api.h@0:38ceb79fef03, 2018-11-28 (annotated)
- Committer:
- kevman
- Date:
- Wed Nov 28 15:10:15 2018 +0000
- Revision:
- 0:38ceb79fef03
RTC modified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevman | 0:38ceb79fef03 | 1 | |
kevman | 0:38ceb79fef03 | 2 | /** \addtogroup hal */ |
kevman | 0:38ceb79fef03 | 3 | /** @{*/ |
kevman | 0:38ceb79fef03 | 4 | /* mbed Microcontroller Library |
kevman | 0:38ceb79fef03 | 5 | * Copyright (c) 2016 ARM Limited |
kevman | 0:38ceb79fef03 | 6 | * |
kevman | 0:38ceb79fef03 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kevman | 0:38ceb79fef03 | 8 | * you may not use this file except in compliance with the License. |
kevman | 0:38ceb79fef03 | 9 | * You may obtain a copy of the License at |
kevman | 0:38ceb79fef03 | 10 | * |
kevman | 0:38ceb79fef03 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
kevman | 0:38ceb79fef03 | 12 | * |
kevman | 0:38ceb79fef03 | 13 | * Unless required by applicable law or agreed to in writing, software |
kevman | 0:38ceb79fef03 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
kevman | 0:38ceb79fef03 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kevman | 0:38ceb79fef03 | 16 | * See the License for the specific language governing permissions and |
kevman | 0:38ceb79fef03 | 17 | * limitations under the License. |
kevman | 0:38ceb79fef03 | 18 | */ |
kevman | 0:38ceb79fef03 | 19 | #ifndef MBED_TRNG_API_H |
kevman | 0:38ceb79fef03 | 20 | #define MBED_TRNG_API_H |
kevman | 0:38ceb79fef03 | 21 | |
kevman | 0:38ceb79fef03 | 22 | #include <stddef.h> |
kevman | 0:38ceb79fef03 | 23 | #include "device.h" |
kevman | 0:38ceb79fef03 | 24 | |
kevman | 0:38ceb79fef03 | 25 | #if DEVICE_TRNG |
kevman | 0:38ceb79fef03 | 26 | |
kevman | 0:38ceb79fef03 | 27 | /** TRNG HAL structure. trng_s is declared in the target's HAL |
kevman | 0:38ceb79fef03 | 28 | */ |
kevman | 0:38ceb79fef03 | 29 | typedef struct trng_s trng_t; |
kevman | 0:38ceb79fef03 | 30 | |
kevman | 0:38ceb79fef03 | 31 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 32 | extern "C" { |
kevman | 0:38ceb79fef03 | 33 | #endif |
kevman | 0:38ceb79fef03 | 34 | |
kevman | 0:38ceb79fef03 | 35 | /** |
kevman | 0:38ceb79fef03 | 36 | * \defgroup hal_trng TRNG hal functions |
kevman | 0:38ceb79fef03 | 37 | * @{ |
kevman | 0:38ceb79fef03 | 38 | */ |
kevman | 0:38ceb79fef03 | 39 | |
kevman | 0:38ceb79fef03 | 40 | /** Initialize the TRNG peripheral |
kevman | 0:38ceb79fef03 | 41 | * |
kevman | 0:38ceb79fef03 | 42 | * @param obj The TRNG object |
kevman | 0:38ceb79fef03 | 43 | */ |
kevman | 0:38ceb79fef03 | 44 | void trng_init(trng_t *obj); |
kevman | 0:38ceb79fef03 | 45 | |
kevman | 0:38ceb79fef03 | 46 | /** Deinitialize the TRNG peripheral |
kevman | 0:38ceb79fef03 | 47 | * |
kevman | 0:38ceb79fef03 | 48 | * @param obj The TRNG object |
kevman | 0:38ceb79fef03 | 49 | */ |
kevman | 0:38ceb79fef03 | 50 | void trng_free(trng_t *obj); |
kevman | 0:38ceb79fef03 | 51 | |
kevman | 0:38ceb79fef03 | 52 | /** Get random data from TRNG peripheral |
kevman | 0:38ceb79fef03 | 53 | * |
kevman | 0:38ceb79fef03 | 54 | * @param obj The TRNG object |
kevman | 0:38ceb79fef03 | 55 | * @param output The pointer to an output array |
kevman | 0:38ceb79fef03 | 56 | * @param length The size of output data, to avoid buffer overwrite |
kevman | 0:38ceb79fef03 | 57 | * @param output_length The length of generated data |
kevman | 0:38ceb79fef03 | 58 | * @return 0 success, -1 fail |
kevman | 0:38ceb79fef03 | 59 | */ |
kevman | 0:38ceb79fef03 | 60 | int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length); |
kevman | 0:38ceb79fef03 | 61 | |
kevman | 0:38ceb79fef03 | 62 | /**@}*/ |
kevman | 0:38ceb79fef03 | 63 | |
kevman | 0:38ceb79fef03 | 64 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 65 | } |
kevman | 0:38ceb79fef03 | 66 | #endif |
kevman | 0:38ceb79fef03 | 67 | |
kevman | 0:38ceb79fef03 | 68 | #endif |
kevman | 0:38ceb79fef03 | 69 | |
kevman | 0:38ceb79fef03 | 70 | #endif |
kevman | 0:38ceb79fef03 | 71 | |
kevman | 0:38ceb79fef03 | 72 | /** @}*/ |