📄 c2312.h
字号:
0x3D8000, /* Start offset of block 130 */ 0x3E0000, /* Start offset of block 131 */ 0x3E8000, /* Start offset of block 132 */ 0x3F0000, /* Start offset of block 133 */ 0x3F8000, /* Start offset of block 134 */ 0x3F9000, /* Start offset of block 135 */ 0x3FA000, /* Start offset of block 136 */ 0x3FB000, /* Start offset of block 137 */ 0x3FC000, /* Start offset of block 138 */ 0x3FD000, /* Start offset of block 139 */ 0x3FE000, /* Start offset of block 140 */ 0x3FF000, /* Start offset of block 141 */ }; /* EndArray BlockOffset[] */#endif /* USE_M29DW640F_16 */#define NUM_BLOCKS (sizeof(BlockOffset)/sizeof(BlockOffset[0]))/******************************************************************************* Specific Function Prototypes********************************************************************************/static ReturnType FlashCheckBlockEraseError( uBlockType ublBlock );static ReturnType FlashDataToggle( udword udAddrOff );ReturnType FlashDoubleProgram( udword udAddrOff, uCPUBusType ucVal1, uCPUBusType ucVal2 );void FlashEnterExtendedBlock( void );void FlashExitExtendedBlock( void );ReturnType FlashMultipleBlockErase(uBlockType ublNumBlocks,uBlockType *ublpBlock,ReturnType * rpResult);static void FlashPause(udword udMicroSeconds);ReturnType FlashReadExtendedBlockVerifyCode( uCPUBusType *ucpVerifyCode );ReturnType FlashUnlockBypass( void );ReturnType FlashUnlockBypassProgram (udword udAddrOff, udword NumWords, void *pArray);void FlashUnlockBypassReset( void );ReturnType FlashOctProgram( udword udAddrOff, uCPUBusType *pArray );/******************************************************************************* List of Errors and Return values, Explanations and Help. ******************************************************************************** Error Name: Flash_AddressInvalid Description: The address offset given is out of the range of the flash device. Solution: Check the address offset whether it is in the valid range of the flash device. ******************************************************************************** Error Name: Flash_BankEraseFailed Description: The bank erase command did not finish successfully. Solution: Check that Vpp is not floating. Try erasing the block again. If this fails once more, the device may be faulty and needs to be replaced. ******************************************************************************** Error Name: Flash_BlockEraseFailed Description: The block erase command did not finish successfully. Solution: Check that Vpp is not floating. Try erasing the block again. If this fails once more, the device may be faulty and needs to be replaced. ******************************************************************************** Error Name: Flash_BlockNrInvalid Note: This is not a flash problem. Description: A selection for a block has been made (Parameter), which is not within the valid range. Valid block numbers are from 0 to NUM_BLOCKS-1. Solution: Check that the block number given is in the valid range. ******************************************************************************** Error Name: Flash_BlockProtected Description: The user has attempted to erase, program or protect a block of the flash that is protected. The operation failed because the block in question is protected. This message appears also after checking the protection status of a block. Solutions: Choose another (unprotected) block for erasing or programming. Alternatively change the block protection status of the current block (see Datasheet for more details). In case of the user is protecting a block that is already protected, this warning notifies the user that the command had no effect. ******************************************************************************** Error Name: Flash_BlockProtectFailed Description: This error return value indicates that a block protect command did not finish successfully. Solution: Check that Vpp is not floating but is tied to a valid voltage. Try the command again. If it fails a second time then the block cannot be protected and it may be necessary to replace the device. ******************************************************************************** Error Name: Flash_BlockProtectionUnclear Description: The user has attempted to erase, program or protect a block of the flash which did not return a proper protection status. The operation has been cancelled. Solutions: This should only happen in configurations with more than one flash device. If the response of each device does not match, this return code is given. Mostly it means the usage of not properly initialized flash devices. ******************************************************************************** Error Name: Flash_BlockUnprotected Description: This message appears after checking the block protection status. This block is ready to get erased, programmed or protected. ******************************************************************************** Error Name: Flash_BlockUnprotectFailed Description: This error return value indicates that a block unprotect command did not finish successfully. Solution: Check that Vpp is not floating but is tied to a valid voltage. Try the command again. If it fails a second time then the block cannot be unprotected and it may be necessary to replace the device. ******************************************************************************** Error Name: Flash_CfiFailed Description: This return value indicates that a Common Flash Interface (CFI) read access was unsuccessful. Solution: Try to read the Identifier Codes (Manufacture ID, Device ID) if these commands fail as well it is likely that the device is faulty or the interface to the flash is not correct. ******************************************************************************** Error Name: Flash_ChipEraseFailed Description: This message indicates that the erasure of the whole device has failed. Solution: Investigate this failure further by checking the results array (parameter), where all blocks and their erasure results are listed. What is more, try to erase each block individually. If erasing a single block still causes failure, then the Flash device may need to be replaced. ******************************************************************************** Error Name: Flash_ChipUnprotectFailed Description: This return value indicates that the chip unprotect command was unsuccessful. Solution: Check that Vpp is not floating but is tied to a valid voltage. Try the command again. If it fails a second time then it is likely that the device cannot be unprotected and will need to be replaced. ******************************************************************************** Return Name: Flash_FunctionNotSupported Description: The user has attempted to make use of functionality not available on this flash device (and thus not provided by the software drivers). Solution: This can happen after changing Flash SW Drivers in existing environments. For example an application tries to use functionality which is then no longer provided with a new device. ******************************************************************************** Error Name: Flash_GroupProtectFailed Description: This error return value indicates that a group protect command did not finish successfully. Solution: Check that Vpp is not floating but is tied to a valid voltage. Try the command again. If it fails a second time then the group cannot be protected and it may be necessary to replace the device.******************************************************************************** Return Name: Flash_NoInformationAvailableDescription: The system can't give any additional information about the error.Solution: None******************************************************************************** Error Name: Flash_NoOperationToSuspendDescription: This message is returned by a suspend operation if there isn't operation to suspend (i.e. the program/erase controller is inactive).******************************************************************************** Error Name: Flash_OperationOngoing Description: This message is one of two messages which are given by the TimeOut subroutine. That means the flash operation still operates within the defined time frame. ******************************************************************************** Error Name: Flash_OperationTimeOut Description: The Program/Erase Controller algorithm could not finish an operation successfully. It should have set bit 7 of the status register from 0 to 1, but that did not happen within a predefined time. The program execution has been, therefore, cancelled by a timeout. This may be because the device is damaged. Solution: Try the previous command again. If it fails a second time then it is likely that the device will need to be replaced. ******************************************************************************** Error Name: Flash_ProgramFailed Description: The value that should be programmed has not been written correctly to the flash. Solutions: Make sure that the block which is supposed to receive the value was erased successuly before programming. Try erasing the block and programming the value again. If it fails again then the device may be faulty. ******************************************************************************** Error Name: Flash_ResponseUnclear Description: This message appears in multiple flash configurations, if the single flash responses are different and, therefore, a sensible reaction of the SW driver is not possible. Solutions: Check all the devices currently used and make sure they are all working properly. Use only equal devices in multiple configurations. If it fails again then the devices may be faulty and need to be replaced. ******************************************************************************** Error Name: Flash_SpecificErrorDescription: The function makes an error depending on the device. More information about the error are available into the ErrorInfo variable.Solutions: See SpecificReturnType remarks******************************************************************************** Return Name: Flash_Success Description: This value indicates that the flash command has executed correctly. ******************************************************************************** Error Name: Flash_VppInvalid Description: A Program or a Block Erase has been attempted with the Vpp supply voltage outside the allowed ranges. This command had no effect since an invalid Vpp has the effect of protecting the whole of flash device. Solution: The (hardware) configuration of Vpp will need to be modified to enable programming or erasing of the device. *******************************************************************************Error Name: Flash_WrongType Description: This message appears if the Manufacture and Device ID read from the current flash device do not match with the expected identifier codes. That means the source code is not explicitely written for the currently used flash chip. It may work, but it cannot be guaranteed. Solutions: Use a different flash chip with the target hardware or contact STMicroelectronics for a different source code library. ********************************************************************************//*******************************************************************************List of Specific Errors, Explanations and Help. ******************************************************************************** Error Name: FlashSpec_MpuTooSlowNotes: Applies to M29 series Flash only.Description: The MPU has not managed to write all of the selected blocks to the device before the timeout period expired. See BLOCK ERASE COMMAND section of the Data Sheet for details.Solutions: If this occurs occasionally then it may be because an interrupt is occuring between writing the blocks to be erased. Search for "DSI!" in the code and disable interrupts during the time critical sections. If this error condition always occurs then it may be time for a faster microprocessor, a better optimising C compiler or, worse still, learn assembly. The immediate solution is to only erase one block at a time.********************************************************************************Error Name: FlashSpec_ToggleFailedNotes: This applies to M29 series Flash only.Description: The Program/Erase Controller algorithm has not managed to complete the command operation successfully. This may be because the device is damaged.Solution: Try the command again. If it fails a second time then it is likely that the device will need to be replaced.******************************************************************************Error Name: FlashSpec_Too_ManyBlocksNotes: Applies to M29 series Flash only.Description: The user has chosen to erase more blocks than the device has. This may be because the array of blocks to erase contains the same block more than once.Solutions: Check that the program is trying to erase valid blocks. The device will only have NUM_BLOCKS blocks (defined at the top of the file). Also check that the same block has not been added twice or more to the array.*******************************************************************************/#endif /* In order to avoid a repeated usage of the header file *//******************************************************************************* End of c2312.h********************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -