diff --git a/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c b/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c index bbd69d8e..eac0919d 100644 --- a/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c +++ b/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c @@ -124,6 +124,14 @@ void XNandPs8_InitBbtDesc(XNandPs8 *InstancePtr) InstancePtr->BbtDesc.Valid = 0U; InstancePtr->BbtDesc.Option = XNANDPS8_BBT_OOB; + /* + * Assuming that the flash device will have at least 4 blocks. + */ + if (InstancePtr->Geometry.NumTargetBlocks <= InstancePtr-> + BbtDesc.MaxBlocks){ + InstancePtr->BbtDesc.MaxBlocks = 4U; + } + /* * Initialize mirror Bad Block Table(BBT) */ @@ -151,6 +159,14 @@ void XNandPs8_InitBbtDesc(XNandPs8 *InstancePtr) InstancePtr->BbtMirrorDesc.Valid = 0U; InstancePtr->BbtMirrorDesc.Option = XNANDPS8_BBT_OOB; + /* + * Assuming that the flash device will have at least 4 blocks. + */ + if (InstancePtr->Geometry.NumTargetBlocks <= InstancePtr-> + BbtMirrorDesc.MaxBlocks){ + InstancePtr->BbtMirrorDesc.MaxBlocks = 4U; + } + /* * Initialize Bad block search pattern structure */