[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/lib/libamt/amtnv.h b/ap/lib/libamt/amtnv.h
new file mode 100755
index 0000000..7290a4d
--- /dev/null
+++ b/ap/lib/libamt/amtnv.h
@@ -0,0 +1,217 @@
+/**

+ * 

+ * @file      amtnv.h

+ * @brief     

+ *            This file is part of FTM.

+ *            AMTÄ£¿éNV²Ù×÷½Ó¿Ú

+ *            

+ * @details   

+ * @author    Tools Team.

+ * @email     

+ * @copyright Copyright (C) 2013 Sanechips Technology Co., Ltd.

+ * @warning   

+ * @date      2019/02/02

+ * @version   1.1

+ * @pre       

+ * @post      

+ *            

+ * @par       

+ * Change History :

+ * ---------------------------------------------------------------------------

+ * date        version  author         description

+ * ---------------------------------------------------------------------------

+ * 2018/04/28  1.0      liu.xin        Create file

+ * 2019/02/02  1.1      jiang.fenglin  ÐÞ¸Ä×¢ÊÍ·½Ê½Îªdoxygen

+ * ---------------------------------------------------------------------------

+ * 

+ * 

+ */

+

+#ifndef __AMTNV_H

+#define __AMTNV_H

+#include "os_type_def.h"

+#include "RONvParam_AMT.h"

+#include "RWNvConfig.h"

+

+

+/**

+ * @brief дnvro

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 2M-1 bytes

+ * @param dwLen nv³¤¶È,1 ~ 2M bytes

+ * @param from ´ýдÈëµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_nvro_write(unsigned int dwStart, unsigned int dwLen, unsigned char *from);

+

+/**

+ * @brief ¶Ánvro

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 2M-1 bytes

+ * @param dwLen nv³¤¶È,1 ~ 2M bytes

+ * @param to ¶Á³öµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_nvro_read(unsigned int dwStart, unsigned int dwLen, unsigned char *to);

+

+/**

+ * @brief дһÏîNVROÊý¾Ý

+ * @param nvParam ¸ÃNVÏîÀàÐÍ

+ * @param NvItemData ´ýдÈëÊý¾ÝµÄµØÖ·

+ * @param NvItemLen Êý¾Ý³¤¶È

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_write_nv_item(NvParam_AMT nvParam, UINT8 *NvItemData, UINT32 NvItemLen);

+

+/**

+ * @brief ¶Á³öÒ»ÏîNVROÊý¾Ý

+ * @param nvParam  ¸ÃNVÏîÀàÐÍ

+ * @param NvItemData ¶Á³öµÄÊý¾Ý

+ * @param NvItemLen  Êý¾Ý³¤¶È

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_read_nv_item(NvParam_AMT nvParam,UINT8 *NvItemData, UINT32 NvItemLen);

+

+/**

+ * @brief дÉú²ú²âÊÔ±ê־λ

+ * @param nvParam  Éú²ú²âÊÔ±ê־λÏîö¾ÙÖµ

+ * @param NvItemData ´ýдÈëÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_write_test_flag_item(NvParam_AMTFlags nvParam,UINT8 *NvItemData);

+

+/**

+ * @brief ¶ÁÉú²ú²âÊÔ±ê־λ

+ * @param nvParam  Éú²ú²âÊÔ±ê־λÏîö¾ÙÖµ

+ * @param NvItemData ¶Á³öµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_read_test_flag_item(NvParam_AMTFlags nvParam,UINT8 *NvItemData);

+

+/**

+ * @brief NVROÓû§×Ô¶¨ÒåÇøÓò¶Áº¯Êý

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023

+ * @param dwLen nv³¤¶È,1 ~ 1024 bytes

+ * @param from ´ýдÈëµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_nvro_user_write(UINT32 dwStart, UINT32 dwLen, UINT8* from);

+

+/**

+ * @brief NVROÓû§×Ô¶¨ÒåÇøÓòдº¯Êý

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023

+ * @param dwLen nv³¤¶È,1 ~ 1024 bytes

+ * @param from ¶Á³öµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int  amt_nvro_user_read(UINT32 dwStart, UINT32 dwLen, UINT8* to);

+

+/**

+ * @brief NVRO²Î¿¼Éè¼Æ×Ô¶¨ÒåÇøÓòдº¯Êý

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023

+ * @param dwLen nv³¤¶È,1 ~ 1024 bytes

+ * @param from ´ýдÈëµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int amt_nvro_ref_write(UINT32 dwStart, UINT32 dwLen, UINT8* from);

+

+/**

+ * @brief NVRO²Î¿¼Éè¼Æ×Ô¶¨ÒåÇøÓò¶Áº¯Êý

+ * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023

+ * @param dwLen nv³¤¶È,1 ~ 1024 bytes

+ * @param to ¶Á³öµÄÊý¾Ý

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+int amt_nvro_ref_read(UINT32 dwStart, UINT32 dwLen, UINT8* to);

+

+/**

+* @brief Ó¦ÓòãÅжϵ±Ç°ÊÇ·ñÊÇamtģʽ

+* @param 

+* @return 1 amtģʽ

+* @return 0 normalģʽ

+* @note   

+* @warning 

+*/

+int is_amt_mode(void);

+

+/**

+ * @brief ÉèÖÃbootÆô¶¯Ä£Ê½

+ * @param bootmode 2¸ö×ֽڵıêʶ: 

+ *              {0x54,0x00} : user,

+ *              {0x54,0x01} : debug,

+ *              {0x54,0x02} : factory,

+ *              {0x54,0x4D} : amt,

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_set_bootmode(unsigned char  bootmode[]);

+

+/**

+ * @brief ÉèÖÃµç³Ø¼ì²â±ê־λ

+ * @param batdet_value µç³Ø¼ì²â±êÖ¾

+ *             0 : ¿ª»ú²»¼ì²âµç³Ø,

+ *             1 : ¿ª»ú¼ì²âµç³Ø

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_set_batdet_flag(int batdet_value);

+

+/**

+ * @brief ¶Áµç³Ø¼ì²â±ê־λ

+ * @param pbatdet_value ¶Á³öµÄµç³Ø¼ì²â±êÖ¾

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_get_batdet_flag(int *pbatdet_value);

+

+/**

+ * @brief ÉèÖÃamtģʽϽâÎöATÃüÁî±êÖ¾

+ * @param bootmode 2¸ö×ֽڵıêʶ: 

+ *              {0x41,0x54} : amtģʽϽâÎöATÃüÁî

+ * @return 0 ³É¹¦  

+ * @return -1 ʧ°Ü

+ * @note   

+ * @warning 

+ */

+unsigned int amt_set_amt_atmode(unsigned char  bootmode[],unsigned char  atmode[]);

+unsigned int is_amt_atmode();

+

+

+

+

+

+#endif // __AMTNV_H