patch.h
Go to the documentation of this file.
1 /**
2 ******************************************************************************
3 *
4 * @file patch.h
5 *
6 * @brief offer the interface for the patch function based on the FPB of the cortex arm-m4;
7 *
8 ******************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 #ifndef __PATCH_H_
39 #define __PATCH_H_
40
41 /*
42 * ENUMERATIONS
43 ****************************************************************************************
44 */
45 enum
46 {
47 BIT_HCI_SEND_2_CONTROLLER,
48 BIT_HAL_XQSPI_SET_XIP_PRESENT_STATUS,
49 BIT_LL_XQSPI_INIT,
50 BIT_HAL_EXFLASH_WRITE,
51 BIT_HAL_EXFLASH_ERASE,
52 BIT_HAL_EXFLASH_READ,
53 BIT_BLE_BM_SET_SEC_INFO,
54 BIT_KE_TASK_SCHEDULE,
55 };
56
57
58 /*
59 * MACRO DECLARATIONS
60 ****************************************************************************************
61 */
62 #define PATCH_ENABLE_FLAG(BIT) (1<<BIT)
63
64
65 #define ENCRYPT_PATCH (PATCH_ENABLE_FLAG(BIT_HCI_SEND_2_CONTROLLER) |\
66 PATCH_ENABLE_FLAG(BIT_HAL_EXFLASH_WRITE) |\
67 PATCH_ENABLE_FLAG(BIT_HAL_EXFLASH_ERASE) |\
68 PATCH_ENABLE_FLAG(BIT_HAL_EXFLASH_READ) |\
69 PATCH_ENABLE_FLAG(BIT_BLE_BM_SET_SEC_INFO)) |\
70 PATCH_ENABLE_FLAG(BIT_KE_TASK_SCHEDULE)
71
72
73 #define NO_ENCRYPT_PATCH (PATCH_ENABLE_FLAG(BIT_HCI_SEND_2_CONTROLLER) |\
74 PATCH_ENABLE_FLAG(BIT_HAL_EXFLASH_WRITE) |\
75 PATCH_ENABLE_FLAG(BIT_HAL_EXFLASH_ERASE) |\
76 PATCH_ENABLE_FLAG(BIT_BLE_BM_SET_SEC_INFO)) |\
77 PATCH_ENABLE_FLAG(BIT_KE_TASK_SCHEDULE)
78
79 /**
80 *****************************************************************************************
81 * @brief Apply Cold Patch
82 * This function is used for cold patch
83 *****************************************************************************************
84 */
85 extern void cold_patch_apply(void);
86
87 /**
88 *****************************************************************************************
89 * @brief Patch Enabling Function
90 * This function can not be used directly. It needs to be registered with FPB unit
91 * and automatically enabled by the system.
92 *****************************************************************************************
93 */
94 extern void fpb_patch_enable(void);
95
96 /**
97 *****************************************************************************************
98 * @brief Patch Enabling Function for encrypt
99 * This function can not be used directly. It needs to be registered with FPB unit
100 * and automatically enabled by the system.
101 *****************************************************************************************
102 */
103 extern void fpb_encrypt_mode_patch_enable(void);
104
105 #endif // __PATCH_H_
106
fpb_patch_enable
void fpb_patch_enable(void)
Patch Enabling Function This function can not be used directly.
BIT_HAL_EXFLASH_WRITE
@ BIT_HAL_EXFLASH_WRITE
Definition: patch.h:50
BIT_HAL_EXFLASH_READ
@ BIT_HAL_EXFLASH_READ
Definition: patch.h:52
BIT_LL_XQSPI_INIT
@ BIT_LL_XQSPI_INIT
Definition: patch.h:49
fpb_encrypt_mode_patch_enable
void fpb_encrypt_mode_patch_enable(void)
Patch Enabling Function for encrypt This function can not be used directly.
BIT_HCI_SEND_2_CONTROLLER
@ BIT_HCI_SEND_2_CONTROLLER
Definition: patch.h:47
cold_patch_apply
void cold_patch_apply(void)
Apply Cold Patch This function is used for cold patch.
BIT_BLE_BM_SET_SEC_INFO
@ BIT_BLE_BM_SET_SEC_INFO
Definition: patch.h:53
BIT_HAL_XQSPI_SET_XIP_PRESENT_STATUS
@ BIT_HAL_XQSPI_SET_XIP_PRESENT_STATUS
Definition: patch.h:48
BIT_KE_TASK_SCHEDULE
@ BIT_KE_TASK_SCHEDULE
Definition: patch.h:54
BIT_HAL_EXFLASH_ERASE
@ BIT_HAL_EXFLASH_ERASE
Definition: patch.h:51