2024-09-09 08:57:42 +00:00
|
|
|
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
|
2024-09-09 08:52:07 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
|
|
* only version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DIAGFWD_BRIDGE_H
|
|
|
|
#define DIAGFWD_BRIDGE_H
|
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
/*
|
|
|
|
* Add Data channels at the top half and the DCI channels at the
|
|
|
|
* bottom half of this list.
|
|
|
|
*/
|
|
|
|
#define DIAGFWD_MDM 0
|
|
|
|
#define DIAGFWD_SMUX 1
|
|
|
|
#define NUM_REMOTE_DATA_DEV 2
|
|
|
|
#define DIAGFWD_MDM_DCI NUM_REMOTE_DATA_DEV
|
|
|
|
#define NUM_REMOTE_DCI_DEV (DIAGFWD_MDM_DCI - NUM_REMOTE_DATA_DEV + 1)
|
|
|
|
#define NUM_REMOTE_DEV (NUM_REMOTE_DATA_DEV + NUM_REMOTE_DCI_DEV)
|
2024-09-09 08:52:07 +00:00
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
#define DIAG_BRIDGE_NAME_SZ 24
|
|
|
|
#define DIAG_BRIDGE_GET_NAME(x) (bridge_info[x].name)
|
2024-09-09 08:52:07 +00:00
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
struct diag_remote_dev_ops {
|
|
|
|
int (*open)(int id);
|
|
|
|
int (*close)(int id);
|
|
|
|
int (*queue_read)(int id);
|
|
|
|
int (*write)(int id, unsigned char *buf, int len, int ctxt);
|
|
|
|
int (*fwd_complete)(int id, unsigned char *buf, int len, int ctxt);
|
|
|
|
};
|
2024-09-09 08:52:07 +00:00
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
struct diagfwd_bridge_info {
|
2024-09-09 08:52:07 +00:00
|
|
|
int id;
|
2024-09-09 08:57:42 +00:00
|
|
|
int type;
|
|
|
|
int inited;
|
|
|
|
int ctxt;
|
|
|
|
char name[DIAG_BRIDGE_NAME_SZ];
|
|
|
|
struct diag_remote_dev_ops *dev_ops;
|
|
|
|
/* DCI related variables. These would be NULL for data channels */
|
|
|
|
void *dci_read_ptr;
|
|
|
|
unsigned char *dci_read_buf;
|
|
|
|
int dci_read_len;
|
|
|
|
struct workqueue_struct *dci_wq;
|
|
|
|
struct work_struct dci_read_work;
|
2024-09-09 08:52:07 +00:00
|
|
|
};
|
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
extern struct diagfwd_bridge_info bridge_info[NUM_REMOTE_DEV];
|
|
|
|
int diagfwd_bridge_init(void);
|
|
|
|
void diagfwd_bridge_exit(void);
|
|
|
|
int diagfwd_bridge_close(int id);
|
|
|
|
int diagfwd_bridge_write(int id, unsigned char *buf, int len);
|
|
|
|
uint16_t diag_get_remote_device_mask(void);
|
|
|
|
|
|
|
|
/* The following functions must be called by Diag remote devices only. */
|
|
|
|
int diagfwd_bridge_register(int id, int ctxt, struct diag_remote_dev_ops *ops);
|
|
|
|
int diag_remote_dev_open(int id);
|
|
|
|
void diag_remote_dev_close(int id);
|
|
|
|
int diag_remote_dev_read_done(int id, unsigned char *buf, int len);
|
|
|
|
int diag_remote_dev_write_done(int id, unsigned char *buf, int len, int ctxt);
|
|
|
|
|
2024-09-09 08:52:07 +00:00
|
|
|
#endif
|