📄 m512_exp.h
字号:
(M512_Read8BitReg(volume,M512_DPS1_STATUS_REG) & M512_KEY_OK)
/***********************************************************************
* Name : M512_IsDPS0_OTP_Protected
* Checks if DPS_0 is OTP protected
*
* Returns:
* 0 - DPS is not OTP protected
* None 0 - DPS is OTP protected
***********************************************************************/
#define M512_IsDPS0_OTP_Protected(volume) \
(M512_Read8BitReg(volume,M512_DPS0_STATUS_REG) & M512_OTP_PROTECTED)
/***********************************************************************
* Name : M512_IsDPS1_OTP_Protected
* Checks if DPS_0 is OTP protected
*
* Returns:
* 0 - DPS is not OTP protected
* None 0 - DPS is OTP protected
***********************************************************************/
#define M512_IsDPS1_OTP_Protected(volume) \
(M512_Read8BitReg(volume,M512_DPS1_STATUS_REG) & M512_OTP_PROTECTED)
/************************************************************************
********************** Exported functions ***************************
************************************************************************/
/***********************************************************************
* Name: M512_Read16BitReg
* Read 16 bit register
*
* Parameters:
* flashPtr : Pointer identifying drive
* wOffset : The Offset of register from base address
* Returns: Value of the 16 bit register
***********************************************************************/
FLWord M512_Read16BitReg(FLFlash *flashPtr,FLWord wOffset) ;
/***********************************************************************
* Name : M512_isGoodBlock
* Determines if a block is a good block or a bad block
*
* Parameters:
* volume : Pointer identifying drive
* wUnit : The Block that we wants to check
* bOpFlags : USE_BBT_CACHE - Checks if the page is already in the
* MTD_VARS->buffer->flData (because it was read on the last call)
* and if it does => Read the buffer witout accessing the flash
* ALWAYS_READ_FROM_FLASH - When you are not sure that the
* MTD_VARS->buffer->flData holds the bbt information
* use this option which forces the routine to read the bbt page
* Note : When u want to use the isGoodBlock in a routine
* It is the safest to call the first time with ALWAYS_READ_FROM_FLASH
* and in the next calls to use USE_BBT_CACHE
* Returns:
* fIsGoodBlock :
* TRUE => Block is a good block.
* FALSE => Block is a bad block.
* flOK on success, any other value on failure.
************************************************************************/
FLStatus M512_isGoodBlock (FLFlash *volume,FLDword dwUnit,FLByte bOpFlags,FLBoolean *fIsGoodBlock) ;
/************************************************************************
* Name: M512_asicSetMode *
* *
* Set the controller (ASIC) operation mode. *
* *
* Parameters: *
* volume : Pointer identifying drive *
* mode : One of the modes below: *
* RESET_MODE = 0 *
* NORMAL_MODE = 1 *
* POWER_DOWN_MODE = 2 *
* *
* Note: The mode is common to all cascaded floors. *
************************************************************************/
void M512_asicSetMode (FLFlash *volume, FL_AsicModeE AsicMode) ;
/***********************************************************************
* Name: M512_AsicSetFloor
*
* Write to DeviceSelector register to set the desired floor .
*
* Parameters:
* flashPtr : Pointer identifying drive
* bFloor : The selected Floor (0,1,2,3)
***********************************************************************/
void M512_AsicSetFloor (FLFlash *flashPtr, FLByte bFloor) ;
/***********************************************************************
* Name : M512_erase_Seq
* Executes the Erase sequence that can erase 1..N units in parallel
*
* Parameters:
* volume : Pointer identifying drive
* wPhyUnitNo : An array that holds the units that should
* be erased,each unit should be in a different plane
* (Number of planes is 1..4 so this array is mamximum 4)
* bNoOfPhyUnits : Number of units that should be erased (1..4)
* Flags : MTD_DO_NOT_WAIT - Do not poll waiting for R/B# to be Ready
* bFloor : The desired floor
* Returns:
* ErrorStatus:
*
***********************************************************************/
FLStatus M512_erase_Seq (FLFlash *volume,PhyUnitType *UnitNo,FLByte NoOfPhyUnits,
FLDword Flags,FLByte bFloor);
/***********************************************************************
* Name : M512_read_Seq
* Executes the FLASH Read sequence command for reading one sector
*
* Parameters:
* volume : Pointer identifying drive
* readArgs inputs :
* PhyUnit : An pointer to the physical unit that the sector needed to be read is in
* phyPage : The page that would be read
* MainBuffer : The Pointer to user buffer containing the data
* that should be written to the sector main area.
* ExtraBuffer : Pointer to user buffer containing the data
* that should be written to the sector info area.
* dwOpFlags : MTD_DATA - Read from the main area of the physical sector
* MTD_EXTRA - Read from the extra area of the physical sector
* MTD_RAW_MODE - Read with fixed offset and with no EDC/ECC correction
* readArgs_OUTPUTS:
* MaxBitErrors : The Maximum of bit errors found (0..5)
* FreeSectorsFound : Number of free sectors found (0 or 1)
* NoOfSectorsPassed : Number of Sectors read successfully (0 or 1)
* ErrorStatus:
* NOTE : It assumkes that page size is 512 => PAGE_SIZE=FL_SECTOR_SIZE
***********************************************************************/
FLStatus M512_read_Seq (FLFlash *volume,M512_OperationArgsStructPtr READ_ARGS);
/***********************************************************************
* Name : M512_pageProgram_Seq
* Executes the Page program sequence command
* This routine can write in parallel to 1..N pages (N = Number of planes)
*
* Parameters:
* volume : Pointer identifying drive
* PhyUnits : An array that holds the number of the 1..N
* physical units that needs to be written in parallel
* phyPage : The page that would be programmed in all units in parallel
* noOfPhySectors : Number of physical sectors that needs to be programmeed
* (This is the size of the PhySectors array)
* MainBuffer : The Pointer to user buffer containing the data
* that should be written to the sector main area.
* ExtraBuffer : Pointer to user buffer containing the data
* that should be written to the sector info area.
* VerifyWriteMode : An indicator of the read after write mode.
* FL_ON will force a read after write operation
* while FL_OFF will disable it !!!.
* dwOpFlags : MTD_DATA - Write to the main area of the physical sector
* MTD_EXTRA - Write to the extra area of the physical sector
* MTD_DO_NOT_WAIT - Return without waiting for the R/B# to be ready
* in the last parallel PageProgram command
*
*
* Returns:
* ErrorStatus:
*
***********************************************************************/
FLStatus M512_pageProgram_Seq (FLFlash *volume,M512_OperationArgsStructPtr WRITE_ARGS);
/***********************************************************************
* Name : M512_phyWriteEraseMark
* Writes the erase mark to the physical unit
*
* Parameters:
* Inputs:
* volume : The flash struct
* phyUnit : The physical unit to check erase mark
* dwEraseMark : The erase Mark that would be written
* Outputs:
* EraseCount : The Erase count of the physical erase unit
*
***********************************************************************/
FLStatus M512_phyWriteEraseMark (FLFlash *volume,PhyUnitType phyUnit,FLByte bEraseMark) ;
/***********************************************************************
* Name : M512_phyGetEraseCount
* Gets the Number of times a logical erase unit has been erased
*
* Parameters:
* Inputs:
* volume : The flash struct
* StartUnit : The physical unit to check erase count
* bFloor : The floor
* Outputs:
* EraseCount: The Erase count of the physical erase unit
*
***********************************************************************/
FLStatus M512_phyGetEraseCount (FLFlash *flashPtr,PhyUnitType *PhyUnitArray,FLDword *dwEraseCount,FLByte bFloor) ;
/***********************************************************************
* Name : M512_phyGetEraseMark
* Reads the erase mark from the physical unit
*
* Parameters:
* Inputs:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -