agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
random.h File Reference
#include <zrtos/cast.h>
#include <zrtos/vfs_plugin.h>
#include <zrtos/vfs_file.h>
Include dependency graph for random.h:

Go to the source code of this file.

Functions

zrtos_error_t zrtos_vfs_module_random__on_open (zrtos_vfs_file_t *thiz)
 
zrtos_error_t zrtos_vfs_module_random__on_read (zrtos_vfs_file_t *thiz, char *path, void *buf, size_t len, zrtos_vfs_offset_t offset, size_t *ret)
 
 ZRTOS_VFS_PLUGIN__INIT (random, ZRTOS_VFS_PLUGIN__0_ON_OPEN(zrtos_vfs_module_random__on_open) ZRTOS_VFS_PLUGIN__1_ON_CLOSE_DEFAULT() ZRTOS_VFS_PLUGIN__2_ON_MOUNT_DEFAULT() ZRTOS_VFS_PLUGIN__3_ON_UMOUNT_DEFAULT() ZRTOS_VFS_PLUGIN__4_ON_READ(zrtos_vfs_module_random__on_read) ZRTOS_VFS_PLUGIN__5_ON_WRITE_DEFAULT() ZRTOS_VFS_PLUGIN__6_ON_CAN_READ_DEFAULT() ZRTOS_VFS_PLUGIN__7_ON_CAN_WRITE_DEFAULT() ZRTOS_VFS_PLUGIN__8_ON_SEEK_DEFAULT() ZRTOS_VFS_PLUGIN__9_ON_IOCTL_DEFAULT())
 

Function Documentation

◆ zrtos_vfs_module_random__on_open()

zrtos_error_t zrtos_vfs_module_random__on_open ( zrtos_vfs_file_t thiz)

Definition at line 19 of file random.h.

21  {
23  thiz
24  ,(zrtos_vfs_offset_t)0xACE1
25  );
26 
27  return ZRTOS_ERROR__SUCCESS;
28 }
size_t zrtos_vfs_offset_t
Definition: vfs_plugin.h:49
Successful program execution status.
Definition: error.h:22
void zrtos_vfs_file__set_offset(zrtos_vfs_file_t *thiz, zrtos_vfs_offset_t offset)
Definition: vfs_file.h:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_vfs_module_random__on_read()

zrtos_error_t zrtos_vfs_module_random__on_read ( zrtos_vfs_file_t thiz,
char *  path,
void *  buf,
size_t  len,
zrtos_vfs_offset_t  offset,
size_t ret 
)

Definition at line 30 of file random.h.

37  {
38  uint16_t lfsr = (uint16_t)zrtos_vfs_file__get_offset(thiz);
39  uint8_t *buffer = ZRTOS_CAST(uint8_t*,buf);
40 
41  *ret = len;
42 
43  while(len--){
44  lfsr ^= lfsr >> 7;
45  lfsr ^= lfsr << 9;
46  lfsr ^= lfsr >> 13;
47 
48  *buffer++ = (lfsr >> 4);
49  }
50 
52  thiz
53  ,(zrtos_vfs_offset_t)lfsr
54  );
55 
56  return ZRTOS_ERROR__SUCCESS;
57 }
#define ZRTOS_CAST(type, value)
Definition: cast.h:18
size_t zrtos_vfs_offset_t
Definition: vfs_plugin.h:49
zrtos_vfs_offset_t zrtos_vfs_file__get_offset(zrtos_vfs_file_t *thiz)
Definition: vfs_file.h:207
Successful program execution status.
Definition: error.h:22
void zrtos_vfs_file__set_offset(zrtos_vfs_file_t *thiz, zrtos_vfs_offset_t offset)
Definition: vfs_file.h:203
static uint8_t
Definition: mcp2515.h:159
Here is the call graph for this function:

◆ ZRTOS_VFS_PLUGIN__INIT()