完整的Bell实验室的嵌入式文件系统TFS
源代码在线查看: flashdev.h
/* * flash.h * * by Thomas E. Arvanits (tharvan@inaccessnetworks.com) * * Header file for use with 29F128J3A (intel strata flash) * for 16 bit mode, in x2 configuration for 32 bit access. */ #ifndef _flash_h #define _flash_h #include "SA-1100.h" //#define DEBUGFLASH 1 #undef DEBUGFLASH #ifdef DEBUGFLASH #define FDEBUG(c) while((Ser3UTSR0 & UTSR0_TFS) == 0); Ser3UTDR = (c) #else #define FDEBUG(c) #endif #define FPRINT(c) while((Ser3UTSR0 & UTSR0_TFS) == 0); Ser3UTDR = (c) //#define FLASH_LOCK_SUPPORTED #undef FLASH_LOCK_SUPPORTED /* * FLASHFUNCSIZE: * Size of the array used by the flash operations to copy functions into * RAM space for execution out of non-flash memory. */ #define FLASHFUNCSIZE 320 #define FLASH_TIMEOUT 1000000 /* Manufacturer and device ids... */ #define INTEL28F128J 0x00890018 #define WIDTH 4 #define WIDTH_IN_BYTES 4 #define WIDTH_IN_BITS 32 #define WIDTH_MASK 1 #define ftype volatile unsigned long #define FLASHLOCK Flashlock32 #define ENDFLASHLOCK EndFlashlock32 #define FLASHERASE Flasherase32 #define ENDFLASHERASE EndFlasherase32 #define FLASHWRITE Flashwrite32 #define ENDFLASHWRITE EndFlashwrite32 #define FLASHEWRITE Flashewrite32 #define ENDFLASHEWRITE EndFlashewrite32 #define FLASHTYPE Flashtype32 #define ENDFLASHTYPE EndFlashtype32 #define FWrite(to,frm) (*(ftype *)(to) = *(ftype *)(frm)) #define Write_to(add, val) (*(ftype *)(add) = (val)) #define Write_01_to(add) (*(ftype *)(add) = 0x00010001) #define Write_20_to(add) (*(ftype *)(add) = 0x00200020) #define Write_40_to(add) (*(ftype *)(add) = 0x00400040) #define Write_70_to(add) (*(ftype *)(add) = 0x00700070) #define Write_d0_to(add) (*(ftype *)(add) = 0x00d000d0) #define Write_50_to_base() (*(ftype *)(fdev->base) = 0x00500050) #define Write_60_to_base() (*(ftype *)(fdev->base) = 0x00600060) #define Write_70_to_base() (*(ftype *)(fdev->base) = 0x00700070) #define Write_90_to_base() (*(ftype *)(fdev->base) = 0x00900090) #define Write_ff_to_base() (*(ftype *)(fdev->base) = 0x00FF00FF) #define Read_from(add) (*(ftype *)(add)) #define Read_0000_from_base() (*(ftype *)(fdev->base+(0x00000000 #define Read_0001_from_base() (*(ftype *)(fdev->base+(0x00000001 #define Read_5555_from_base() (*(ftype *)(fdev->base+(0x5555 #define Is_ff(add) (*(ftype *)(add) == 0xFFFFFFFF) #define Is_not_ff(add) (*(ftype *)(add) != 0xFFFFFFFF) #define Is_Equal(p1,p2) (*(ftype *)(p1) == *(ftype *)(p2)) #define Is_Not_Equal(p1,p2) (*(ftype *)(p1) != *(ftype *)(p2)) #endif /* _flash_h */