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