openocd: src/target: replace the GPL-2.0-or-later license tag
[fw/openocd] / src / target / stm8.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /*
4 *   OpenOCD STM8 target driver
5 *   Copyright (C) 2017  Ake Rehnman
6 *   ake.rehnman(at)gmail.com
7 */
8
9 #ifndef OPENOCD_TARGET_STM8_H
10 #define OPENOCD_TARGET_STM8_H
11
12 struct target;
13
14 #define STM8_COMMON_MAGIC       0x53544D38
15 #define STM8_NUM_CORE_REGS 6
16
17 struct stm8_common {
18         uint32_t common_magic;
19         void *arch_info;
20         struct reg_cache *core_cache;
21         uint32_t core_regs[STM8_NUM_CORE_REGS];
22
23         /* working area for fastdata access */
24         struct working_area *fast_data_area;
25
26         bool swim_configured;
27         bool bp_scanned;
28         uint8_t num_hw_bpoints;
29         uint8_t num_hw_bpoints_avail;
30         struct stm8_comparator *hw_break_list;
31         uint32_t blocksize;
32         uint32_t flashstart;
33         uint32_t flashend;
34         uint32_t eepromstart;
35         uint32_t eepromend;
36         uint32_t optionstart;
37         uint32_t optionend;
38         bool enable_step_irq;
39
40         bool enable_stm8l;
41         uint32_t flash_cr2;
42         uint32_t flash_ncr2;
43         uint32_t flash_iapsr;
44         uint32_t flash_dukr;
45         uint32_t flash_pukr;
46
47         /* cc value used for interrupt flags restore */
48         uint32_t cc;
49         bool cc_valid;
50
51         /* register cache to processor synchronization */
52         int (*read_core_reg)(struct target *target, unsigned int num);
53         int (*write_core_reg)(struct target *target, unsigned int num);
54 };
55
56 static inline struct stm8_common *
57 target_to_stm8(struct target *target)
58 {
59         return target->arch_info;
60 }
61
62 #endif /* OPENOCD_TARGET_STM8_H */