1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #include "aos/hal/nand.h"
6 
7 /**
8  * Initialises a nand flash interface
9  *
10  * @param[in]  nand  the interface which should be initialised
11  *
12  * @return  0 : on success, EIO : if an error occurred with any step
13  */
hal_nand_init(nand_dev_t * nand)14 int32_t hal_nand_init(nand_dev_t *nand)
15 {
16 	return 0;
17 }
18 
19 /**
20  * Deinitialises a nand flash interface
21  *
22  * @param[in]  nand  the interface which should be initialised
23  *
24  * @return  0 : on success, EIO : if an error occurred with any step
25  */
hal_nand_finalize(nand_dev_t * nand)26 int32_t hal_nand_finalize(nand_dev_t *nand)
27 {
28 	return 0;
29 }
30 
31 /**
32  * Read nand page(s)
33  *
34  * @param[in]   nand        the interface which should be initialised
35  * @param[out]  data        pointer to the buffer which will store incoming data
36  * @param[in]   addr        nand address
37  * @param[in]   page_count  the number of pages to read
38  *
39  * @return  0 : on success, EIO : if an error occurred with any step
40  */
hal_nand_read_page(nand_dev_t * nand,nand_addr_t * addr,uint8_t * data,uint32_t page_count)41 int32_t hal_nand_read_page(nand_dev_t *nand, nand_addr_t *addr, uint8_t *data, uint32_t page_count)
42 {
43 	return 0;
44 }
45 
46 /**
47  * Write nand page(s)
48  *
49  * @param[in]   nand        the interface which should be initialised
50  * @param[in]   data        pointer to source buffer to write
51  * @param[in]   addr        nand address
52  * @param[in]   page_count  the number of pages to write
53  *
54  * @return  0 : on success, EIO : if an error occurred with any step
55  */
hal_nand_write_page(nand_dev_t * nand,nand_addr_t * addr,uint8_t * data,uint32_t page_count)56 int32_t hal_nand_write_page(nand_dev_t *nand, nand_addr_t *addr, uint8_t *data, uint32_t page_count)
57 {
58 	return 0;
59 }
60 
61 /**
62  * Read nand spare area
63  *
64  * @param[in]   nand      the interface which should be initialised
65  * @param[out]  data      pointer to the buffer which will store incoming data
66  * @param[in]   addr      nand address
67  * @param[in]   data_len  the number of spares to read
68  *
69  * @return  0 : on success, EIO : if an error occurred with any step
70  */
hal_nand_read_spare(nand_dev_t * nand,nand_addr_t * addr,uint8_t * data,uint32_t data_len)71 int32_t hal_nand_read_spare(nand_dev_t *nand, nand_addr_t *addr, uint8_t *data, uint32_t data_len)
72 {
73 	return 0;
74 }
75 
76 /**
77  * Write nand spare area
78  *
79  * @param[in]   nand      the interface which should be initialised
80  * @param[in]   data      pointer to source buffer to write
81  * @param[in]   addr      nand address
82  * @param[in]   data_len  the number of spares to write
83  *
84  * @return  0 : on success, EIO : if an error occurred with any step
85  */
hal_nand_write_spare(nand_dev_t * nand,nand_addr_t * addr,uint8_t * data,uint32_t data_len)86 int32_t hal_nand_write_spare(nand_dev_t *nand, nand_addr_t *addr, uint8_t *data, uint32_t data_len)
87 {
88 	return 0;
89 }
90 
91 /**
92  * Erase nand block
93  *
94  * @param[in]   nand      the interface which should be initialised
95  * @param[in]   addr      nand address
96  *
97  * @return  0 : on success, EIO : if an error occurred with any step
98  */
hal_nand_erase_block(nand_dev_t * nand,nand_addr_t * addr)99 int32_t hal_nand_erase_block(nand_dev_t *nand, nand_addr_t *addr)
100 {
101 	return 0;
102 }
103 
104