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