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