1 /*
2  * Copyright (c) 2020 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #define DLCI_CONTROL 0
8 
9 #if IS_ENABLED(CONFIG_GSM_MUX)
10 #define DLCI_AT      CONFIG_GSM_MUX_DLCI_AT
11 #define DLCI_PPP     CONFIG_GSM_MUX_DLCI_PPP
12 #else
13 #define DLCI_AT      -1
14 #define DLCI_PPP     -1
15 #endif
16 
17 struct gsm_mux;
18 struct gsm_dlci;
19 
20 void gsm_mux_recv_buf(struct gsm_mux *mux, uint8_t *buf, int len);
21 int gsm_mux_send(struct gsm_mux *mux, uint8_t dlci_address,
22 		 const uint8_t *buf, size_t size);
23 struct gsm_mux *gsm_mux_create(const struct device *uart);
24 int gsm_mux_disconnect(struct gsm_mux *mux, k_timeout_t timeout);
25 void gsm_mux_init(void);
26 
27 typedef void (*gsm_mux_dlci_created_cb_t)(struct gsm_dlci *dlci,
28 					  bool connected,
29 					  void *user_data);
30 
31 int gsm_dlci_create(struct gsm_mux *mux,
32 		    const struct device *uart,
33 		    int dlci_address,
34 		    gsm_mux_dlci_created_cb_t dlci_created_cb,
35 		    void *user_data,
36 		    struct gsm_dlci **dlci);
37 int gsm_dlci_send(struct gsm_dlci *dlci, const uint8_t *buf, size_t size);
38 int gsm_dlci_id(struct gsm_dlci *dlci);
39 void gsm_mux_detach(struct gsm_mux *mux);
40