1 /***************************************************************************
2 * Copyright (C) 2011 by Mathias Kuester *
3 * Mathias Kuester <kesmtp@freenet.de> *
5 * Copyright (C) 2012 by Spencer Oliver *
6 * spen@spen-soft.co.uk *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
22 ***************************************************************************/
28 struct hl_interface_s
;
29 struct hl_interface_param_s
;
32 extern struct hl_layout_api_s stlink_usb_layout_api
;
33 extern struct hl_layout_api_s icdi_usb_layout_api
;
36 struct hl_layout_api_s
{
38 int (*open
) (struct hl_interface_param_s
*param
, void **fd
);
40 int (*close
) (void *fd
);
42 int (*reset
) (void *fd
);
44 int (*assert_srst
) (void *fd
, int srst
);
46 int (*run
) (void *fd
);
48 int (*halt
) (void *fd
);
50 int (*step
) (void *fd
);
52 int (*read_regs
) (void *fd
);
54 int (*read_reg
) (void *fd
, int num
, uint32_t *val
);
56 int (*write_reg
) (void *fd
, int num
, uint32_t val
);
58 int (*read_mem
) (void *handle
, uint32_t addr
, uint32_t size
,
59 uint32_t count
, uint8_t *buffer
);
61 int (*write_mem
) (void *handle
, uint32_t addr
, uint32_t size
,
62 uint32_t count
, const uint8_t *buffer
);
64 int (*write_debug_reg
) (void *handle
, uint32_t addr
, uint32_t val
);
66 int (*idcode
) (void *fd
, uint32_t *idcode
);
68 enum target_state (*state
) (void *fd
);
76 int (*open
) (struct hl_interface_s
*adapter
);
78 int (*close
) (struct hl_interface_s
*adapter
);
80 struct hl_layout_api_s
*api
;
84 const struct hl_layout
*hl_layout_get_list(void);
86 int hl_layout_init(struct hl_interface_s
*adapter
);
88 #endif /* _HL_LAYOUT_H */