agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
sync.h File Reference
#include <avr/io.h>
#include <avr/interrupt.h>
#include <zrtos/cast.h>
#include <zrtos/types.h>
#include <zrtos/vfs/module/spi/sync.h>
Include dependency graph for sync.h:

Go to the source code of this file.

Functions

zrtos_error_t zrtos_vfs_module_avr_spi_sync__on_write_callback (zrtos_vfs_module_spi_sync_inode_t *inode_data, zrtos_vfs_module_spi_sync_file_t *file_data, void *buf, size_t len, size_t *l)
 
zrtos_error_t zrtos_vfs_module_avr_spi_sync__on_write (zrtos_vfs_file_t *thiz, char *path, void *buf, size_t len, zrtos_vfs_offset_t offset, size_t *out)
 
 ZRTOS_VFS_PLUGIN__INIT (spi, ZRTOS_VFS_PLUGIN__0_ON_OPEN(zrtos_vfs_module_spi_sync__on_open) ZRTOS_VFS_PLUGIN__1_ON_CLOSE(zrtos_vfs_module_spi_sync__on_close) ZRTOS_VFS_PLUGIN__2_ON_MOUNT(zrtos_vfs_module_spi_sync__on_mount) ZRTOS_VFS_PLUGIN__3_ON_UMOUNT(zrtos_vfs_module_spi_sync__on_umount) ZRTOS_VFS_PLUGIN__4_ON_READ_DEFAULT() ZRTOS_VFS_PLUGIN__5_ON_WRITE(zrtos_vfs_module_avr_spi_sync__on_write) 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_avr_spi_sync__on_write()

zrtos_error_t zrtos_vfs_module_avr_spi_sync__on_write ( zrtos_vfs_file_t thiz,
char *  path,
void *  buf,
size_t  len,
zrtos_vfs_offset_t  offset,
size_t out 
)

Definition at line 43 of file sync.h.

50  {
52  thiz
53  ,path
54  ,buf
55  ,len
56  ,offset
57  ,out
59  );
60 }
zrtos_error_t zrtos_vfs_module_spi_sync__on_write_helper(zrtos_vfs_file_t *thiz, char *path, void *buf, size_t len, zrtos_vfs_offset_t offset, size_t *out, zrtos_error_t(*callback)(zrtos_vfs_module_spi_sync_inode_t *inode_data, zrtos_vfs_module_spi_sync_file_t *file_data, void *buf, size_t len, size_t *l))
Definition: spi_sync.h:151
zrtos_error_t zrtos_vfs_module_avr_spi_sync__on_write_callback(zrtos_vfs_module_spi_sync_inode_t *inode_data, zrtos_vfs_module_spi_sync_file_t *file_data, void *buf, size_t len, size_t *l)
Definition: sync.h:21
Here is the call graph for this function:

◆ zrtos_vfs_module_avr_spi_sync__on_write_callback()

zrtos_error_t zrtos_vfs_module_avr_spi_sync__on_write_callback ( zrtos_vfs_module_spi_sync_inode_t inode_data,
zrtos_vfs_module_spi_sync_file_t file_data,
void *  buf,
size_t  len,
size_t l 
)

Definition at line 21 of file sync.h.

27  {
28  zrtos_error_t ret = ZRTOS_ERRROR__SUCCESS;
29  uint8_t *data_out = ZRTOS_CAST(uint8_t*,buf);
30  SPCR = file_data->control;
31  while(len--){
32  SPDR = *data_out;
33  while(!(SPSR & (1<<SPIF))){
34  continue;
35  }
36  *data_out++ = SPDR;
37  }
38  SPCR = 0;
39  *l = zrtos_types__ptr_get_byte_distance(data_out,buf);
40  return ret;
41 }
#define ZRTOS_CAST(type, value)
Definition: cast.h:18
size_t zrtos_types__ptr_get_byte_distance(void *bigger, void *smaller)
Definition: types.h:43
zrtos_vfs_module_spi_sync_control_t control
Definition: spi_sync.h:53
static uint8_t
Definition: mcp2515.h:159
zrtos_error_t
Definition: error.h:20
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZRTOS_VFS_PLUGIN__INIT()