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