diff --git a/ChangeLog b/ChangeLog index 974378b..31d902f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Backport from master. * contrib/ackbtn-gnu-linux.c: New. * mcu/usb-usbip.c (usbip_run_server): Add start-up message. + * contrib/adc-gnu-linux.c (adc_start_conversion): Use getrandom. 2021-02-12 NIIBE Yutaka diff --git a/contrib/adc-gnu-linux.c b/contrib/adc-gnu-linux.c index cb689ae..ca84933 100644 --- a/contrib/adc-gnu-linux.c +++ b/contrib/adc-gnu-linux.c @@ -3,7 +3,7 @@ * This ADC driver just fills pseudo random values. * It's completely useless other than for NeuG. * - * Copyright (C) 2017 Free Software Initiative of Japan + * Copyright (C) 2017, 2021 Free Software Initiative of Japan * Author: NIIBE Yutaka * * This file is a part of Chopstx, a thread library for embedded. @@ -33,7 +33,7 @@ #include #include "adc.h" -#define ADC_RANDOM_SEED 0x01034649 /* "Hello, father!" in Japanese */ +#include /* * Do calibration for ADC. @@ -41,7 +41,6 @@ int adc_init (void) { - srandom (ADC_RANDOM_SEED); return 0; } @@ -55,8 +54,7 @@ uint32_t adc_buf[64]; void adc_start_conversion (int offset, int count) { - while (count--) - adc_buf[offset++] = random (); + getrandom (adc_buf+offset, count, 0); }