yaffs Added some more tests to timothy_tests.
[yaffs2.git] / direct / basic-test / yaffs_norif1.c
index cde36a9..5394f0e 100644 (file)
@@ -45,8 +45,6 @@ const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.6 2010-02-18 01:18
 #include "yaffs_flashif.h"
 #include "yaffs_guts.h"
 
-#include "devextras.h"
-
 #define SPARE_BYTES_PER_CHUNK  16
 #define M18_SKIP               16
 #define PROG_REGION_SIZE       1024
@@ -88,7 +86,7 @@ const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.6 2010-02-18 01:18
 #define DEVICE_BASE     (32 * 1024 * 1024)
 #endif
 
-u32 *Block2Addr(yaffs_dev_t *dev, int blockNumber)
+u32 *Block2Addr(struct yaffs_dev *dev, int blockNumber)
 {
        u32 addr;
        dev=dev;
@@ -99,7 +97,7 @@ u32 *Block2Addr(yaffs_dev_t *dev, int blockNumber)
        return (u32 *) addr;
 }
 
-u32 *Block2FormatAddr(yaffs_dev_t *dev,int blockNumber)
+u32 *Block2FormatAddr(struct yaffs_dev *dev,int blockNumber)
 {
        u32 addr;
 
@@ -108,7 +106,7 @@ u32 *Block2FormatAddr(yaffs_dev_t *dev,int blockNumber)
        
        return (u32 *)addr;
 }
-u32 *Chunk2DataAddr(yaffs_dev_t *dev,int chunk_id)
+u32 *Chunk2DataAddr(struct yaffs_dev *dev,int chunk_id)
 {
        unsigned block;
        unsigned chunkInBlock;
@@ -123,7 +121,7 @@ u32 *Chunk2DataAddr(yaffs_dev_t *dev,int chunk_id)
        return (u32 *)addr;
 }
 
-u32 *Chunk2SpareAddr(yaffs_dev_t *dev,int chunk_id)
+u32 *Chunk2SpareAddr(struct yaffs_dev *dev,int chunk_id)
 {
        unsigned block;
        unsigned chunkInBlock;
@@ -149,12 +147,12 @@ void ynorif1_AndBytes(u8*target, const u8   *src, int nbytes)
         }
 }
 
-int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare)
+int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare)
 {
         u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
         u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
         
-        yaffs_spare tmpSpare;
+        struct yaffs_spare tmpSpare;
         
         /* We should only be getting called for one of 3 reasons:
          * Writing a chunk: data and spare will not be NULL
@@ -162,7 +160,7 @@ int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, con
          * Writing a bad block marker: data will be NULL, spare not NULL
          */
          
-        if(sizeof(yaffs_spare) != 16)
+        if(sizeof(struct yaffs_spare) != 16)
                 YBUG();
         
         if(data && spare)
@@ -172,17 +170,17 @@ int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, con
                 /* Write a pre-marker */
                 memset(&tmpSpare,0xff,sizeof(tmpSpare));
                 tmpSpare.page_status = YNOR_PREMARKER;
-                ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
+                ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(struct yaffs_spare)/4);
 
                 /* Write the data */            
                 ynorif1_FlashWrite32(dataAddr,(u32 *)data,dev->param.total_bytes_per_chunk / 4);
                 
                 
-                memcpy(&tmpSpare,spare,sizeof(yaffs_spare));
+                memcpy(&tmpSpare,spare,sizeof(struct yaffs_spare));
                 
                 /* Write the real tags, but override the premarker*/
                 tmpSpare.page_status = YNOR_PREMARKER;
-                ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
+                ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(struct yaffs_spare)/4);
                 
                 /* Write a post-marker */
                 tmpSpare.page_status = YNOR_POSTMARKER;
@@ -193,7 +191,7 @@ int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, con
 
                 ynorif1_FlashRead32(spareAddr,(u32 *)&tmpSpare,16/ 4);
                 
-                ynorif1_AndBytes((u8 *)&tmpSpare,(u8 *)spare,sizeof(yaffs_spare));
+                ynorif1_AndBytes((u8 *)&tmpSpare,(u8 *)spare,sizeof(struct yaffs_spare));
                 
                 ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,16/ 4);
         }
@@ -206,7 +204,7 @@ int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, con
 
 }
 
-int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare)
+int ynorif1_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare)
 {
 
        u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
@@ -236,7 +234,7 @@ int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_s
 
 }
 
-static int ynorif1_FormatBlock(yaffs_dev_t *dev, int blockNumber)
+static int ynorif1_FormatBlock(struct yaffs_dev *dev, int blockNumber)
 {
        u32 *blockAddr = Block2Addr(dev,blockNumber);
        u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
@@ -248,7 +246,7 @@ static int ynorif1_FormatBlock(yaffs_dev_t *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-static int ynorif1_UnformatBlock(yaffs_dev_t *dev, int blockNumber)
+static int ynorif1_UnformatBlock(struct yaffs_dev *dev, int blockNumber)
 {
        u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
        u32 formatValue = 0;
@@ -258,7 +256,7 @@ static int ynorif1_UnformatBlock(yaffs_dev_t *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-static int ynorif1_IsBlockFormatted(yaffs_dev_t *dev, int blockNumber)
+static int ynorif1_IsBlockFormatted(struct yaffs_dev *dev, int blockNumber)
 {
        u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
        u32 formatValue;
@@ -269,12 +267,14 @@ static int ynorif1_IsBlockFormatted(yaffs_dev_t *dev, int blockNumber)
        return (formatValue == FORMAT_VALUE);
 }
 
-int ynorif1_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
+int ynorif1_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber)
 {
 
        if(blockNumber < 0 || blockNumber >= BLOCKS_IN_DEVICE)
        {
-               T(YAFFS_TRACE_ALWAYS,("Attempt to erase non-existant block %d\n",blockNumber));
+               yaffs_trace(YAFFS_TRACE_ALWAYS,
+                       "Attempt to erase non-existant block %d\n",
+                       blockNumber);
                return YAFFS_FAIL;
        }
        else
@@ -286,7 +286,7 @@ int ynorif1_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
        
 }
 
-int ynorif1_InitialiseNAND(yaffs_dev_t *dev)
+int ynorif1_InitialiseNAND(struct yaffs_dev *dev)
 {
        int i;
        
@@ -300,7 +300,7 @@ int ynorif1_InitialiseNAND(yaffs_dev_t *dev)
        return YAFFS_OK;
 }
 
-int ynorif1_Deinitialise_flash_fn(yaffs_dev_t *dev)
+int ynorif1_Deinitialise_flash_fn(struct yaffs_dev *dev)
 {
        dev=dev;        
        ynorif1_FlashDeinit();