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