xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/inc/driver/instances/r_flash_lp.h (revision b1a0b198f1c8b882f3420357a9559314e8ffe074)
1 /***********************************************************************************************************************
2  * Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
3  *
4  * This file is part of Renesas SynergyTM Software Package (SSP)
5  *
6  * The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
7  * and/or its licensors ("Renesas") and subject to statutory and contractual protections.
8  *
9  * This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with
10  * Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
11  * or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
12  * MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
13  * "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
15  * CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
16  * CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
17  * included in this file may be subject to different terms.
18  **********************************************************************************************************************/
19 /**********************************************************************************************************************
20 * File Name    : r_flash_lp.h
21 * Description  : HLD Interface for the Low-power FLASH peripheral on SC32 MCUs.
22 ***********************************************************************************************************************/
23 /***********************************************************************************************************************
24 Includes
25 ***********************************************************************************************************************/
26 #ifndef R_FLASH_LP_H
27 #define R_FLASH_LP_H
28 
29 #include "bsp_api.h"
30 
31 /* Common macro for SSP header files. There is also a corresponding SSP_FOOTER macro at the end of this file. */
32 SSP_HEADER
33 
34 #include "r_flash_api.h"
35 #include "r_flash_cfg.h"
36 
37 /*******************************************************************************************************************//**
38  * @ingroup HAL_Library
39  * @defgroup FLASH Low Power Flash
40  * @brief Driver for the Low power Flash Memory (S3A7 and S124).
41  *
42  * This module supports the Flash interface for the Low-power FLASH peripheral.
43  * @{
44  **********************************************************************************************************************/
45 
46 
47 /***********************************************************************************************************************
48 Macro definitions
49 ***********************************************************************************************************************/
50 #define FLASH_LP_CODE_VERSION_MAJOR   (1U)
51 #define FLASH_LP_CODE_VERSION_MINOR   (13U)
52 
53 /* If Code Flash programming is enabled, then all API functions must execute out of RAM. */
54 #if (FLASH_CFG_PARAM_CODE_FLASH_PROGRAMMING_ENABLE == 1)
55 #if defined(__ICCARM__)
56 #pragma section=".code_in_ram"
57 #endif
58 #define PLACE_IN_RAM_SECTION        BSP_PLACE_IN_SECTION_V2(".code_in_ram")
59 #else
60 #define PLACE_IN_RAM_SECTION
61 #endif
62 
63 /***********************************************************************************************************************
64 Typedef definitions
65 ***********************************************************************************************************************/
66 /** Flash instance control block. DO NOT INITIALIZE. */
67 typedef struct st_flash_lp_instance_ctrl
68 {
69     uint32_t           opened;               ///< To check whether api has been opened or not.
70     void             * p_reg;                ///< Base address of flash registers
71     void               (*p_callback)(flash_callback_args_t *p_args);
72     bsp_cache_state_t  cache_state;          ///< Used to disable and then restore Flash Cache while API is open.
73     IRQn_Type          irq;                  ///< Flash ready interrupt number
74 } flash_lp_instance_ctrl_t;
75 
76 /**********************************************************************************************************************
77 Exported global variables
78 ***********************************************************************************************************************/
79 /** @cond INC_HEADER_DEFS_SEC */
80 /** Filled in Interface API structure for this Instance. */
81 extern const flash_api_t g_flash_on_flash_lp;
82 /** @endcond */
83 
84 
85 /*******************************************************************************************************************//**
86  * @} (end defgroup FLASH)
87 ***********************************************************************************************************************/
88 /* This will generate a build error if this file is included and the target MCU used is NOT one of the following. */
89 #if !defined(BSP_MCU_GROUP_S3A7) && !defined(BSP_MCU_GROUP_S124) && !defined(BSP_MCU_GROUP_S128) && !defined(BSP_MCU_GROUP_S3A3) \
90     && !defined(BSP_MCU_GROUP_S3A6) && !defined(BSP_MCU_GROUP_S1JA) && !defined(BSP_MCU_GROUP_S3A1)
91 #error "r_flash_lp is not a supported module for this board type."
92 #endif
93 
94 /* Common macro for SSP header files. There is also a corresponding SSP_HEADER macro at the top of this file. */
95 SSP_FOOTER
96 
97 #endif // R_FLASH_LP_H
98