forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfprotect.h
64 lines (55 loc) · 1.57 KB
/
fprotect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (c) 2018 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#ifndef FPROTECT_H_
#define FPROTECT_H_
#include <stdint.h>
#include <string.h>
#include <zephyr/types.h>
/**
* @file
* @defgroup fprotect Hardware flash write protection.
* @{
*
* @brief API for write protection of flash areas using Hardware peripheral
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Protect flash area against writes.
*
* @param[in] start Start of range to protect.
* @param[in] length Length in bytes of range to protect.
*
* @retval 0 On success.
* @retval -EINVAL If any of the argument are incorrect.
* @retval -ENOSPC If function is called too many times. Applies to
* devices where there is a limited number of configuration
* registers which are used for all address ranges.
*/
int fprotect_area(uint32_t start, size_t length);
#if defined(CONFIG_FPROTECT_ENABLE_NO_ACCESS)
/**
* @brief Protect flash area against reads/writes.
*
* @param[in] start Start of range to protect.
* @param[in] length Length in bytes of range to protect.
*
* @retval 0 On success.
* @retval -EINVAL If any of the argument are incorrect.
* @retval -ENOSPC If function is called too many times. Applies to
* devices where there is a limited number of configuration
* registers which are used for all address ranges.
*/
int fprotect_area_no_access(uint32_t start, size_t length);
#endif
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* FPROTECT_H_ */