data: update qmi-service-uim.json from libqmi git
[project/uqmi.git] / mbim.h
1 /*
2 * Copyright (C) 2014 John Crispin <blogic@openwrt.org>
3 * Copyright (C) 2016 Bjørn Mork <bjorn@mork.no>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
19 */
20
21 #ifndef _MBIM_H__
22 #define _MBIM_H__
23
24 #include <libubox/utils.h>
25 #include <stdbool.h>
26 #include <stdint.h>
27
28 #define MBIM_MESSAGE_TYPE_COMMAND 0x00000003
29 #define MBIM_MESSAGE_TYPE_COMMAND_DONE 0x80000003
30 #define MBIM_MESSAGE_COMMAND_TYPE_SET 1
31 #define MBIM_CID_QMI_MSG 1
32
33 struct mbim_message_header {
34 uint32_t type;
35 uint32_t length;
36 uint32_t transaction_id;
37 } __packed;
38
39 struct mbim_fragment_header {
40 uint32_t total;
41 uint32_t current;
42 } __packed;
43
44 struct mbim_command_message {
45 struct mbim_message_header header;
46 struct mbim_fragment_header fragment_header;
47 uint8_t service_id[16];
48 uint32_t command_id;
49 uint32_t command_type;
50 uint32_t buffer_length;
51 } __packed;
52
53 bool is_mbim_qmi(struct mbim_command_message *msg);
54 void mbim_qmi_cmd(struct mbim_command_message *msg, int len, uint16_t tid);
55
56 #endif