1 /*
2  * Copyright (C) 2018-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef HAL_FLASH_H_
6 #define HAL_FLASH_H_
7 
8 /**
9  * Write data to OTP area on a chip from data buffer in RAM
10  *
11  * @param[in]  in_buf       Point to the data buffer that stores the data read from flash
12  * @param[in]  in_buf_len  The length of the buffer
13  *
14  * @return  0 : On success, EIO : If an error occurred with any step
15  */
16 int32_t hal_flash_write_triples(const void *in_buf, uint32_t in_buf_len);
17 
18 /**
19  * Read data from OTP area on a chip to data buffer in RAM
20  *
21  * @param[in]  out_buf       Point to the data buffer that stores the data read from flash
22  * @param[in]  out_buf_len  The length of the buffer
23  *
24  * @return  0 : On success, EIO : If an error occurred with any step
25  */
26 int32_t hal_flash_read_triples(void *out_buf, uint32_t out_buf_len);
27 
28 /**
29  * Write data to OTP area on a chip from data buffer in RAM
30  *
31  * @param[in]  in_buf       Point to the data buffer that stores the data read from flash
32  * @param[in]  in_buf_len  The length of the buffer
33  *
34  * @return  0 : On success, EIO : If an error occurred with any step
35  */
36 int32_t hal_flash_write_group_addr(const void *in_buf, uint32_t in_buf_len);
37 
38 /**
39  * Read data from OTP area on a chip to data buffer in RAM
40  *
41  * @param[in]  out_buf       Point to the data buffer that stores the data read from flash
42  * @param[in]  out_buf_len  The length of the buffer
43  *
44  * @return  0 : On success, EIO : If an error occurred with any step
45  */
46 int32_t hal_flash_read_group_addr(void *out_buf, uint32_t out_buf_len);
47 
48 int32_t hal_flash_write_xtalcap_params(const void *in_buf, uint32_t in_buf_len);
49 
50 int32_t hal_flash_read_xtalcap_params(void *out_buf, uint32_t out_buf_len);
51 
52 int32_t hal_flash_read_mac_params(void *out_buf, uint32_t out_buf_len);
53 
54 int32_t hal_flash_write_mac_params(const void *in_buf, uint32_t in_buf_len);
55 
56 /**
57  * Write data to OTP area on a chip from data buffer in RAM
58  *
59  * @param[in]  in_buf       Point to the data buffer that stores the data read from flash
60  * @param[in]  in_buf_len  The length of the buffer
61  *
62  * @return  0 : On success, EIO : If an error occurred with any step
63  */
64 int32_t hal_flash_write_sn_params(const void *in_buf, uint32_t in_buf_len);
65 
66 /**
67  * Read data from OTP area on a chip to data buffer in RAM
68  *
69  * @param[in]  out_buf       Point to the data buffer that stores the data read from flash
70  * @param[in]  out_buf_len  The length of the buffer
71  *
72  * @return  0 : On success, EIO : If an error occurred with any step
73  */
74 int32_t hal_flash_read_sn_params(void *out_buf, uint32_t out_buf_len);
75 
76 
77 #endif /* HAL_FLASH_H_ */
78 
79