flash.h

Go to the documentation of this file.
00001 
00042 #ifndef DRV_FLASH_H
00043 #define DRV_FLASH_H
00044 
00045 #include <cfg/macros.h>
00046 #include <cfg/module.h>
00047 
00048 
00049 #include CPU_HEADER(flash)
00050 
00054 typedef struct Flash
00055 {
00059     KFile fd;
00060 
00064     bool page_dirty;
00065 
00069     page_t curr_page;
00070 
00075     uint8_t page_buf[FLASH_PAGE_SIZE];
00076 } Flash;
00077 
00081 #define KFT_FLASH MAKE_ID('F', 'L', 'A', 'S')
00082 
00086 INLINE Flash * FLASH_CAST(KFile *fd)
00087 {
00088     ASSERT(fd->_type == KFT_FLASH);
00089     return (Flash *)fd;
00090 }
00091 
00092 
00093 MOD_DEFINE(flash);
00094 
00099 INLINE void flash_init(Flash *fd)
00100 {
00101     flash_hw_init(fd);
00102 
00103     MOD_INIT(flash);
00104 }
00105 
00106 
00107 
00108 #endif /* DRV_FLASH_H */
00109