!204 update script/libs/tsl2561.lua.
[LuatOS.git] / components / sfd / luat_sfd.c
blobac6edbe70a1ba9c9f757407aac099c234e1b34fa
2 #include "luat_base.h"
4 #include "luat_sfd.h"
5 #include "luat_mem.h"
7 #define LUAT_LOG_TAG "sfd"
8 #include "luat_log.h"
10 int luat_sfd_status (sfd_drv_t* drv) {
11 if (drv == NULL)
12 return -1;
13 return drv->opts->status(drv->userdata);
16 int luat_sfd_read (sfd_drv_t* drv, char* buff, size_t offset, size_t len) {
17 if (drv == NULL)
18 return -1;
19 return drv->opts->read(drv->userdata, buff, offset, len);
22 int luat_sfd_write (sfd_drv_t* drv, const char* buff, size_t offset, size_t len) {
23 if (drv == NULL)
24 return -1;
25 return drv->opts->write(drv->userdata, buff, offset, len);
28 int luat_sfd_erase (sfd_drv_t* drv, size_t offset, size_t len) {
29 if (drv == NULL)
30 return -1;
31 return drv->opts->erase(drv->userdata, offset, len);
34 int luat_sfd_ioctl (sfd_drv_t* drv, size_t cmd, void* buff) {
35 if (drv == NULL)
36 return -1;
37 return drv->opts->ioctl(drv->userdata, cmd, buff);