target/aarch64: Use 'bool' data type
[openocd.git] / src / flash / nor / cc26xx.h
blob51a09f19bbbf179082848bb2ef0c8dbdb16f2cb7
1 /***************************************************************************
2 * Copyright (C) 2017 by Texas Instruments, Inc. *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 ***************************************************************************/
18 #ifndef OPENOCD_FLASH_NOR_CC26XX_H
19 #define OPENOCD_FLASH_NOR_CC26XX_H
21 /* Addresses of FCFG1 registers to access ICEPick Device ID and User ID */
22 #define FCFG1_ICEPICK_ID 0x50001318
23 #define FCFG1_USER_ID 0x50001294
25 /* ICEPick device ID mask and values */
26 #define ICEPICK_ID_MASK 0x0fffffff
27 #define ICEPICK_REV_MASK 0xf0000000
28 #define CC26X0_ICEPICK_ID 0x0b99a02f
29 #define CC26X1_ICEPICK_ID 0x0b9bd02f
30 #define CC13X0_ICEPICK_ID 0x0b9be02f
31 #define CC13X2_CC26X2_ICEPICK_ID 0x0bb4102f
33 /* User ID mask for Agama CC13x2 vs CC26x2 */
34 #define USER_ID_CC13_MASK 0x00800000
36 /* Common CC26xx/CC13xx flash and memory parameters */
37 #define CC26XX_FLASH_BASE_ADDR 0x00000000
38 #define CC26XX_FLASH_SIZE_INFO 0x4003002c
39 #define CC26XX_SRAM_SIZE_INFO 0x40082250
40 #define CC26XX_ALGO_BASE_ADDRESS 0x20000000
42 /* Chameleon CC26x0/CC13x0 specific parameters */
43 #define CC26X0_MAX_SECTORS 32
44 #define CC26X0_SECTOR_LENGTH 0x1000
45 #define CC26X0_ALGO_BUFFER_0 0x20001c00
46 #define CC26X0_ALGO_BUFFER_1 0x20002c00
47 #define CC26X0_ALGO_PARAMS_0 0x20001bd8
48 #define CC26X0_ALGO_PARAMS_1 0x20001bec
49 #define CC26X0_WORKING_SIZE (CC26X0_ALGO_BUFFER_1 + CC26X0_SECTOR_LENGTH - \
50 CC26XX_ALGO_BASE_ADDRESS)
52 /* Agama CC26x2/CC13x2 specific parameters */
53 #define CC26X2_MAX_SECTORS 128
54 #define CC26X2_SECTOR_LENGTH 0x2000
55 #define CC26X2_ALGO_BUFFER_0 0x20002000
56 #define CC26X2_ALGO_BUFFER_1 0x20004000
57 #define CC26X2_ALGO_PARAMS_0 0x20001fd8
58 #define CC26X2_ALGO_PARAMS_1 0x20001fec
59 #define CC26X2_WORKING_SIZE (CC26X2_ALGO_BUFFER_1 + CC26X2_SECTOR_LENGTH - \
60 CC26XX_ALGO_BASE_ADDRESS)
62 /* CC26xx flash helper algorithm buffer flags */
63 #define CC26XX_BUFFER_EMPTY 0x00000000
64 #define CC26XX_BUFFER_FULL 0xffffffff
66 /* CC26XX flash helper algorithm commands */
67 #define CC26XX_CMD_NO_ACTION 0
68 #define CC26XX_CMD_ERASE_ALL 1
69 #define CC26XX_CMD_PROGRAM 2
70 #define CC26XX_CMD_ERASE_AND_PROGRAM 3
71 #define CC26XX_CMD_ERASE_AND_PROGRAM_WITH_RETAIN 4
72 #define CC26XX_CMD_ERASE_SECTORS 5
74 /* CC26xx and CC13xx device types */
75 #define CC26XX_NO_TYPE 0 /* Device type not determined yet */
76 #define CC26X0_TYPE 1 /* CC26x0 Chameleon device */
77 #define CC26X1_TYPE 2 /* CC26x1 Chameleon device */
78 #define CC26X2_TYPE 3 /* CC26x2 Agama device */
79 #define CC13X0_TYPE 4 /* CC13x0 Chameleon device */
80 #define CC13X2_TYPE 5 /* CC13x2 Agama device */
82 /* Flash helper algorithm parameter block struct */
83 #define CC26XX_STATUS_OFFSET 0x0c
84 struct cc26xx_algo_params {
85 uint8_t address[4];
86 uint8_t length[4];
87 uint8_t command[4];
88 uint8_t status[4];
91 /* Flash helper algorithm for CC26x0 Chameleon targets */
92 const uint8_t cc26x0_algo[] = {
93 #include "../../../contrib/loaders/flash/cc26xx/cc26x0_algo.inc"
96 /* Flash helper algorithm for CC26x2 Agama targets */
97 const uint8_t cc26x2_algo[] = {
98 #include "../../../contrib/loaders/flash/cc26xx/cc26x2_algo.inc"
101 #endif /* OPENOCD_FLASH_NOR_CC26XX_H */