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