1 /**
2 *****************************************************************************************
3 *     Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved.
4 *****************************************************************************************
5    * @file      ftl_rom.h
6    * @brief     ftl header file for rom project
7    * @details
8    * @author
9    * @date
10    * @version
11    **************************************************************************************
12    * @attention
13    * <h2><center>&copy; COPYRIGHT 2017 Realtek Semiconductor Corporation</center></h2>
14    * *************************************************************************************
15   */
16 
17 /*============================================================================*
18   *                   Define to prevent recursive inclusion
19   *============================================================================*/
20 
21 #ifndef _FTL_ROM_H_
22 #define _FTL_ROM_H_
23 
24 /*============================================================================*
25   *                               Header Files
26   *============================================================================*/
27 #include "ftl.h"
28 
29 
30 #ifdef  __cplusplus
31 extern  "C" {
32 #endif
33 
34 #define FTL_SUCCESS       (0x00)
35 #define FTL_ERROR_INVALID_LOGICAL_ADDR 0xF0
36 #define FTL_ERROR_OUT_OF_SPACE        (0xF1)
37 #define FTL_ERROR_PAGE_FORMAT         (0xF2)
38 #define FTL_ERROR_PAGE_END_FORMAT     (0xF3)
39 
40 
41 /*============================================================================*
42   *                                   Types
43   *============================================================================*/
44 
45 /*============================================================================*
46   *                                Functions
47   *============================================================================*/
48 uint32_t ftl_init(uint32_t u32PageStartAddr, uint8_t pagenum);
49 /**
50     * @brief    Save specified value to specified ftl offset
51     * @param    pdata  specify data buffer
52     * @param    offset specify FTL offset to store
53     * @param    size   size to store
54     * @return   status
55     * @retval   0  status successful
56     * @retval   otherwise fail
57     * @note     FTL offset is pre-defined and no confict with ROM
58     */
59 uint32_t ftl_save_to_storage(void *pdata, uint16_t offset, uint16_t size);
60 
61 /**
62     * @brief    Load specified ftl offset parameter to specified buffer
63     * @param    pdata  specify data buffer
64     * @param    offset specify FTL offset to load
65     * @param    size   size to load
66     * @return   status
67     * @retval   0  status successful
68     * @retval   otherwise fail
69     * @note     FTL offset is pre-defined and no confict with ROM
70     */
71 uint32_t ftl_load_from_storage(void *pdata, uint16_t offset, uint16_t size);
72 
73 void ftl_garbage_collect_in_idle(void);
74 
75 
76 
77 #ifdef  __cplusplus
78 }
79 #endif
80 
81 #endif // _FTL_ROM_H_
82