Adding new NAND devices. Why aren't NAND_SPI_INST and FS_NAND_SPI_DEVICE_TYPE in FS.h?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Adding new NAND devices. Why aren't NAND_SPI_INST and FS_NAND_SPI_DEVICE_TYPE in FS.h?

      We are using an Alliance AS5F34G04SND-08LIN NAND flash chip on a custom board with a STM32F469 MCU. I have emFile working correctly with it so all is good there. Because the Alliance AS5F34G04SND-08LIN does not support ONFI emFile is not able to detect the NAND specs on the chip. So I was forced to define my device config structures within FS_NAND_PHY_SPI.c. That works, but now my code is within the emFile source, rather than defined in my project files. I looked at what it would take to define everything outside the emFile code base. The problem is that the structures NAND_SPI_INST and FS_NAND_SPI_DEVICE_TYPE needed to define a new device config are defined privately within FS_NAND_PHY_SPI.c. There is a comment within FS_NAND_SPI_DEVICE_TYPE stating that it can't be defined in FS.h because NAND_SPI_INST isn't visible:

      Source Code

      1. struct FS_NAND_SPI_DEVICE_TYPE {
      2. //
      3. //lint -esym(9058, FS_NAND_SPI_DEVICE_TYPE)
      4. // We cannot define this structure in FS.h because all the functions take a pointer
      5. // to the instance of the physical layer that is a structure which is only visible in this module.
      6. //
      7. int (*pfIdentify) ( NAND_SPI_INST * pInst, const U8 * pId);
      8. int (*pfReadApplyPara) ( NAND_SPI_INST * pInst, const U8 * pId);
      9. int (*pfReadDataFromCache)(const NAND_SPI_INST * pInst, U32 PageIndex, void * pData, unsigned Off, unsigned NumBytes);
      10. int (*pfWriteDataToCache) (const NAND_SPI_INST * pInst, U32 PageIndex, const void * pData, unsigned Off, unsigned NumBytes);
      11. int (*pfGetECCResult) (const NAND_SPI_INST * pInst, FS_NAND_ECC_RESULT * pResult);
      12. int (*pfSelectDie) ( NAND_SPI_INST * pInst, unsigned DieIndex);
      13. int (*pfIsReadError) (U8 Status);
      14. };
      Display All
      Well, I was able to simply move both NAND_SPI_INST and FS_NAND_SPI_DEVICE_TYPE in FS.h without issue. Doing so allows me to use those structures to define my own NAND device easily in its own module outside of the emFile source code. Can I request that you make the same change in the emFile source?

      Could I also request that you make all the functions listed in _DeviceDefault publicly accessible in FS.h so that any new devices defined elsewhere can use them?:

      Source Code

      1. static const FS_NAND_SPI_DEVICE_TYPE _DeviceDefault = {
      2. NULL,
      3. _ReadApplyPara,
      4. _ReadDataFromCache,
      5. _WriteDataToCache,
      6. _GetECCResult,
      7. NULL,
      8. _IsReadError
      9. };


      Thanks,
      Craig