multi-app based on nrf52sdk

This commit is contained in:
Thomas Klaehn
2020-03-12 15:30:53 +01:00
parent df2d84dee1
commit 3a31e2bcb9
18 changed files with 3567 additions and 595 deletions

View File

@@ -1,67 +0,0 @@
#include <stdlib.h>
#include <assert.h>
#include "driver.h"
int drv_open(const struct driver *drv)
{
int res = -1;
assert(drv != NULL);
if(drv->fp->open) {
res = drv->fp->open(drv);
}
return res;
}
int drv_close(const struct driver *drv)
{
int res = -1;
assert(drv != NULL);
if(drv->fp->close) {
res = drv->fp->close(drv);
}
return res;
}
int drv_read(const struct driver *drv, char *buffer, unsigned int length)
{
int res = -1;
assert(drv != NULL);
if(drv->fp->read) {
res = drv->fp->read(drv, buffer, length);
}
return res;
}
int drv_write(const struct driver *drv, const char *buffer, unsigned int length)
{
int res = -1;
assert(drv != NULL);
if(drv->fp->write) {
res = drv->fp->write(drv, buffer, length);
}
return res;
}
int drv_ioctl(const struct driver *drv, unsigned int cmd, unsigned int argc, ...)
{
int res = -1;
assert(drv != NULL);
if(drv->fp->ioctl) {
va_list args;
va_start(args, argc);
res = drv->fp->ioctl(drv, cmd, argc, args);
va_end(args);
}
return res;
}