openocd: fix SPDX tag format for files .c
[fw/openocd] / src / jtag / drivers / versaloon / usbtoxxx / usbtopwr.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /***************************************************************************
4  *   Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com>     *
5  ***************************************************************************/
6
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10
11 #include <string.h>
12
13 #include "../versaloon_include.h"
14 #include "../versaloon.h"
15 #include "../versaloon_internal.h"
16 #include "usbtoxxx.h"
17 #include "usbtoxxx_internal.h"
18
19 RESULT usbtopwr_init(uint8_t interface_index)
20 {
21         return usbtoxxx_init_command(USB_TO_POWER, interface_index);
22 }
23
24 RESULT usbtopwr_fini(uint8_t interface_index)
25 {
26         return usbtoxxx_fini_command(USB_TO_POWER, interface_index);
27 }
28
29 RESULT usbtopwr_config(uint8_t interface_index)
30 {
31 #if PARAM_CHECK
32         if (interface_index > 7) {
33                 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
34                 return ERROR_FAIL;
35         }
36 #endif
37
38         return usbtoxxx_conf_command(USB_TO_POWER, interface_index, NULL, 0);
39 }
40
41 RESULT usbtopwr_output(uint8_t interface_index, uint16_t millivolt)
42 {
43 #if PARAM_CHECK
44         if (interface_index > 7) {
45                 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
46                 return ERROR_FAIL;
47         }
48 #endif
49
50         return usbtoxxx_out_command(USB_TO_POWER, interface_index, (uint8_t *)&millivolt,
51                 2, 0);
52 }