Blame view

RIOT/cpu/arm7_common/include/iap.h 1.94 KB
a752c7ab   elopes   add first test an...
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
65
66
67
  /*
   * Copyright (C) 2014 Freie Universitรคt Berlin
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  #ifndef IAP_H
  #define IAP_H
  
  #include <stdint.h>
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /* IAP-Commands  */
  #define PREPARE_SECTOR_FOR_WRITE_OPERATION  (50)
  #define COPY_RAM_TO_FLASH                   (51)
  #define ERASE_SECTOR                        (52)
  #define BLANK_CHECK_SECTOR                  (53)
  #define READ_PART_ID                        (54)
  #define READ_BOOT_CODE_VERSION              (55)
  #define COMPARE                             (56)
  
  /* IAP status codes */
  #define CMD_SUCCESS                                 (0)
  #define INVALID_COMMAND                             (1)
  #define SRC_ADDR_ERROR                              (2)
  #define DST_ADDR_ERROR                              (3)
  #define SRC_ADDR_NOT_MAPPED                         (4)
  #define DST_ADDR_NOT_MAPPED                         (5)
  #define COUNT_ERROR                                 (6)
  #define INVALID_SECTOR                              (7)
  #define SECTOR_NOT_BLANK                            (8)
  #define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION     (9)
  #define COMPARE_ERROR                               (10)
  #define BUSY                                        (11)
  
  #define INVALID_ADDRESS     (0xFF)
  
  /* IAP start location on flash */
  #define IAP_LOCATION    (0x7FFFFFF1)
  
  /* PLL */
  #define PLLCON_PLLE     (0x01)      ///< PLL Enable
  #define PLLCON_PLLD     (0x00)      ///< PLL Disable
  #define PLLCON_PLLC     (0x03)      ///< PLL Connect
  #define PLLSTAT_PLOCK   (0x0400)    //</ PLL Lock Status
  
  /*
   * @brief:  Converts 'addr' to sector number
   * @note:   Sector table (Users Manual P. 610)
   *
   * @param addr      Flash address
   *
   * @return  Sector number. 0xFF on error
   */
  uint8_t iap_get_sector(uint32_t addr);
  
  #ifdef __cplusplus
  }
  #endif
  
  
  #endif /* IAP_H */