1 /** 2 * @file rng.h 3 * @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited 4 */ 5 6 #ifndef HAL_RNG_H 7 #define HAL_RNG_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /** @addtogroup hal_rng RNG 14 * rng hal API. 15 * 16 * @{ 17 */ 18 19 #include <stdint.h> 20 21 typedef struct { 22 uint8_t port; /**< random device port */ 23 void *priv; /**< priv data */ 24 } random_dev_t; 25 26 /** 27 * Fill in a memory buffer with random data 28 * 29 * @param[in] random the random device 30 * @param[out] inBuffer Point to a valid memory buffer, this function will fill 31 * in this memory with random numbers after executed 32 * @param[in] inByteCount Length of the memory buffer (bytes) 33 * 34 * @return 0 : on success, otherwise is error 35 */ 36 int32_t hal_random_num_read(random_dev_t random, void *buf, int32_t bytes); 37 38 /** @} */ 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* HAL_RNG_H */ 45 46