Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
iap.h
1
/*
2
* Copyright (C) 2014 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
9
#ifndef IAP_H
10
#define IAP_H
11
12
#include <stdint.h>
13
14
#ifdef __cplusplus
15
extern
"C"
{
16
#endif
17
18
/* IAP-Commands */
19
#define PREPARE_SECTOR_FOR_WRITE_OPERATION (50)
20
#define COPY_RAM_TO_FLASH (51)
21
#define ERASE_SECTOR (52)
22
#define BLANK_CHECK_SECTOR (53)
23
#define READ_PART_ID (54)
24
#define READ_BOOT_CODE_VERSION (55)
25
#define COMPARE (56)
26
27
/* IAP status codes */
28
#define CMD_SUCCESS (0)
29
#define INVALID_COMMAND (1)
30
#define SRC_ADDR_ERROR (2)
31
#define DST_ADDR_ERROR (3)
32
#define SRC_ADDR_NOT_MAPPED (4)
33
#define DST_ADDR_NOT_MAPPED (5)
34
#define COUNT_ERROR (6)
35
#define INVALID_SECTOR (7)
36
#define SECTOR_NOT_BLANK (8)
37
#define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION (9)
38
#define COMPARE_ERROR (10)
39
#define BUSY (11)
40
41
#define INVALID_ADDRESS (0xFF)
42
43
/* IAP start location on flash */
44
#define IAP_LOCATION (0x7FFFFFF1)
45
46
/* PLL */
47
#define PLLCON_PLLE (0x01)
48
#define PLLCON_PLLD (0x00)
49
#define PLLCON_PLLC (0x03)
50
#define PLLSTAT_PLOCK (0x0400)
52
/*
53
* @brief: Converts 'addr' to sector number
54
* @note: Sector table (Users Manual P. 610)
55
*
56
* @param addr Flash address
57
*
58
* @return Sector number. 0xFF on error
59
*/
60
uint8_t iap_get_sector(uint32_t addr);
61
62
#ifdef __cplusplus
63
}
64
#endif
65
66
#endif
/* IAP_H */
Generated on Fri Jan 3 2025 13:31:18 by
1.9.8