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
#pragma once
10
11
#include <stdint.h>
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
17
/* IAP-Commands */
18
#define PREPARE_SECTOR_FOR_WRITE_OPERATION (50)
19
#define COPY_RAM_TO_FLASH (51)
20
#define ERASE_SECTOR (52)
21
#define BLANK_CHECK_SECTOR (53)
22
#define READ_PART_ID (54)
23
#define READ_BOOT_CODE_VERSION (55)
24
#define COMPARE (56)
25
26
/* IAP status codes */
27
#define CMD_SUCCESS (0)
28
#define INVALID_COMMAND (1)
29
#define SRC_ADDR_ERROR (2)
30
#define DST_ADDR_ERROR (3)
31
#define SRC_ADDR_NOT_MAPPED (4)
32
#define DST_ADDR_NOT_MAPPED (5)
33
#define COUNT_ERROR (6)
34
#define INVALID_SECTOR (7)
35
#define SECTOR_NOT_BLANK (8)
36
#define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION (9)
37
#define COMPARE_ERROR (10)
38
#define BUSY (11)
39
40
#define INVALID_ADDRESS (0xFF)
41
42
/* IAP start location on flash */
43
#define IAP_LOCATION (0x7FFFFFF1)
44
45
/* PLL */
46
#define PLLCON_PLLE (0x01)
47
#define PLLCON_PLLD (0x00)
48
#define PLLCON_PLLC (0x03)
49
#define PLLSTAT_PLOCK (0x0400)
50
51
/*
52
* @brief: Converts 'addr' to sector number
53
* @note: Sector table (Users Manual P. 610)
54
*
55
* @param addr Flash address
56
*
57
* @return Sector number. 0xFF on error
58
*/
59
uint8_t iap_get_sector(uint32_t addr);
60
61
#ifdef __cplusplus
62
}
63
#endif
Generated on Wed Aug 27 2025 20:40:40 by
1.13.2