minidriver: fix inline capability of minidriver
[fw/openocd] / src / jtag / minidriver / minidriver_imp.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de>              *
3  *   Copyright (C) 2007,2008 Ã˜yvind Harboe <oyvind.harboe@zylin.com>       *
4  *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  *   This program is distributed in the hope that it will be useful,       *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14  *   GNU General Public License for more details.                          *
15  *                                                                         *
16  *   You should have received a copy of the GNU General Public License     *
17  *   along with this program; if not, write to the                         *
18  *   Free Software Foundation, Inc.,                                       *
19  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20  ***************************************************************************/
21 #ifndef MINIDRIVER_IMP_H
22 #define MINIDRIVER_IMP_H
23
24 #include <jtag/jtag_minidriver.h>
25
26 static inline void interface_jtag_alloc_in_value32(struct scan_field *field)
27 {
28         field->in_value = field->intmp;
29 }
30
31 static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
32 {
33         /* We're executing this synchronously, so try to use local storage. */
34         if (field->num_bits > 32)
35         {
36                 unsigned num_bytes = DIV_ROUND_UP(field->num_bits, 8);
37                 field->in_value = (uint8_t *)malloc(num_bytes);
38                 field->allocated = 1;
39         }
40         else
41                 field->in_value = field->intmp;
42 }
43
44 static inline void jtag_add_dr_out(struct jtag_tap* tap,
45                 int num_fields, const int* num_bits, const uint32_t* value,
46                 tap_state_t end_state)
47 {
48         cmd_queue_cur_state = end_state;
49
50         interface_jtag_add_dr_out(tap,
51                         num_fields, num_bits, value,
52                         end_state);
53 }
54
55 #define jtag_add_callback(callback, in) interface_jtag_add_callback(callback, in)
56
57 #define jtag_add_callback4(callback, in, data1, data2, data3) interface_jtag_add_callback4(callback, in, data1, data2, data3)
58
59
60
61 #endif // MINIDRIVER_IMP_H