Document number 205065Version Rev. NIssue date 2019-02-04Sirius OBC and TCM User Manualwww.aacmicrotec.com Page 104 of 174Return value Description0 Operation successful.-1 See errno values.errno valuesEINVAL Page number is out of rangeorBuffer is NULLEIO Program failed on chip level, block should beconsidered bad.5.12.3.6.8. Factory bad block checkReads the factory bad block marker from a block and reports status.NOTE: This only gives information about factory marked bad blocks. Bad blocks that ariseduring use need to be handled by the application software.Return value DescriptionAAC_SYSFLASH_FACTORY_BAD_BLOCK_CLEAREDBlock is OK.AAC_SYSFLASH_FACTORY_BAD_BLOCK_MARKEDBlock is marked bad.errno valuesEINVAL The block number is out of range5.12.4. Usage description5.12.4.1. OverviewIn NAND flash the memory area is divided into pages that have a data area and a sparearea. The pages are grouped into blocks. Before data can be programmed to a page it mustbe erased (all bytes are 0xFF). The smallest area to erase is a block consisting of a numberof pages, so if the block contains any data that needs to be preserved this must first be readout. The driver defines some constants for the application software to use when handlingblocks and pages. There are SYSFLASH_BLOCKS blocks starting from block number 0 andSYSFLASH_PAGES_PER_BLOCK pages within each block starting from page 0. Eachpage data area is SYSFLASH_PAGE_SIZE bytes. Each page also has a spare area that isSYSFLASH_PAGE_SPARE_AREA_SIZE bytes. Partial pages can be read/programmed,but reading/programming always starts at the beginning of the page (or spare area). Pages(including spare area) must be programmed in sequence within a block.Command Value type Direction DescriptionSYSFLASH_IO_BAD_BLOCK_CHECK uint32_t in Block number.