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