FU68xx_5_Flash.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* --------------------------- (C) COPYRIGHT 2021 Fortiortech ShenZhen -----------------------------
  2. File Name : FLASH.h
  3. Author : Fortiortech Appliction Team
  4. Version : V1.0
  5. Date : 2021-07-24
  6. Description : This file contains flash变量和函数的定义 parameter used for Motor Control.
  7. ----------------------------------------------------------------------------------------------------
  8. All Rights Reserved
  9. ------------------------------------------------------------------------------------------------- */
  10. /* Define to prevent recursive inclusion -------------------------------------------------------- */
  11. ///******************************************************************************///Including Header Files
  12. #include <FU68xx_5.h>
  13. //#ifndef __FLASH_H__
  14. //#define __FLASH_H__
  15. //#define USERCODEADDRESS 0X3F00
  16. ////typedef struct
  17. ////{
  18. //// uint8 FlashRead;
  19. //// uint8 FlashWrite;
  20. //// uint16 FlashRead2Byte;
  21. //// uint16 FlashWrite2Byte;
  22. ////
  23. ////} MCUFlash;
  24. //extern MCUFlash xdata FlashTest; //flash数据测试
  25. //extern uint16 Get2ByteFromFlash(uint8 xdata *BlockStartAddr); //2字节的flash读取函数
  26. //extern uint8 Write2Byte2Flash(uint8 xdata *BlockStartAddr,uint16 NewData2Flash); //2字节的flash写入函数
  27. //extern void WriteOrReadFlashTest(uint8 xdata *BlockStartAddr,uint16 NewData2Flash); //读写函数定义
  28. //extern void Flash_Sector_Erase(uint8 xdata *FlashAddress); //自擦除函数定义
  29. //extern void Flash_Sector_Write(uint8 xdata *FlashAddress, uint8 FlashData); //自写入函数定义
  30. //#endif
  31. /************************ (C) COPYRIGHT 2015 FT *******************************
  32. * File Name :
  33. * Author : Application Team Tom.wang
  34. * Version : V2.0.0
  35. * Date : 06/15/2015
  36. * Description :
  37. ********************************************************************************
  38. /*******************************************************************************
  39. * All Rights Reserved
  40. *******************************************************************************/
  41. /* Define to prevent recursive inclusion -------------------------------------*/
  42. #ifndef __FLASH_H
  43. #define __FLASH_H
  44. #define __I volatile const /*!< defines 'read only' permissions */
  45. #define __O volatile /*!< defines 'write only' permissions */
  46. #define __IO volatile /*!< defines 'read / write' permissions */
  47. #define START_WriteADDRESS 0x6800 //写入首地址
  48. #define Write_Lenght 4 //写入字节长度
  49. #define Verify_Bit Write_Lenght -1 //Data数值最后位为校验位
  50. #define Verify_Ture 0xFF //校验正确数值
  51. #define Verify_Error 0x55 //校验错误数值
  52. typedef struct
  53. {
  54. uint16 WriteAddress; // 写入地址
  55. uint8 WriteValue[8]; // Flash 写入数组
  56. uint16 ReadAddress; // 读取地址
  57. uint8 ReadValue[8]; // ROM 读出值
  58. uint8 FlagFlashWrite; // 写标志位
  59. uint8 Flag_FlashErase; // Flash擦除标志位
  60. }ROM_TypeDef;
  61. extern ROM_TypeDef xdata FlashData;
  62. extern uint8 ReadFlashValue(uint16 ReadAddress);
  63. extern uint8 Flash_WriteValue(uint16 WriteAddress ,uint8 Length,uint8 * str);
  64. extern uint16 GetWrite_Black_Addr(unsigned short FlashAddress, uint8 Write_Length);
  65. extern void ReadFromFlash(unsigned short BlockStartAddr, uint8 Length, uint8 * str);
  66. extern void Flash_Erase(void);
  67. extern void Save_KeyValue(void);
  68. #endif