• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/uqmi/uqmid/uqmid.h

  1 /*
  2  * uqmid -- tiny QMI support implementation
  3  *
  4  * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
  5  * Copyright (C) 2023 Alexander Couzens <lynxis@fe80.eu>
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the
 19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 20  * Boston, MA 02110-1301 USA.
 21  */
 22 
 23 #ifndef __UQMID_H
 24 #define __UQMID_H
 25 
 26 #include <libubox/ustream.h>
 27 
 28 enum {
 29         L_CRIT,
 30         L_WARNING,
 31         L_NOTICE,
 32         L_INFO,
 33         L_DEBUG
 34 };
 35 
 36 struct qmi_dev;
 37 struct qmi_service;
 38 struct qmi_request;
 39 struct qmi_msg;
 40 struct modem;
 41 
 42 typedef void (*request_cb)(struct qmi_service *service, struct qmi_request *req, struct qmi_msg *msg);
 43 
 44 struct qmi_request {
 45         struct list_head list; /*! entry on service->reqs */
 46         struct qmi_service *service; /*! pointer back */
 47 
 48         struct qmi_msg *msg;
 49 
 50         request_cb cb;
 51         void *cb_data;
 52 
 53         bool complete;
 54         bool pending;
 55         bool no_error_cb;
 56         uint16_t tid;
 57         int ret;
 58 };
 59 
 60 /* FIXME: describe state machine */
 61 enum {
 62         QMI_RUNNING,
 63         QMI_ERROR,
 64         QMI_STOPPING,
 65 };
 66 
 67 struct qmi_dev {
 68         struct ustream_fd sf;
 69 
 70         struct list_head services;
 71         struct qmi_service *ctrl;
 72         struct modem *modem;
 73 
 74         bool is_mbim;
 75 
 76         struct {
 77                 bool valid;
 78                 uint8_t profile_id;
 79                 uint8_t packet_handle;
 80                 uint8_t ip_family;
 81         } wds;
 82 
 83         int state;
 84         struct uloop_timeout shutdown;
 85         void (*error_cb)(struct qmi_dev *dev, void *data);
 86         void *error_cb_data;
 87         void (*closing_cb)(struct qmi_dev *dev, void *data);
 88         void *closing_cb_data;
 89 };
 90 
 91 struct qmi_dev *qmi_device_open(struct modem *modem, const char *path);
 92 void qmi_device_close(struct qmi_dev *qmi, int timeout_ms);
 93 void qmi_device_service_closed(struct qmi_dev *qmi);
 94 
 95 #endif /* __UQMID_H */
 96 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt