qmi-struct.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * uqmi -- tiny QMI support implementation
  3. *
  4. * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library 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 GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301 USA.
  20. */
  21. #ifndef __QMI_STRUCT_H
  22. #define __QMI_STRUCT_H
  23. struct qmux {
  24. uint16_t len;
  25. uint8_t flags;
  26. uint8_t service;
  27. uint8_t client;
  28. } __packed;
  29. struct tlv {
  30. uint8_t type;
  31. uint16_t len;
  32. uint8_t data[];
  33. } __packed;
  34. struct qmi_ctl {
  35. uint8_t transaction;
  36. uint16_t message;
  37. uint16_t tlv_len;
  38. struct tlv tlv[];
  39. } __packed;
  40. struct qmi_svc {
  41. uint16_t transaction;
  42. uint16_t message;
  43. uint16_t tlv_len;
  44. struct tlv tlv[];
  45. } __packed;
  46. struct qmi_msg {
  47. uint8_t marker;
  48. struct qmux qmux;
  49. uint8_t flags;
  50. union {
  51. struct qmi_ctl ctl;
  52. struct qmi_svc svc;
  53. };
  54. } __packed;
  55. #endif