X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Fkfile.h;fp=mware%2Fkfile.h;h=a752830c4989d60e857b9f643b1e4b9e21334e2d;hb=d8602953474b131e35b1cc3fbec543e3988c7af8;hp=0000000000000000000000000000000000000000;hpb=3e64690f20260eb01ea440d745c177930fba6568;p=bertos.git diff --git a/mware/kfile.h b/mware/kfile.h new file mode 100755 index 00000000..a752830c --- /dev/null +++ b/mware/kfile.h @@ -0,0 +1,52 @@ +/*! + * \file + * + * + * \brief Virtual KFile I/O interface. + * + * \version $Id$ + * \author Bernardo Innocenti + */ + +/* + * $Log$ + * Revision 1.1 2004/08/04 02:40:25 bernie + * Add virtual file I/O interface. + * + */ +#ifndef MWARE_KFILE_H +#define MWARE_KFILE_H + +#include + +/* fwd decl */ +struct _KFile; + +typedef size_t (*ReadFunc_t) (struct _KFile *fd, char *buf, size_t size); +typedef size_t (*WriteFunc_t) (struct _KFile *fd, const char *buf, size_t size); +typedef bool (*SeekFunc_t) (struct _KFile *fd, int32_t offset); +typedef bool (*OpenFunc_t) (struct _KFile *fd, const char *name, int mode); +typedef bool (*CloseFunc_t) (struct _KFile *fd); + + +/* Context data for callback functions which operate on + * pseudo files. + */ +typedef struct _KFile +{ + ReadFunc_t read; + WriteFunc_t write; + SeekFunc_t seek; + OpenFunc_t open; + CloseFunc_t close; + + /* NOTE: these must _NOT_ be size_t on 16bit CPUs! */ + uint32_t SeekPos; + uint32_t Size; +} KFile; + +#endif /* MWARE_KFILE_H */