37 lines
590 B
C
37 lines
590 B
C
|
/*
|
||
|
* rng.c
|
||
|
*
|
||
|
* Created on: Aug 30, 2016
|
||
|
* Author: tkl
|
||
|
*/
|
||
|
|
||
|
#include <stddef.h>
|
||
|
#include "rng.h"
|
||
|
|
||
|
int rng_open(const struct rng *device)
|
||
|
{
|
||
|
if(device == NULL)
|
||
|
return -1;
|
||
|
|
||
|
rng_fp_open_t open = device->fp->open;
|
||
|
return open(device->arch_dep_device);
|
||
|
}
|
||
|
|
||
|
int rng_close(const struct rng *device)
|
||
|
{
|
||
|
if(device == NULL)
|
||
|
return -1;
|
||
|
|
||
|
rng_fp_close_t close = device->fp->close;
|
||
|
return close(device->arch_dep_device);
|
||
|
}
|
||
|
|
||
|
unsigned int rng_read(const struct rng *device)
|
||
|
{
|
||
|
if(device == NULL)
|
||
|
return 0;
|
||
|
|
||
|
rng_fp_read_t read = device->fp->read;
|
||
|
return read(device->arch_dep_device);
|
||
|
}
|