Modified flash_avr module to work with new kfile interface. Addedd a new tipe of...
[bertos.git] / bertos / cpu / avr / drv / flash_avr.h
index 7b4317d97106029c5bbab80e341f88a153ef6060..390f648d92c78541329dd9741686e78cb05c1b22 100644 (file)
 #include <cfg/compiler.h>
 #include <kern/kfile.h>
 
+
+/**
+ * FlashAvr KFile context structure.
+ */
+typedef struct KFileFlashAvr
+{
+       KFile fd;                       ///< File descriptor.
+} KFileFlashAvr;
+
+
+
+/**
+ * ID for FlashAvr
+ */
+#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
+
+/**
+ * Convert + ASSERT from generic KFile to KFileFlashAvr.
+ */
+INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd)
+{
+       ASSERT(fd->_type == KFT_FLASHAVR);
+       return (KFileFlashAvr *)fd;
+}
+
+
+
 bool flash_avr_test(void);
 void flash_avr_init(struct KFile *fd);
 
 
+
 #endif /* DRV_FLASH_AVR_H */