1 /**
2   *********************************************************************************
3   *
4   * @file    ald_iap.h
5   * @brief   Header file of IAP module driver.
6   *
7   * @version V1.0
8   * @date    04 Dec 2019
9   * @author  AE Team
10   * @note
11   *          Change Logs:
12   *          Date            Author          Notes
13   *          04 Dec 2019     AE Team         The first version
14   *
15   * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
16   *
17   * SPDX-License-Identifier: Apache-2.0
18   *
19   * Licensed under the Apache License, Version 2.0 (the License); you may
20   * not use this file except in compliance with the License.
21   * You may obtain a copy of the License at
22   *
23   * www.apache.org/licenses/LICENSE-2.0
24   *
25   * Unless required by applicable law or agreed to in writing, software
26   * distributed under the License is distributed on an AS IS BASIS, WITHOUT
27   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28   * See the License for the specific language governing permissions and
29   * limitations under the License.
30   **********************************************************************************
31   */
32 
33 #ifndef __ALD_IAP_H__
34 #define __ALD_IAP_H__
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include "utils.h"
41 
42 
43 /** @addtogroup ES32FXXX_ALD
44   * @{
45   */
46 
47 /** @addtogroup IAP
48   * @{
49   */
50 
51 /**
52   * @defgroup IAP_Private_Macros IAP Private Macros
53   * @{
54   */
55 #define IAP_WSP_ADDR	    0x10000000U
56 #define IAP_PE_ADDR	    0x10000004U
57 #define IAP_WP_ADDR	    0x10000008U
58 #define IAP_DWP_ADDR	    0x1000000cU
59 #define IAP_WordsProgram_DF 0x10000010U
60 #define IAP_PageErase_DF    0x10000014U
61 #define IAP_WordProgram_DF  0x10000018U
62 #define IAP_DWordProgram_DF 0x1000001cU
63 /**
64   * @}
65   */
66 
67 /** @defgroup IAP_Private_Types IAP Private Types
68   * @{
69   */
70 typedef uint32_t (*IAP_PE)(uint32_t addr);
71 typedef uint32_t (*IAP_WP)(uint32_t addr, uint32_t data);
72 typedef uint32_t (*IAP_DWP)(uint32_t addr, uint32_t data_l, uint32_t data_h);
73 typedef uint32_t (*IAP_WSP)(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase);
74 /**
75   * @}
76   */
77 
78 /** @addtogroup IAP_Public_Functions
79   * @{
80   */
81 uint32_t ald_iap_erase_page(uint32_t addr);
82 uint32_t ald_iap_program_word(uint32_t addr, uint32_t data);
83 uint32_t ald_iap_program_dword(uint32_t addr, uint32_t data_l, uint32_t data_h);
84 uint32_t ald_iap_program_words(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase);
85 uint32_t ald_iap_erase_page_df(uint32_t addr);
86 uint32_t ald_iap_program_word_df(uint32_t addr, uint32_t data);
87 uint32_t ald_iap_program_dword_df(uint32_t addr, uint32_t data_l, uint32_t data_h);
88 uint32_t ald_iap_program_words_df(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase);
89 /**
90   * @}
91   */
92 
93 /**
94   * @}
95   */
96 
97 /**
98   * @}
99   */
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* __ALD_IAP_H__ */
105