00001 #ifndef _DEV_FLASH_H_ 00002 #define _DEV_FLASH_H_ 00003 00004 #include <sys/device.h> 00005 00018 #define FLASH 13 00019 00023 #define SPI_CS_FLASH1 PORT5 00024 00028 #define SPI_CS_FLASH2 PORT6 00029 00033 #define PAGE_SIZE 0x0108 00034 00035 typedef struct _FLASHDCB FLASHDCB; 00036 typedef struct _FLASHICB FLASHICB; 00037 00042 struct _FLASHDCB { 00046 u_int Flash1_pages; 00047 00051 u_int Flash2_pages; 00052 }; 00053 00058 struct _FLASHICB { 00062 u_int readPageNumber; 00066 u_int writePageNumber; 00070 u_int flashMaxPage; 00071 00075 u_char writePage[PAGE_SIZE]; 00076 }; 00077 00081 extern NUTDEVICE devFlashSpi; 00082 00091 extern int FlashInit(NUTDEVICE *dev); 00092 00105 extern void flashWritePage(NUTDEVICE *dev, u_int pageNumber, u_char* page); 00106 00117 extern int flashReadPage(NUTDEVICE *dev, u_int pageNumber, u_char* page); 00118 00130 extern int FlashIOCtl(NUTDEVICE *dev, int param, void *value); 00131 00138 extern void FlashFlush(NUTDEVICE *dev); 00139 00140 #endif