blob: 7290a4d996b7514a86fd3fbee1de3fecd06e4738 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/**
2 *
3 * @file amtnv.h
4 * @brief
5 * This file is part of FTM.
6 * AMTÄ£¿éNV²Ù×÷½Ó¿Ú
7 *
8 * @details
9 * @author Tools Team.
10 * @email
11 * @copyright Copyright (C) 2013 Sanechips Technology Co., Ltd.
12 * @warning
13 * @date 2019/02/02
14 * @version 1.1
15 * @pre
16 * @post
17 *
18 * @par
19 * Change History :
20 * ---------------------------------------------------------------------------
21 * date version author description
22 * ---------------------------------------------------------------------------
23 * 2018/04/28 1.0 liu.xin Create file
24 * 2019/02/02 1.1 jiang.fenglin ÐÞ¸Ä×¢ÊÍ·½Ê½Îªdoxygen
25 * ---------------------------------------------------------------------------
26 *
27 *
28 */
29
30#ifndef __AMTNV_H
31#define __AMTNV_H
32#include "os_type_def.h"
33#include "RONvParam_AMT.h"
34#include "RWNvConfig.h"
35
36
37/**
38 * @brief дnvro
39 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 2M-1 bytes
40 * @param dwLen nv³¤¶È,1 ~ 2M bytes
41 * @param from ´ýдÈëµÄÊý¾Ý
42 * @return 0 ³É¹¦
43 * @return -1 ʧ°Ü
44 * @note
45 * @warning
46 */
47unsigned int amt_nvro_write(unsigned int dwStart, unsigned int dwLen, unsigned char *from);
48
49/**
50 * @brief ¶Ánvro
51 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 2M-1 bytes
52 * @param dwLen nv³¤¶È,1 ~ 2M bytes
53 * @param to ¶Á³öµÄÊý¾Ý
54 * @return 0 ³É¹¦
55 * @return -1 ʧ°Ü
56 * @note
57 * @warning
58 */
59unsigned int amt_nvro_read(unsigned int dwStart, unsigned int dwLen, unsigned char *to);
60
61/**
62 * @brief дһÏîNVROÊý¾Ý
63 * @param nvParam ¸ÃNVÏîÀàÐÍ
64 * @param NvItemData ´ýдÈëÊý¾ÝµÄµØÖ·
65 * @param NvItemLen Êý¾Ý³¤¶È
66 * @return 0 ³É¹¦
67 * @return -1 ʧ°Ü
68 * @note
69 * @warning
70 */
71int amt_write_nv_item(NvParam_AMT nvParam, UINT8 *NvItemData, UINT32 NvItemLen);
72
73/**
74 * @brief ¶Á³öÒ»ÏîNVROÊý¾Ý
75 * @param nvParam ¸ÃNVÏîÀàÐÍ
76 * @param NvItemData ¶Á³öµÄÊý¾Ý
77 * @param NvItemLen Êý¾Ý³¤¶È
78 * @return 0 ³É¹¦
79 * @return -1 ʧ°Ü
80 * @note
81 * @warning
82 */
83int amt_read_nv_item(NvParam_AMT nvParam,UINT8 *NvItemData, UINT32 NvItemLen);
84
85/**
86 * @brief дÉú²ú²âÊÔ±ê־λ
87 * @param nvParam Éú²ú²âÊÔ±ê־λÏîö¾ÙÖµ
88 * @param NvItemData ´ýдÈëÊý¾Ý
89 * @return 0 ³É¹¦
90 * @return -1 ʧ°Ü
91 * @note
92 * @warning
93 */
94int amt_write_test_flag_item(NvParam_AMTFlags nvParam,UINT8 *NvItemData);
95
96/**
97 * @brief ¶ÁÉú²ú²âÊÔ±ê־λ
98 * @param nvParam Éú²ú²âÊÔ±ê־λÏîö¾ÙÖµ
99 * @param NvItemData ¶Á³öµÄÊý¾Ý
100 * @return 0 ³É¹¦
101 * @return -1 ʧ°Ü
102 * @note
103 * @warning
104 */
105int amt_read_test_flag_item(NvParam_AMTFlags nvParam,UINT8 *NvItemData);
106
107/**
108 * @brief NVROÓû§×Ô¶¨ÒåÇøÓò¶Áº¯Êý
109 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023
110 * @param dwLen nv³¤¶È,1 ~ 1024 bytes
111 * @param from ´ýдÈëµÄÊý¾Ý
112 * @return 0 ³É¹¦
113 * @return -1 ʧ°Ü
114 * @note
115 * @warning
116 */
117int amt_nvro_user_write(UINT32 dwStart, UINT32 dwLen, UINT8* from);
118
119/**
120 * @brief NVROÓû§×Ô¶¨ÒåÇøÓòдº¯Êý
121 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023
122 * @param dwLen nv³¤¶È,1 ~ 1024 bytes
123 * @param from ¶Á³öµÄÊý¾Ý
124 * @return 0 ³É¹¦
125 * @return -1 ʧ°Ü
126 * @note
127 * @warning
128 */
129int amt_nvro_user_read(UINT32 dwStart, UINT32 dwLen, UINT8* to);
130
131/**
132 * @brief NVRO²Î¿¼Éè¼Æ×Ô¶¨ÒåÇøÓòдº¯Êý
133 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023
134 * @param dwLen nv³¤¶È,1 ~ 1024 bytes
135 * @param from ´ýдÈëµÄÊý¾Ý
136 * @return 0 ³É¹¦
137 * @return -1 ʧ°Ü
138 * @note
139 * @warning
140 */
141int amt_nvro_ref_write(UINT32 dwStart, UINT32 dwLen, UINT8* from);
142
143/**
144 * @brief NVRO²Î¿¼Éè¼Æ×Ô¶¨ÒåÇøÓò¶Áº¯Êý
145 * @param dwStart nvÆðʼµØÖ·Æ«ÒÆ,0 ~ 1023
146 * @param dwLen nv³¤¶È,1 ~ 1024 bytes
147 * @param to ¶Á³öµÄÊý¾Ý
148 * @return 0 ³É¹¦
149 * @return -1 ʧ°Ü
150 * @note
151 * @warning
152 */
153int amt_nvro_ref_read(UINT32 dwStart, UINT32 dwLen, UINT8* to);
154
155/**
156* @brief Ó¦ÓòãÅжϵ±Ç°ÊÇ·ñÊÇamtģʽ
157* @param
158* @return 1 amtģʽ
159* @return 0 normalģʽ
160* @note
161* @warning
162*/
163int is_amt_mode(void);
164
165/**
166 * @brief ÉèÖÃbootÆô¶¯Ä£Ê½
167 * @param bootmode 2¸ö×ֽڵıêʶ:
168 * {0x54,0x00} : user,
169 * {0x54,0x01} : debug,
170 * {0x54,0x02} : factory,
171 * {0x54,0x4D} : amt,
172 * @return 0 ³É¹¦
173 * @return -1 ʧ°Ü
174 * @note
175 * @warning
176 */
177unsigned int amt_set_bootmode(unsigned char bootmode[]);
178
179/**
180 * @brief ÉèÖÃµç³Ø¼ì²â±ê־λ
181 * @param batdet_value µç³Ø¼ì²â±êÖ¾
182 * 0 : ¿ª»ú²»¼ì²âµç³Ø,
183 * 1 : ¿ª»ú¼ì²âµç³Ø
184 * @return 0 ³É¹¦
185 * @return -1 ʧ°Ü
186 * @note
187 * @warning
188 */
189unsigned int amt_set_batdet_flag(int batdet_value);
190
191/**
192 * @brief ¶Áµç³Ø¼ì²â±ê־λ
193 * @param pbatdet_value ¶Á³öµÄµç³Ø¼ì²â±êÖ¾
194 * @return 0 ³É¹¦
195 * @return -1 ʧ°Ü
196 * @note
197 * @warning
198 */
199unsigned int amt_get_batdet_flag(int *pbatdet_value);
200
201/**
202 * @brief ÉèÖÃamtģʽϽâÎöATÃüÁî±êÖ¾
203 * @param bootmode 2¸ö×ֽڵıêʶ:
204 * {0x41,0x54} : amtģʽϽâÎöATÃüÁî
205 * @return 0 ³É¹¦
206 * @return -1 ʧ°Ü
207 * @note
208 * @warning
209 */
210unsigned int amt_set_amt_atmode(unsigned char bootmode[],unsigned char atmode[]);
211unsigned int is_amt_atmode();
212
213
214
215
216
217#endif // __AMTNV_H