Add test suite for ramp and pwm driver.
[bertos.git] / kern / kfile.h
index b46207a091fb6ac7a9fcfded43e3e361e542666e..4bb7a2380946748f6063e3d6bc56cc689ba0d707 100644 (file)
  *
  * \brief Virtual KFile I/O interface.
  * KFile is a generic interface for file I/O.
- * Uses an of object oriented model to supply
+ * It uses an object-oriented model to supply
  * a generic interface for drivers to communicate.
- * This module contains only definitions,data structure
+ * This module contains only definitions, the instance structure
  * and an API.
- * Each KFile user should implement at least some core functions.
+ * Each KFile user should implement at least some methods.
  * E.G.
  * If you have a serial driver and want to comply to KFile interface,
  * you have to declare your context structure:
@@ -74,7 +74,7 @@
  * \endcode
  * KFILESERIAL macro helps to ensure that obj passed is really a Serial.
  *
- * KFile interface do not supply the open function: this is done deliberately,
+ * KFile interface do not supply the open function: this is deliberate,
  * because in embedded systems each device has its own init parameters.
  * For the same reason specific file settings (like baudrate for Serial, for example)
  * are demanded to specific driver implementation.
@@ -90,6 +90,7 @@
 
 #include <cfg/compiler.h>
 #include <cfg/debug.h>
+#include <cfg/macros.h>
 
 /* fwd decl */
 struct KFile;
@@ -110,7 +111,7 @@ typedef enum KSeekMode
 
 /**
  * Prototypes for KFile access functions.
- * I/O file function must be ANSI compliant.
+ * I/O file functions must be ANSI compliant.
  * \note A KFile user can choose which function subset to implement,
  *       but has to set to NULL unimplemented features.
  * \{
@@ -164,20 +165,6 @@ typedef int (*ErrorFunc_t) (struct KFile *fd);
 typedef void (*ClearErrFunc_t) (struct KFile *fd);
 /* \} */
 
-/**
- * KFile type.
- * Used at runtime and in debug mode only to check
- * "dynamic casts".
- * \note Add here new KFile types.
- */
-typedef enum KFileType
-{
-       KFT_GENERIC, ///< Generic
-       KFT_SERIAL,  ///< Serial driver
-       KFT_BATTFS,  ///< BattFS file
-       KFT_CNT
-} KFileType;
-
 /**
  * Context data for callback functions which operate on
  * pseudo files.
@@ -193,18 +180,13 @@ typedef struct KFile
        FlushFunc_t    flush;
        ErrorFunc_t    error;
        ClearErrFunc_t clearerr;
-       DB(KFileType _type); ///< Used to keep trace, at runtime, of obj type.
+       DB(id_t _type); ///< Used to keep trace, at runtime, of obj type.
 
        /* NOTE: these must _NOT_ be size_t on 16bit CPUs! */
        uint32_t seek_pos;
        uint32_t size;
 } KFile;
 
-/**
- * Check if \a fd is a generic KFile type.
- */
-#define KFILE_ASSERT_GENERIC(fd) ASSERT(fd->_type == KFT_GENERIC)
-
 /**
  * Generic implementation of kfile_seek.
  */