yaffs_nandif.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
  3. *
  4. * Copyright (C) 2002-2011 Aleph One Ltd.
  5. * for Toby Churchill Ltd and Brightstar Engineering
  6. *
  7. * Created by Charles Manning <charles@aleph1.co.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License version 2.1 as
  11. * published by the Free Software Foundation.
  12. *
  13. * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  14. */
  15. #ifndef __YNANDIF_H__
  16. #define __YNANDIF_H__
  17. #include "yaffs_guts.h"
  18. struct ynandif_Geometry {
  19. unsigned start_block;
  20. unsigned end_block;
  21. unsigned dataSize;
  22. unsigned spareSize;
  23. unsigned pagesPerBlock;
  24. unsigned hasECC;
  25. unsigned inband_tags;
  26. unsigned useYaffs2;
  27. int (*initialise)(struct yaffs_dev *dev);
  28. int (*deinitialise)(struct yaffs_dev *dev);
  29. int (*readChunk) (struct yaffs_dev *dev,
  30. unsigned pageId,
  31. unsigned char *data,
  32. unsigned dataLength,
  33. unsigned char *spare,
  34. unsigned spareLength,
  35. int *eccStatus);
  36. /* ECC status is set to 0 for OK, 1 for fixed, -1 for unfixed. */
  37. int (*writeChunk)(struct yaffs_dev *dev,
  38. unsigned pageId,
  39. const unsigned char *data,
  40. unsigned dataLength,
  41. const unsigned char *spare,
  42. unsigned spareLength);
  43. int (*eraseBlock)(struct yaffs_dev *dev, unsigned blockId);
  44. int (*checkBlockOk)(struct yaffs_dev *dev, unsigned blockId);
  45. int (*markBlockBad)(struct yaffs_dev *dev, unsigned blockId);
  46. void *privateData;
  47. };
  48. struct yaffs_dev *
  49. yaffs_add_dev_from_geometry(const YCHAR *name,
  50. const struct ynandif_Geometry *geometry);
  51. #endif