2
0

mbim.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef _MBIM_H__
  21. #define _MBIM_H__
  22. #include <libubox/utils.h>
  23. #include <stdbool.h>
  24. #include <stdint.h>
  25. #define MBIM_MESSAGE_TYPE_COMMAND 0x00000003
  26. #define MBIM_MESSAGE_TYPE_COMMAND_DONE 0x80000003
  27. #define MBIM_MESSAGE_COMMAND_TYPE_SET 1
  28. #define MBIM_CID_QMI_MSG 1
  29. struct mbim_message_header {
  30. uint32_t type;
  31. uint32_t length;
  32. uint32_t transaction_id;
  33. } __packed;
  34. struct mbim_fragment_header {
  35. uint32_t total;
  36. uint32_t current;
  37. } __packed;
  38. struct mbim_command_message {
  39. struct mbim_message_header header;
  40. struct mbim_fragment_header fragment_header;
  41. uint8_t service_id[16];
  42. uint32_t command_id;
  43. uint32_t command_type;
  44. uint32_t buffer_length;
  45. } __packed;
  46. bool is_mbim_qmi(struct mbim_command_message *msg);
  47. void mbim_qmi_cmd(struct mbim_command_message *msg, int len, uint16_t tid);
  48. #endif