mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
+10
-23
@@ -2810,36 +2810,25 @@ menu "Timer Configuration"
|
||||
|
||||
if SCHED_TICKLESS
|
||||
|
||||
config STM32_ONESHOT
|
||||
bool
|
||||
default y
|
||||
|
||||
config STM32_FREERUN
|
||||
bool
|
||||
default y
|
||||
|
||||
config STM32_TICKLESS_ONESHOT
|
||||
int "Tickless one-shot timer channel"
|
||||
config STM32_TICKLESS_TIMER
|
||||
int "Tickless hardware timer"
|
||||
default 2
|
||||
range 1 14
|
||||
depends on STM32_ONESHOT
|
||||
---help---
|
||||
If the Tickless OS feature is enabled, the one clock must be
|
||||
assigned to provided the one-shot timer needed by the OS.
|
||||
If the Tickless OS feature is enabled, then one clock must be
|
||||
assigned to provided the timer needed by the OS.
|
||||
|
||||
config STM32_TICKLESS_FREERUN
|
||||
int "Tickless free-running timer channel"
|
||||
default 5
|
||||
range 1 14
|
||||
depends on STM32_FREERUN
|
||||
config STM32_TICKLESS_CHANNEL
|
||||
int "Tickless timer channel"
|
||||
default 1
|
||||
range 1 4
|
||||
---help---
|
||||
If the Tickless OS feature is enabled, the one clock must be
|
||||
assigned to provided the free-running timer needed by the OS.
|
||||
assigned to provided the free-running timer needed by the OS
|
||||
and one channel on that clock is needed to handle intervals.
|
||||
|
||||
endif # SCHED_TICKLESS
|
||||
|
||||
if !SCHED_TICKLESS
|
||||
|
||||
config STM32_ONESHOT
|
||||
bool "TIM one-shot wrapper"
|
||||
default n
|
||||
@@ -2854,8 +2843,6 @@ config STM32_FREERUN
|
||||
Enable a wrapper around the low level timer/counter functions to
|
||||
support a free-running timer.
|
||||
|
||||
endif # !SCHED_TICKLESS
|
||||
|
||||
config STM32_ONESHOT_MAXTIMERS
|
||||
int "Maximum number of oneshot timers"
|
||||
default 1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2015,6 +2015,27 @@ config BOARD_RESET_ON_CRASH
|
||||
If selected the board_crashdump should reset the machine after
|
||||
saveing the state of the machine
|
||||
|
||||
config BOARD_ENTROPY_POOL
|
||||
bool "Enable Board level storing of entropy pool structure"
|
||||
default n
|
||||
depends on CRYPTO_RANDOM_POOL
|
||||
---help---
|
||||
Entropy pool structure can be provided by board source.
|
||||
Use for this is, for example, to allocate entropy pool
|
||||
from special area of RAM which content is kept over
|
||||
system reset.
|
||||
|
||||
config BOARD_INITRNGSEED
|
||||
bool "Enable Board level initial seeding of entropy pool RNG"
|
||||
default n
|
||||
depends on CRYPTO_RANDOM_POOL
|
||||
---help---
|
||||
If enabled, entropy pool random number generator will call
|
||||
board_init_rndseed() upon initialization. This function
|
||||
can then provide early entropy seed to the pool through
|
||||
entropy injection APIs provided at 'nuttx/random.h'.
|
||||
#endif
|
||||
|
||||
config LIB_BOARDCTL
|
||||
bool "Enable boardctl() interface"
|
||||
default n
|
||||
|
||||
@@ -749,6 +749,19 @@ Selecting the GMAC peripheral
|
||||
CONFIG_NSH_NOMAC=n : We will get the IP address from EEPROM
|
||||
: Defaults should be okay for other options
|
||||
|
||||
SAMV71 Versions
|
||||
---------------
|
||||
|
||||
WARNING: The newer SAMV71 have 6 GMAC queues, not 3. All queues must be
|
||||
configured for the GMAC to work correctly, even the queues that you are not
|
||||
using (you can just configure these queues with a very small ring buffer.)
|
||||
|
||||
The older uses the Cortex-M7 core r0p1 and the newer r1p1 revisions. The
|
||||
SAMV71 revisions are called "rev A" (or sometimes "MRLA") and "rev B"
|
||||
("MRLB"). There should be a small "A" or "B" on the chip package just below
|
||||
the reference and you can also differentiate them at runtime with the
|
||||
VERSION field in the CHIPID CIDR register.
|
||||
|
||||
Cache-Related Issues
|
||||
--------------------
|
||||
|
||||
|
||||
@@ -50,4 +50,35 @@ config CRYPTO_SW_AES
|
||||
implemenations. This needs to support up_aesinitialize() and
|
||||
aes_cypher() per include/nuttx/crypto/crypto.h.
|
||||
|
||||
config CRYPTO_BLAKE2S
|
||||
bool "BLAKE2s hash algorithm"
|
||||
default n
|
||||
---help---
|
||||
Enable the BLAKE2s hash algorithm
|
||||
|
||||
config CRYPTO_RANDOM_POOL
|
||||
bool "Entropy pool and strong randon number generator"
|
||||
default n
|
||||
select CRYPTO_BLAKE2S
|
||||
---help---
|
||||
Entropy pool gathers environmental noise from device drivers,
|
||||
user-space, etc., and returns good random numbers, suitable
|
||||
for cryptographic use. Based on entropy pool design from
|
||||
*BSDs and uses BLAKE2Xs algorithm for CSPRNG output.
|
||||
|
||||
NOTE: May not actually be cyptographically secure, if
|
||||
not enough entropy is made available to the entropy pool.
|
||||
|
||||
if CRYPTO_RANDOM_POOL
|
||||
|
||||
config CRYPTO_RANDOM_POOL_COLLECT_IRQ_RANDOMNESS
|
||||
bool "Use interrupts to feed timing randomness to entropy pool"
|
||||
default y
|
||||
---help---
|
||||
Feed entropy pool with interrupt randomness from interrupt
|
||||
dispatch function 'irq_dispatch'. This adds some overhead
|
||||
for every interrupt handled.
|
||||
|
||||
endif # CRYPTO_RANDOM_POOL
|
||||
|
||||
endif # CRYPTO
|
||||
|
||||
+13
-1
@@ -56,6 +56,18 @@ ifeq ($(CONFIG_CRYPTO_SW_AES),y)
|
||||
CRYPTO_CSRCS += aes.c
|
||||
endif
|
||||
|
||||
# BLAKE2s hash algorithm
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_BLAKE2S),y)
|
||||
CRYPTO_CSRCS += blake2s.c
|
||||
endif
|
||||
|
||||
# Entropy pool random number generator
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_RANDOM_POOL),y)
|
||||
CRYPTO_CSRCS += random_pool.c
|
||||
endif
|
||||
|
||||
endif # CONFIG_CRYPTO
|
||||
|
||||
ASRCS = $(CRYPTO_ASRCS)
|
||||
@@ -97,4 +109,4 @@ distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
-include Make.dep
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -69,6 +69,15 @@ config DEV_URANDOM_CONGRUENTIAL
|
||||
|
||||
NOTE: Not cyptographically secure
|
||||
|
||||
config DEV_URANDOM_RANDOM_POOL
|
||||
bool "Entropy pool"
|
||||
depends on CRYPTO_RANDOM_POOL
|
||||
---help---
|
||||
Use the entropy pool CPRNG output for urandom algorithm.
|
||||
|
||||
NOTE: May or may not be cyptographically secure, depending upon the
|
||||
quality entropy available to entropy pool.
|
||||
|
||||
config DEV_URANDOM_ARCH
|
||||
bool "Architecture-specific"
|
||||
depends on ARCH_HAVE_RNG
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/analog/adc.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
@@ -296,6 +297,10 @@ static ssize_t adc_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Feed ADC data to entropy pool */
|
||||
|
||||
add_sensor_randomness(msg->am_data);
|
||||
|
||||
/* Copy the message to the user buffer */
|
||||
|
||||
if (msglen == 1)
|
||||
|
||||
+69
-3
@@ -49,11 +49,13 @@
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/lib/lib.h>
|
||||
#include <nuttx/lib/xorshift128.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/drivers.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_DEV_URANDOM) && !defined(CONFIG_DEV_URANDOM_ARCH)
|
||||
|
||||
@@ -62,13 +64,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DEV_URANDOM_CONGRUENTIAL) && \
|
||||
!defined(CONFIG_DEV_URANDOM_XORSHIFT128)
|
||||
# define CONFIG_DEV_URANDOM_XORSHIFT128 1
|
||||
!defined(CONFIG_DEV_URANDOM_XORSHIFT128) && \
|
||||
!defined(CONFIG_DEV_URANDOM_RANDOM_POOL)
|
||||
# ifdef CONFIG_CRYPTO_RANDOM_POOL
|
||||
# define CONFIG_DEV_URANDOM_RANDOM_POOL 1
|
||||
# else
|
||||
# define CONFIG_DEV_URANDOM_XORSHIFT128 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_URANDOM_XORSHIFT128
|
||||
# define PRNG() do_xorshift128()
|
||||
#else /* CONFIG_DEV_URANDOM_CONGRUENTIAL */
|
||||
#elif defined(CONFIG_DEV_URANDOM_CONGRUENTIAL)
|
||||
# define PRNG() do_congruential()
|
||||
#endif
|
||||
|
||||
@@ -158,6 +165,12 @@ static inline uint32_t do_congruential(void)
|
||||
static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer,
|
||||
size_t len)
|
||||
{
|
||||
#ifdef CONFIG_DEV_URANDOM_RANDOM_POOL
|
||||
if (len)
|
||||
{
|
||||
getrandom(buffer, len);
|
||||
}
|
||||
#else
|
||||
size_t n;
|
||||
uint32_t rnd;
|
||||
|
||||
@@ -208,6 +221,7 @@ static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer,
|
||||
}
|
||||
while (--n > 0);
|
||||
}
|
||||
#endif /* CONFIG_DEV_URANDOM_RANDOM_POOL */
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -228,6 +242,56 @@ static ssize_t devurand_write(FAR struct file *filep, FAR const char *buffer,
|
||||
memcpy(&seed, buffer, len);
|
||||
srand(seed);
|
||||
return len;
|
||||
#elif defined(CONFIG_DEV_URANDOM_RANDOM_POOL)
|
||||
const unsigned int alignmask = sizeof(uint32_t) - 1;
|
||||
const size_t initlen = len;
|
||||
uint32_t tmp = 0;
|
||||
size_t currlen;
|
||||
|
||||
if (!len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Seed entropy pool with data from user. */
|
||||
|
||||
if ((uintptr_t)buffer & alignmask)
|
||||
{
|
||||
/* Make unaligned input aligned. */
|
||||
|
||||
currlen = min(sizeof(uint32_t) - ((uintptr_t)buffer & alignmask), len);
|
||||
memcpy(&tmp, buffer, currlen);
|
||||
up_rngaddint(RND_SRC_SW, tmp);
|
||||
|
||||
len -= currlen;
|
||||
buffer += currlen;
|
||||
}
|
||||
|
||||
if (len >= sizeof(uint32_t))
|
||||
{
|
||||
/* Handle bulk aligned, word-sized data. */
|
||||
|
||||
DEBUGASSERT(((uintptr_t)buffer & alignmask) == 0);
|
||||
currlen = len / sizeof(uint32_t);
|
||||
up_rngaddentropy(RND_SRC_SW, (FAR uint32_t *)buffer, currlen);
|
||||
buffer += currlen * sizeof(uint32_t);
|
||||
len %= sizeof(uint32_t);
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
/* Handle trailing bytes. */
|
||||
|
||||
DEBUGASSERT(len < sizeof(uint32_t));
|
||||
memcpy(&tmp, buffer, len);
|
||||
up_rngaddint(RND_SRC_SW, tmp);
|
||||
}
|
||||
|
||||
/* Reseeding of random number generator from entropy pool. */
|
||||
|
||||
up_rngreseed();
|
||||
|
||||
return initlen;
|
||||
#else
|
||||
len = min(len, sizeof(g_prng.u));
|
||||
memcpy(&g_prng.u, buffer, len);
|
||||
@@ -274,6 +338,8 @@ void devurandom_register(void)
|
||||
|
||||
#ifdef CONFIG_DEV_URANDOM_CONGRUENTIAL
|
||||
srand(10197);
|
||||
#elif defined(CONFIG_DEV_URANDOM_RANDOM_POOL)
|
||||
up_randompool_initialize();
|
||||
#else
|
||||
g_prng.state.w = 97;
|
||||
g_prng.state.x = 101;
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
@@ -624,6 +625,8 @@ static void ads7843e_worker(FAR void *arg)
|
||||
y = ads7843e_sendcmd(priv, ADS7843_CMD_YPOSITION);
|
||||
#endif
|
||||
|
||||
add_ui_randomness((x << 16) | y);
|
||||
|
||||
/* Perform a thresholding operation so that the results will be more stable.
|
||||
* If the difference from the last sample is small, then ignore the event.
|
||||
* REVISIT: Should a large change in pressure also generate a event?
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/input/ajoystick.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
@@ -321,6 +322,8 @@ static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
|
||||
DEBUGASSERT(lower->al_buttons);
|
||||
sample = lower->al_buttons(lower);
|
||||
|
||||
add_ui_randomness(sample);
|
||||
|
||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||
/* Determine which buttons have been newly pressed and which have been
|
||||
* newly released.
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/input/buttons.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
@@ -317,6 +318,8 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
|
||||
DEBUGASSERT(lower->bl_buttons);
|
||||
sample = lower->bl_buttons(lower);
|
||||
|
||||
add_ui_randomness(sample);
|
||||
|
||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||
/* Determine which buttons have been newly pressed and which have been
|
||||
* newly released.
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/input/djoystick.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
@@ -321,6 +322,8 @@ static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
|
||||
DEBUGASSERT(lower->dl_sample);
|
||||
sample = lower->dl_sample(lower);
|
||||
|
||||
add_ui_randomness(sample);
|
||||
|
||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||
/* Determine which buttons have been newly pressed and which have been
|
||||
* newly released.
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
@@ -628,6 +629,8 @@ static void max11802_worker(FAR void *arg)
|
||||
}
|
||||
while (readycount < 2);
|
||||
|
||||
add_ui_randomness((x << 16) | y);
|
||||
|
||||
/* Continue to sample the position while the pen is down */
|
||||
|
||||
wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1,
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
@@ -889,6 +890,8 @@ static void mxt_touch_event(FAR struct mxt_dev_s *priv,
|
||||
sample->pressure = pressure;
|
||||
sample->valid = true;
|
||||
|
||||
add_ui_randomness((x << 16) ^ y ^ (area << 9) ^ (pressure << 1));
|
||||
|
||||
/* If this is not the first touch report, then report it as a move:
|
||||
* Same contact, same ID, but with a new, updated position.
|
||||
* The CONTACT_REPORT state means that a contacted has been detected,
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/input/stmpe811.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include "stmpe811.h"
|
||||
|
||||
@@ -139,6 +140,8 @@ uint16_t stmpe811_tempread(STMPE811_HANDLE handle)
|
||||
temp1 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2);
|
||||
temp2 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2+1);
|
||||
|
||||
add_sensor_randomness((temp1 << 8) | temp2);
|
||||
|
||||
/* Scale the temperature (where Vio is assumed to be .33) */
|
||||
|
||||
temp = ((uint32_t)(temp1 & 3) << 8) | temp2;
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
@@ -534,6 +535,8 @@ static ssize_t stmpe811_read(FAR struct file *filep, FAR char *buffer, size_t le
|
||||
report->point[0].y = sample.y;
|
||||
report->point[0].pressure = sample.z;
|
||||
|
||||
add_ui_randomness((sample.x << 16) ^ (sample.y << 8) ^ sample.z);
|
||||
|
||||
/* Report the appropriate flags */
|
||||
|
||||
if (sample.contact == CONTACT_UP)
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/tsc2007.h>
|
||||
@@ -619,7 +620,7 @@ static void tsc2007_worker(FAR void *arg)
|
||||
* vertical or horizontal resistive network. The A/D converter converts
|
||||
* the voltage measured at the point where the panel is touched. A measurement
|
||||
* of the Y position of the pointing device is made by connecting the X+
|
||||
* input to a data converter chip, turning on the Y+ and Y– drivers, and
|
||||
* input to a data converter chip, turning on the Y+ and Y- drivers, and
|
||||
* digitizing the voltage seen at the X+ input ..."
|
||||
*
|
||||
* "... it is recommended that whenever the host writes to the TSC2007, the
|
||||
@@ -698,6 +699,8 @@ static void tsc2007_worker(FAR void *arg)
|
||||
priv->sample.y = y;
|
||||
priv->sample.pressure = pressure;
|
||||
priv->sample.valid = true;
|
||||
|
||||
add_ui_randomness((x << 16) ^ y ^ (pressure << 9));
|
||||
}
|
||||
|
||||
/* Note the availability of new measurements */
|
||||
|
||||
@@ -32,6 +32,29 @@ config BMP180
|
||||
---help---
|
||||
Enable driver support for the Bosch BMP180 barometer sensor.
|
||||
|
||||
config HTS221
|
||||
bool "ST HTS221 humidity sensor"
|
||||
default n
|
||||
select I2C
|
||||
---help---
|
||||
Enable driver support for the ST HTS221 humidity sensor.
|
||||
|
||||
if HTS221
|
||||
|
||||
config DEBUG_HTS221
|
||||
bool "Debug support for the HTS221"
|
||||
default n
|
||||
---help---
|
||||
Enables debug features for the HTS221
|
||||
|
||||
config HTS221_NPOLLWAITERS
|
||||
int "Number of waiters to poll"
|
||||
default 1
|
||||
---help---
|
||||
Number of waiters to poll
|
||||
|
||||
endif # HTS221
|
||||
|
||||
config SENSORS_L3GD20
|
||||
bool "ST L3GD20 Gyroscope Sensor support"
|
||||
default n
|
||||
|
||||
@@ -81,6 +81,10 @@ ifeq ($(CONFIG_BMP180),y)
|
||||
CSRCS += bmp180.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_HTS221),y)
|
||||
CSRCS += hts221.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C_LM75),y)
|
||||
CSRCS += lm75.c
|
||||
endif
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/sensors/adxl345.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include "adxl345.h"
|
||||
|
||||
@@ -165,6 +166,9 @@ static ssize_t adxl345_read(FAR struct file *filep, FAR char *buffer, size_t len
|
||||
sample.data_z = adxl345_getreg8(priv, ADXL345_DATAZ1);
|
||||
sample.data_z = (sample.data_z << 8) | adxl345_getreg8(priv, ADXL345_DATAZ0);
|
||||
|
||||
add_sensor_randomness(sample.data_x);
|
||||
add_sensor_randomness((sample.data_z << 16) | sample.data_y);
|
||||
|
||||
/* Return read sample */
|
||||
|
||||
buffer = (FAR char *) &sample;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/bh1750fvi.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_BH1750FVI)
|
||||
|
||||
@@ -250,6 +251,8 @@ static ssize_t bh1750fvi_read(FAR struct file *filep, FAR char *buffer,
|
||||
buffer[0] = lux & 0xFF;
|
||||
buffer[1] = (lux & 0xFF00) >> 8;
|
||||
|
||||
add_sensor_randomness(lux);
|
||||
|
||||
return buflen;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sensors/bmg160.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_BMG160)
|
||||
|
||||
@@ -243,6 +244,10 @@ static void bmg160_read_measurement_data(FAR struct bmg160_dev_s *dev)
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((x_gyr << 16) ^ (y_gyr << 8) ^ z_gyr);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/bmp180.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_BMP180)
|
||||
|
||||
@@ -464,6 +465,10 @@ static int bmp180_getpressure(FAR struct bmp180_dev_s *priv)
|
||||
|
||||
bmp180_read_press_temp(priv);
|
||||
|
||||
/* Feed raw sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((priv->bmp180_utemp << 16) ^ priv->bmp180_upress);
|
||||
|
||||
/* Calculate true temperature */
|
||||
|
||||
x1 = ((priv->bmp180_utemp - priv->bmp180_cal_ac6) * priv->bmp180_cal_ac5) >> 15;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,6 +51,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/kxtj9.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SENSOR_KXTJ9)
|
||||
|
||||
@@ -459,6 +460,12 @@ static int kxtj9_read_sensor_data(FAR struct kxtj9_dev_s *priv,
|
||||
|
||||
kxtj9_reg_read(priv, INT_REL, &data, 1);
|
||||
sem_post(&priv->exclsem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((acc_data[0] << 16) ^ (acc_data[1] << 8) ^
|
||||
acc_data[2]);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
@@ -257,6 +258,10 @@ static void l3gd20_read_measurement_data(FAR struct l3gd20_dev_s *dev)
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((x_gyr << 16) ^ (y_gyr << 8) ^ (z_gyr << 0));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/lis331dl.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_LIS331DL)
|
||||
|
||||
@@ -414,6 +415,11 @@ lis331dl_getreadings(FAR struct lis331dl_dev_s * dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((retval[2] << 16) ^ (retval[4] << 8) ^
|
||||
(retval[6] << 0));
|
||||
|
||||
dev->a.x = retval[2];
|
||||
dev->a.y = retval[4];
|
||||
dev->a.z = retval[6];
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sensors/lis3dsh.h>
|
||||
@@ -245,6 +246,10 @@ static void lis3dsh_read_measurement_data(FAR struct lis3dsh_dev_s *dev)
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((x_acc << 16) ^ (y_acc << 8) ^ (z_acc << 0));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sensors/lis3mdl.h>
|
||||
@@ -251,6 +252,11 @@ static void lis3mdl_read_measurement_data(FAR struct lis3mdl_dev_s *dev)
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((x_mag << 16) ^ (y_mag << 10) ^ (z_mag << 2) ^
|
||||
temperature);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/lm75.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75)
|
||||
|
||||
@@ -269,6 +270,8 @@ static int lm75_readtemp(FAR struct lm75_dev_s *priv, FAR b16_t *temp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
add_sensor_randomness(temp16);
|
||||
|
||||
sninfo("Centigrade: %08x\n", temp16);
|
||||
|
||||
/* Was fahrenheit requested? */
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/lm92.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_LM92)
|
||||
|
||||
@@ -272,6 +273,8 @@ static int lm92_readtemp(FAR struct lm92_dev_s *priv, FAR b16_t *temp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
add_sensor_randomness(temp16);
|
||||
|
||||
sninfo("Centigrade: %08x\n", temp16);
|
||||
|
||||
/* Was Fahrenheit requested? */
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/lsm9ds1.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SN_LSM9DS1)
|
||||
|
||||
@@ -1244,6 +1245,7 @@ static ssize_t lsm9ds1_read(FAR struct file *filep, FAR char *buffer,
|
||||
uint8_t regaddr;
|
||||
uint8_t lo;
|
||||
uint8_t hi;
|
||||
uint32_t merge = 0;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
@@ -1301,6 +1303,10 @@ static ssize_t lsm9ds1_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
data = ((uint16_t)hi << 8) | (uint16_t)lo;
|
||||
|
||||
/* Collect entropy */
|
||||
|
||||
merge += data ^ (merge >> 16);
|
||||
|
||||
/* The value is positive */
|
||||
|
||||
if (data < 0x8000)
|
||||
@@ -1329,6 +1335,10 @@ static ssize_t lsm9ds1_read(FAR struct file *filep, FAR char *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness(merge);
|
||||
|
||||
return nsamples * samplesize;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/max31855.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_MAX31855)
|
||||
|
||||
@@ -220,6 +221,10 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
|
||||
|
||||
sninfo("Read from MAX31855 = 0x%08X\n", regval);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness(regval);
|
||||
|
||||
/* If negative, fix signal bits */
|
||||
|
||||
if (regval & 0x80000000)
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/max6675.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_MAX6675)
|
||||
|
||||
@@ -230,6 +231,10 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness(regval);
|
||||
|
||||
/* Get the temperature */
|
||||
|
||||
*temp = (regval & MAX6675_TEMP_COUPLE) >> 3;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/mb7040.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MB7040)
|
||||
|
||||
@@ -323,6 +324,10 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
if (ret == OK)
|
||||
{
|
||||
*ptr = (int32_t)range;
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness(range);
|
||||
}
|
||||
|
||||
sninfo("range: %04x ret: %d\n", *ptr, ret);
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/mcp9844.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MCP9844)
|
||||
|
||||
@@ -274,6 +275,10 @@ static int mcp9844_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness(raw_temperature);
|
||||
|
||||
/* BIT15 - 13 contain information if preset temperature values
|
||||
* have been exceeded or undercut. BIT12 is now not any longer
|
||||
* needed since we do have the sign information retrieved.
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sensors/mlx90393.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_MLX90393)
|
||||
|
||||
@@ -232,6 +233,11 @@ static void mlx90393_read_measurement_data(FAR struct mlx90393_dev_s *dev)
|
||||
/* Give back the semaphore */
|
||||
|
||||
sem_post(&dev->datasem);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((x_mag << 17) ^ (y_mag << 9) ^ (z_mag << 1) ^
|
||||
temperature);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/mpl115a.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_MPL115A)
|
||||
|
||||
@@ -227,6 +228,11 @@ static void mpl115a_read_press_temp(FAR struct mpl115a_dev_s *priv)
|
||||
priv->mpl115a_temperature >>= 6; /* Tadc is 10bit unsigned */
|
||||
|
||||
sninfo("Temperature = %d\n", priv->mpl115a_temperature);
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((priv->mpl115a_pressure << 16) ^
|
||||
priv->mpl115a_temperature);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/ms58xx.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MS58XX)
|
||||
|
||||
@@ -725,6 +726,8 @@ static int ms58xx_measure(FAR struct ms58xx_dev_s *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
add_sensor_randomness(rawpress ^ rawtemp);
|
||||
|
||||
diff = (int32_t)rawtemp - (int32_t)priv->c5 * ((int32_t)1 << 8);
|
||||
temp = (int32_t)((int64_t)2000 +
|
||||
(int64_t)diff * (int64_t)priv->c6 / ((int64_t)1 << 23));
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/veml6070.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_VEML6070)
|
||||
|
||||
@@ -272,6 +273,10 @@ static ssize_t veml6070_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
buffer[0] = regdata;
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((buffer[1] << 16) ^ buffer[0]);
|
||||
|
||||
return buflen;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/xen1210.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include "xen1210.h"
|
||||
|
||||
@@ -442,6 +443,12 @@ void xen1210_getdata(FAR struct xen1210_dev_s *priv)
|
||||
#ifdef CONFIG_XEN1210_REGDEBUG
|
||||
_err("%02x->%02x\n", regaddr, regval);
|
||||
#endif
|
||||
|
||||
/* Feed sensor data to entropy pool */
|
||||
|
||||
add_sensor_randomness((priv->sample.data_x << 8) ^
|
||||
(priv->sample.data_y << 4) ^
|
||||
(priv->sample.data_z << 4));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -646,4 +646,20 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
int lineno);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_initrngseed
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_INITRNGSEED is selected then board_init_rngseed is
|
||||
* called at up_randompool_initialize() to feed initial random seed
|
||||
* to RNG. Implemenation of this functions should feed at least
|
||||
* MIN_SEED_NEW_ENTROPY_WORDS 32-bit random words to entropy-pool using
|
||||
* up_rngaddentropy() or up_rngaddint().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_INITRNGSEED
|
||||
void board_init_rngseed(void);
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_BOARD_H */
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/crypto/blake2s.h
|
||||
*
|
||||
* This code is based on public-domain/CC0 BLAKE2 reference implementation
|
||||
* by Samual Neves, at https://github.com/BLAKE2/BLAKE2/tree/master/ref
|
||||
* Copyright 2012, Samuel Neves <sneves@dei.uc.pt>
|
||||
*
|
||||
* Copyright (C) 2017 Haltian Ltd. All rights reserved.
|
||||
* Authors: Jussi Kivilinna <jussi.kivilinna@haltian.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_CRYPTO_BLAKE2S_H
|
||||
#define __INCLUDE_NUTTX_CRYPTO_BLAKE2S_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
enum blake2s_constant
|
||||
{
|
||||
BLAKE2S_BLOCKBYTES = 64,
|
||||
BLAKE2S_OUTBYTES = 32,
|
||||
BLAKE2S_KEYBYTES = 32,
|
||||
BLAKE2S_SALTBYTES = 8,
|
||||
BLAKE2S_PERSONALBYTES = 8
|
||||
};
|
||||
|
||||
typedef struct blake2s_state__
|
||||
{
|
||||
uint32_t h[8];
|
||||
uint32_t t[2];
|
||||
uint32_t f[2];
|
||||
size_t buflen;
|
||||
size_t outlen;
|
||||
uint8_t buf[BLAKE2S_BLOCKBYTES];
|
||||
} blake2s_state;
|
||||
|
||||
typedef struct blake2s_param__
|
||||
{
|
||||
uint8_t digest_length; /* 1 */
|
||||
uint8_t key_length; /* 2 */
|
||||
uint8_t fanout; /* 3 */
|
||||
uint8_t depth; /* 4 */
|
||||
uint8_t leaf_length[4]; /* 8 */
|
||||
uint8_t node_offset[4]; /* 12 */
|
||||
uint8_t xof_length[2]; /* 14 */
|
||||
uint8_t node_depth; /* 15 */
|
||||
uint8_t inner_length; /* 16 */
|
||||
/* uint8_t reserved[0]; */
|
||||
uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
|
||||
uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
|
||||
} blake2s_param;
|
||||
|
||||
#ifdef __GNUC__ > 3
|
||||
#define BLAKE2_UNALIGNED 1
|
||||
typedef uint32_t uint32_alias_t __attribute__((may_alias, aligned(1)));
|
||||
typedef uint16_t uint16_alias_t __attribute__((may_alias, aligned(1)));
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Streaming API */
|
||||
|
||||
int blake2s_init(FAR blake2s_state *S, size_t outlen);
|
||||
int blake2s_init_key(FAR blake2s_state *S, size_t outlen, FAR const void *key,
|
||||
size_t keylen);
|
||||
int blake2s_init_param(FAR blake2s_state *S, FAR const blake2s_param *P);
|
||||
int blake2s_update(FAR blake2s_state *S, FAR const void *in, size_t inlen);
|
||||
int blake2s_final(FAR blake2s_state *S, FAR void *out, size_t outlen);
|
||||
|
||||
/* Simple API */
|
||||
|
||||
int blake2s(FAR void *out, size_t outlen, FAR const void *in, size_t inlen,
|
||||
FAR const void *key, size_t keylen);
|
||||
|
||||
/****************************************************************************
|
||||
* Public Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32_t blake2_load32(FAR const void *src)
|
||||
{
|
||||
#if defined(BLAKE2_UNALIGNED) && !defined(CONFIG_ENDIAN_BIG)
|
||||
return *(FAR uint32_alias_t *)src;
|
||||
#elif !defined(CONFIG_ENDIAN_BIG)
|
||||
FAR const uint8_t *p = (FAR const uint8_t *)src;
|
||||
return ((uint32_t)(p[0]) << 24) |
|
||||
((uint32_t)(p[1]) << 16) |
|
||||
((uint32_t)(p[2]) << 8) |
|
||||
((uint32_t)(p[3]) << 0);
|
||||
#else
|
||||
FAR const uint8_t *p = (FAR const uint8_t *)src;
|
||||
return ((uint32_t)(p[0]) << 0) |
|
||||
((uint32_t)(p[1]) << 8) |
|
||||
((uint32_t)(p[2]) << 16) |
|
||||
((uint32_t)(p[3]) << 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint16_t blake2_load16(FAR const void *src)
|
||||
{
|
||||
#if defined(BLAKE2_UNALIGNED) && !defined(CONFIG_ENDIAN_BIG)
|
||||
return *(FAR uint16_alias_t *)src;
|
||||
#elif !defined(CONFIG_ENDIAN_BIG)
|
||||
const uint8_t *p = (FAR const uint8_t *)src;
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
#else
|
||||
const uint8_t *p = (FAR const uint8_t *)src;
|
||||
return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void blake2_store16(FAR void *dst, uint16_t w)
|
||||
{
|
||||
#if defined(BLAKE2_UNALIGNED) && !defined(CONFIG_ENDIAN_BIG)
|
||||
*(FAR uint16_alias_t *)dst = w;
|
||||
#elif !defined(CONFIG_ENDIAN_BIG)
|
||||
FAR uint8_t *p = (FAR uint8_t *)dst;
|
||||
p[1] = (uint8_t)w; w >>= 8;
|
||||
p[0] = (uint8_t)w;
|
||||
#else
|
||||
FAR uint8_t *p = (FAR uint8_t *)dst;
|
||||
p[0] = (uint8_t)w; w >>= 8;
|
||||
p[1] = (uint8_t)w;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void blake2_store32(FAR void *dst, uint32_t w)
|
||||
{
|
||||
#if defined(BLAKE2_UNALIGNED) && !defined(CONFIG_ENDIAN_BIG)
|
||||
*(FAR uint32_alias_t *)dst = w;
|
||||
#elif !defined(CONFIG_ENDIAN_BIG)
|
||||
FAR uint8_t *p = (FAR uint8_t *) dst;
|
||||
p[0] = (uint8_t)(w >> 24);
|
||||
p[1] = (uint8_t)(w >> 16);
|
||||
p[2] = (uint8_t)(w >> 8);
|
||||
p[3] = (uint8_t)(w >> 0);
|
||||
#else
|
||||
FAR uint8_t *p = (FAR uint8_t *) dst;
|
||||
p[0] = (uint8_t)(w >> 0);
|
||||
p[1] = (uint8_t)(w >> 8);
|
||||
p[2] = (uint8_t)(w >> 16);
|
||||
p[3] = (uint8_t)(w >> 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_CRYPTO_BLAKE2S_H */
|
||||
@@ -323,6 +323,38 @@ struct rimeaddr_s
|
||||
* manage the fragmentation. 'struct ieee802154_driver_s' is cast
|
||||
* compatible with 'struct net_driver_s' when CONFIG_NET_MULTINIC is not
|
||||
* defined or when dev->d_lltype == NET_LL_IEEE802154.
|
||||
*
|
||||
* The IEEE802.15.4 MAC network driver has reponsibility for initializing
|
||||
* this structure. In general, all fields must be set to NULL. In
|
||||
* addtion:
|
||||
*
|
||||
* 1) i_panid must be set to identify the network. It may be set to 0xfff
|
||||
* if the device is not associated.
|
||||
* 2) i_dsn must be set to a random value. After that, it will be managed
|
||||
* by the network.
|
||||
* 3) i_nodeaddr must be set after the MAC is assigned an address.
|
||||
* 4) On network TX poll operations, the IEEE802.15.4 MAC needs to provide
|
||||
* the i_frame buffer with size greater than or equal to
|
||||
* CONFIG_NET_6LOWPAN_FRAMELEN. No dev.d_buf need be provided in this
|
||||
* case. The entire is TX is performed using only the i_frame buffer.
|
||||
* 5) On network input RX oprations, both buffers must be provided. The size
|
||||
* of the i_frame buffer is, again, greater than or equal to
|
||||
* CONFIG_NET_6LOWPAN_FRAMELEN. The larger dev.d_buf must have a size
|
||||
* of at least <tbd>. The dev.d_buf is used for de-compressing each
|
||||
* frame and reassembling any fragmented packets to create the full input
|
||||
* packet that is provided to the applicatino.
|
||||
*
|
||||
* Frame Organization:
|
||||
*
|
||||
* Content Offset
|
||||
* +------------------+ 0
|
||||
* | Frame Header |
|
||||
* +------------------+ i_dataoffset
|
||||
* | Procotol Headers |
|
||||
* | Data Payload |
|
||||
* +------------------+ i_framelen
|
||||
* | Unused |
|
||||
* +------------------+ CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
*/
|
||||
|
||||
struct ieee802154_driver_s
|
||||
@@ -344,7 +376,8 @@ struct ieee802154_driver_s
|
||||
* requesting new framesusing break-off fram buffers. That frame buffer
|
||||
* management must be controlled by the IEEE802.15.4 MAC driver.
|
||||
*
|
||||
* Driver provied frame buffers should be 16-bit aligned.
|
||||
* Driver provided frame buffers should of size CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
* and should be 16-bit aligned.
|
||||
*/
|
||||
|
||||
FAR uint8_t *i_frame;
|
||||
@@ -360,6 +393,31 @@ struct ieee802154_driver_s
|
||||
|
||||
uint16_t i_framelen;
|
||||
|
||||
/* i_panid. The PAN ID is 16-bit number that identifies the network. It
|
||||
* must be unique to differentiate a network. All the nodes in the same
|
||||
* network should have the same PAN ID. This value must be provided to
|
||||
* the network from the IEEE802.15.4 MAC driver.
|
||||
*
|
||||
* If this value is 0xffff, the device is not associated.
|
||||
*/
|
||||
|
||||
uint16_t i_panid;
|
||||
|
||||
/* i_node_addr. The address assigned to this node. */
|
||||
|
||||
struct rimeaddr_s i_nodeaddr;
|
||||
|
||||
/* i_dsn. The sequence number in the range 0x00-0xff added to the
|
||||
* transmitted data or MAC command frame. The default is a random value
|
||||
* within that range.
|
||||
*
|
||||
* This field must be initialized to a random number by the IEEE802.15.4
|
||||
* MAC driver. It sill be subsequently incremented on each frame by the
|
||||
* network logic.
|
||||
*/
|
||||
|
||||
uint8_t i_dsn;
|
||||
|
||||
/* The following fields are device-specific metadata used by the 6loWPAN
|
||||
* stack and should not be modified by the IEEE802.15.4 MAC network drvier.
|
||||
*/
|
||||
@@ -385,9 +443,9 @@ struct ieee802154_driver_s
|
||||
|
||||
uint8_t i_rime_hdrlen;
|
||||
|
||||
/* Next available pointer into header */
|
||||
/* Offset first available byte for the payload after header region. */
|
||||
|
||||
uint8_t i_hdrptr;
|
||||
uint8_t i_dataoffset;
|
||||
|
||||
/* Packet buffer metadata: Attributes and addresses */
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/random.h
|
||||
*
|
||||
* Copyright (C) 2015-2017 Haltian Ltd. All rights reserved.
|
||||
* Authors: Juha Niskanen <juha.niskanen@haltian.com>
|
||||
* Jussi Kivilinna <jussi.kivilinna@haltian.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_RANDOM_H
|
||||
#define __INCLUDE_NUTTX_RANDOM_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <sys/random.h> /* getrandom() */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Size of entropy pool in 32-bit integers, must be power of two */
|
||||
|
||||
#define ENTROPY_POOL_SIZE 128
|
||||
|
||||
#define add_irq_randomness(x) up_rngaddint(RND_SRC_IRQ, (x))
|
||||
#define add_sensor_randomness(x) up_rngaddint(RND_SRC_SENSOR, (x))
|
||||
#define add_time_randomness(x) up_rngaddint(RND_SRC_TIME, (x))
|
||||
#define add_hw_randomness(x) up_rngaddint(RND_SRC_HW, (x))
|
||||
#define add_sw_randomness(x) up_rngaddint(RND_SRC_SW, (x))
|
||||
#define add_ui_randomness(x) up_rngaddint(RND_SRC_UI, (x))
|
||||
|
||||
/* Allow above macros to always exist in source without ifdefs */
|
||||
|
||||
#ifndef CONFIG_CRYPTO_RANDOM_POOL
|
||||
# define up_rngaddint(k, x) ((void)(k),(void)(x))
|
||||
# define up_rngaddentropy(k, buf, x) ((void)(k),(void)(buf),(void)(x))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Entropy pool structure */
|
||||
|
||||
struct entropy_pool_s
|
||||
{
|
||||
volatile uint32_t pool[ENTROPY_POOL_SIZE];
|
||||
};
|
||||
|
||||
/* Randomness sources */
|
||||
|
||||
enum rnd_source_t
|
||||
{
|
||||
RND_SRC_TIME = 0,
|
||||
RND_SRC_IRQ,
|
||||
RND_SRC_SENSOR,
|
||||
RND_SRC_HW, /* unique per HW UID or coming from factory line. */
|
||||
RND_SRC_SW, /* unique per SW version. */
|
||||
RND_SRC_UI /* buttons etc. user-visible interface elements. */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_ENTROPY_POOL
|
||||
/* Entropy pool structure can be provided by board source. Use for this is,
|
||||
* for example, allocate entropy pool from special area of RAM which content
|
||||
* is kept over system reset. */
|
||||
|
||||
extern struct entropy_pool_s board_entropy_pool;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CRYPTO_RANDOM_POOL
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_rngaddint
|
||||
*
|
||||
* Description:
|
||||
* Add one integer to entropy pool, contributing a specific kind
|
||||
* of entropy to pool.
|
||||
*
|
||||
* Parameters:
|
||||
* kindof - Enumeration constant telling where val came from
|
||||
* val - Integer to be added
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_rngaddint(enum rnd_source_t kindof, int val);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_rngaddentropy
|
||||
*
|
||||
* Description:
|
||||
* Add buffer of integers to entropy pool.
|
||||
*
|
||||
* Parameters:
|
||||
* kindof - Enumeration constant telling where val came from
|
||||
* buf - Buffer of integers to be added
|
||||
* n - Number of elements in buf
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_rngaddentropy(enum rnd_source_t kindof, FAR const uint32_t *buf,
|
||||
size_t n);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_rngreseed
|
||||
*
|
||||
* Description:
|
||||
* Force reseeding random number generator from entropy pool
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_rngreseed(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_randompool_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize entropy pool and random number generator
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_randompool_initialize(void);
|
||||
|
||||
#endif /* CONFIG_CRYPTO_RANDOM_POOL */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_RANDOM_H */
|
||||
@@ -0,0 +1,158 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/hts221.h
|
||||
*
|
||||
* Copyright (C) 2014 Haltian Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTT_SENSORS_HTS221_H
|
||||
#define __INCLUDE_NUTT_SENSORS_HTS221_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define HTS221_TEMPERATURE_PRECISION 100
|
||||
#define HTS221_HUMIDITY_PRECISION 10
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* Number of temperature samples */
|
||||
|
||||
typedef enum hts221_avrg_temp_e
|
||||
{
|
||||
HTS221_AVGT2 = 0,
|
||||
HTS221_AVGT4,
|
||||
HTS221_AVGT8,
|
||||
HTS221_AVGT16, /* Default value */
|
||||
HTS221_AVGT32,
|
||||
HTS221_AVGT64,
|
||||
HTS221_AVGT128,
|
||||
HTS221_AVGT256
|
||||
} hts221_avrg_temp_t;
|
||||
|
||||
/* Number of humidity samples */
|
||||
|
||||
typedef enum hts221_avrg_humid_e
|
||||
{
|
||||
HTS221_AVGH4 = 0,
|
||||
HTS221_AVGH8,
|
||||
HTS221_AVGH16,
|
||||
HTS221_AVGH32, /* Default value */
|
||||
HTS221_AVGH64,
|
||||
HTS221_AVGH128,
|
||||
HTS221_AVGH256,
|
||||
HTS221_AVGH512
|
||||
}hts221_avrg_humid_t;
|
||||
|
||||
/* Output data rate configuration */
|
||||
|
||||
typedef enum hts221_odr_e
|
||||
{
|
||||
HTS221_ODR_ONESHOT = 0,
|
||||
HTS221_ODR_1HZ,
|
||||
HTS221_ODR_7HZ,
|
||||
HTS221_ODR_12_5HZ
|
||||
} hts221_odr_t;
|
||||
|
||||
/* Configuration structure */
|
||||
|
||||
typedef struct hts221_settings_s
|
||||
{
|
||||
hts221_avrg_temp_t temp_resol; /* Temperature resolution. The more
|
||||
* samples sensor takes, the more power
|
||||
* it uses */
|
||||
hts221_avrg_humid_t humid_resol; /* Humidity resolution. The more
|
||||
* samples sensor takes, the more power
|
||||
* it uses */
|
||||
hts221_odr_t odr; /* Output data rate */
|
||||
bool is_bdu; /* If read operation is not faster than output
|
||||
* operation, then this variable must be set to true */
|
||||
bool is_data_rdy; /* Must be set to true, if interrupt needed.
|
||||
* Default is 0, disabled */
|
||||
bool is_high_edge; /* High or low interrupt signal from device.
|
||||
* Default is high, 0 */
|
||||
bool is_open_drain; /* Open drain or push-pull on data-ready pin.
|
||||
* Default is push-pull, 0 */
|
||||
bool is_boot; /* Refresh the content of the internal registers */
|
||||
} hts221_settings_t;
|
||||
|
||||
/* Interrupt configuration data structure */
|
||||
|
||||
typedef struct hts221_config_s
|
||||
{
|
||||
int irq;
|
||||
CODE int (*irq_attach)(FAR struct hts221_config_s * state, xcpt_t isr);
|
||||
CODE void (*irq_enable)(FAR const struct hts221_config_s * state,
|
||||
bool enable);
|
||||
CODE void (*irq_clear)(FAR const struct hts221_config_s * state);
|
||||
CODE int (*set_power)(FAR const struct hts221_config_s *state, bool on);
|
||||
} hts221_config_t;
|
||||
|
||||
/* Raw data structure */
|
||||
|
||||
typedef struct hts221_raw_data_s
|
||||
{
|
||||
uint8_t humid_low_bits;
|
||||
uint8_t humid_high_bits;
|
||||
uint8_t temp_low_bits;
|
||||
uint8_t temp_high_bits;
|
||||
} hts221_raw_data_t;
|
||||
|
||||
typedef struct hts221_conv_data_s
|
||||
{
|
||||
int temperature;
|
||||
unsigned int humidity;
|
||||
} hts221_conv_data_t;
|
||||
|
||||
/* Status register data */
|
||||
|
||||
typedef struct hts221_status_s
|
||||
{
|
||||
bool is_humid_ready;
|
||||
bool is_temp_ready;
|
||||
} hts221_status_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int hts221_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
uint8_t addr, hts221_config_t * config);
|
||||
|
||||
#endif /* __INCLUDE_NUTT_SENSORS_HTS221_H */
|
||||
@@ -115,4 +115,14 @@
|
||||
#define SNIOC_RESET _SNIOC(0x0028) /* Arg: None */
|
||||
#define SNIOC_OVERSAMPLING _SNIOC(0x0029) /* Arg: uint16_t value */
|
||||
|
||||
/* IOCTL commands unique to the HTS221 */
|
||||
|
||||
#define SNIOC_GET_DEV_ID _SNIOC(0x002a)
|
||||
#define SNIOC_CFGR _SNIOC(0x002b)
|
||||
#define SNIOC_START_CONVERSION _SNIOC(0x002c)
|
||||
#define SNIOC_CHECK_STATUS_REG _SNIOC(0x002d)
|
||||
#define SNIOC_READ_RAW_DATA _SNIOC(0x002e)
|
||||
#define SNIOC_READ_CONVERT_DATA _SNIOC(0x002f)
|
||||
#define SNIOC_DUMP_REGS _SNIOC(0x0030)
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user