• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ smd_read_avail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中smd_read_avail函数的典型用法代码示例。如果您正苦于以下问题:C++ smd_read_avail函数的具体用法?C++ smd_read_avail怎么用?C++ smd_read_avail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了smd_read_avail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: smd_vt_release

static int smd_vt_release(struct inode *ip, struct file *fp)
{
    int r = 0;
    int sz;
    unsigned long flags;

    printk(KERN_INFO "smd_vt_release\n");
    
    mutex_lock(&smd_vt_ch_lock);
    
    smd_vt_devp->open_count--;
    
    if ((smd_vt_devp->open_count == 0) && (smd_vt_devp->ch != 0)) {

        mutex_lock(&smd_vt_rx_buf_lock);
  
        spin_lock_irqsave(&smd_vt_read_lock, flags);
        smd_vt_devp->read_avail = 0;
        spin_unlock_irqrestore(&smd_vt_read_lock, flags);

        sz = smd_cur_packet_size(smd_vt_devp->ch);

        while((sz != 0) && (sz <= smd_read_avail(smd_vt_devp->ch))) {
            if (sz > MAX_RX_BUF_SIZE) {
                smd_read(smd_vt_devp->ch, smd_vt_devp->rx_buf, MAX_RX_BUF_SIZE);
                sz= sz -MAX_RX_BUF_SIZE;
            }
            else{
                smd_read(smd_vt_devp->ch, smd_vt_devp->rx_buf, sz);
                sz =0;
            }
        }
        mutex_unlock(&smd_vt_rx_buf_lock);


        r = smd_close(smd_vt_devp->ch);
        smd_vt_devp->ch = 0;
        smd_vt_devp->open_flag=0;
    }
    mutex_unlock(&smd_vt_ch_lock);

    return r;
}
开发者ID:NieNs,项目名称:IM-A750K-kernel,代码行数:43,代码来源:smd_vt.c


示例2: __diag_smd_wcnss_send_req

void __diag_smd_wcnss_send_req(void)
{
	void *buf = driver->buf_in_wcnss;
	int *in_busy_wcnss_ptr = &(driver->in_busy_wcnss);
	struct diag_request *write_ptr_wcnss = driver->write_ptr_wcnss;
#if  DIAG_XPST
	int type;
#endif

	if ((!driver->in_busy_wcnss) && driver->ch_wcnss && buf) {
		int r = smd_read_avail(driver->ch_wcnss);
		if (r > IN_BUF_SIZE) {
			if (r < MAX_IN_BUF_SIZE) {
				pr_err("diag: wcnss packets > %d bytes", r);
				buf = krealloc(buf, r, GFP_KERNEL);
			} else {
				pr_err("diag: wcnss pkt > %d", MAX_IN_BUF_SIZE);
				return;
			}
		}
		if (r > 0) {
			if (!buf) {
				pr_err("Out of diagmem for wcnss\n");
			} else {
				APPEND_DEBUG('i');
				smd_read(driver->ch_wcnss, buf, r);
				APPEND_DEBUG('j');
#if  DIAG_XPST
				type = checkcmd_modem_epst(buf);
				if (type) {
					modem_to_userspace(buf, r, type, 0);
					return;
				}
#endif
				write_ptr_wcnss->length = r;
				*in_busy_wcnss_ptr = 1;
				diag_device_write(buf, WCNSS_DATA,
					 write_ptr_wcnss);
			}
		}
	}
}
开发者ID:dic1911,项目名称:android_kernel_htc_gtou,代码行数:42,代码来源:diagfwd.c


示例3: grmnet_ctrl_smd_notify

static void grmnet_ctrl_smd_notify(void *p, unsigned event)
{
	struct rmnet_ctrl_port	*port = p;
	struct smd_ch_info	*c = &port->ctrl_ch;
	struct rmnet_ctrl_pkt	*cpkt;
	unsigned long		flags;

	pr_debug("%s: EVENT_(%s)\n", __func__, get_smd_event(event));

	switch (event) {
	case SMD_EVENT_DATA:
		if (smd_read_avail(c->ch))
			queue_work(grmnet_ctrl_wq, &c->read_w);
		if (smd_write_avail(c->ch))
			queue_work(grmnet_ctrl_wq, &c->write_w);
		break;
	case SMD_EVENT_OPEN:
		set_bit(CH_OPENED, &c->flags);

		if (port && port->port_usb && port->port_usb->connect)
			port->port_usb->connect(port->port_usb);

		break;
	case SMD_EVENT_CLOSE:
		clear_bit(CH_OPENED, &c->flags);

		if (port && port->port_usb && port->port_usb->disconnect)
			port->port_usb->disconnect(port->port_usb);

		spin_lock_irqsave(&port->port_lock, flags);
		while (!list_empty(&c->tx_q)) {
			cpkt = list_first_entry(&c->tx_q,
					struct rmnet_ctrl_pkt, list);

			list_del(&cpkt->list);
			free_rmnet_ctrl_pkt(cpkt);
		}
		spin_unlock_irqrestore(&port->port_lock, flags);

		break;
	}
}
开发者ID:ColonelSaumon,项目名称:android_kernel_nokia_msm8x25,代码行数:42,代码来源:u_rmnet_ctrl_smd.c


示例4: wcnss_fw_status

static unsigned char wcnss_fw_status(void)
{
	int len = 0;
	int rc = 0;

	unsigned char fw_status = 0xFF;

	len = smd_read_avail(penv->smd_ch);
	if (len < 1) {
		pr_err("%s: invalid firmware status", __func__);
		return fw_status;
	}

	rc = smd_read(penv->smd_ch, &fw_status, 1);
	if (rc < 0) {
		pr_err("%s: incomplete data read from smd\n", __func__);
		return fw_status;
	}
	return fw_status;
}
开发者ID:Loller79,项目名称:Solid_Kernel-STOCK-KK,代码行数:20,代码来源:wcnss_wlan.c


示例5: hci_smd_notify_event

static void hci_smd_notify_event(void *data, unsigned int event)
{
	struct hci_dev *hdev = hs.hdev;
	struct hci_smd_data *hsmd = &hs;
	struct work_struct *reset_worker;
	int len = 0;

	if (!hdev) {
		BT_ERR("Frame for unknown HCI device (hdev=NULL)");
		return;
	}

	switch (event) {
	case SMD_EVENT_DATA:
		len = smd_read_avail(hsmd->event_channel);
		if (len > 0)
			tasklet_hi_schedule(&hs.rx_task);
		else if (len < 0)
			BT_ERR("Failed to read event from smd %d", len);

		break;
	case SMD_EVENT_OPEN:
		BT_INFO("opening HCI-SMD channel :%s", EVENT_CHANNEL);
		hci_smd_open(hdev);
		break;
	case SMD_EVENT_CLOSE:
		BT_INFO("Closing HCI-SMD channel :%s", EVENT_CHANNEL);
		hci_smd_close(hdev);
		reset_worker = kzalloc(sizeof(*reset_worker), GFP_ATOMIC);
		if (!reset_worker) {
			BT_ERR("Out of memory");
			break;
		}
		INIT_WORK(reset_worker, hci_dev_restart);
		schedule_work(reset_worker);
		break;
	default:
		break;
	}
}
开发者ID:AmeriCanAndroid,项目名称:aca-evo3d-gsm-omega-3.0-mdj,代码行数:40,代码来源:hci_smd.c


示例6: smd_try_to_send

static void smd_try_to_send(struct diag_context *ctxt)
{
	if (ctxt->ch) {
		int r = smd_read_avail(ctxt->ch);
		if (r > RXN_MAX) {
			printk(KERN_ERR "The SMD data is too large to send (%d) !!\n", r);
            r = RXN_MAX;
		}
		if (r > 0) {
			struct diag_request *req = get_req(ctxt, &ctxt->rx_arm9_idle);
			if (!req) {
				printk(KERN_ERR "There is no enough request to ARM11!!\n");
				return;
			}
			smd_read(ctxt->ch, req->buf, r);
			smd_xfer_count_func(r, data_set_rx);
			req->actual = r;
			put_req(ctxt, &ctxt->rx_arm9_done, req);
			wake_up(&ctxt->read_arm9_wq);
		}
	}
}
开发者ID:astarasikov,项目名称:android_kernel_htc_kovsky,代码行数:22,代码来源:smd_diag.c


示例7: grmnet_ctrl_smd_read_w

static void grmnet_ctrl_smd_read_w(struct work_struct *w)
{
struct smd_ch_info *c = container_of(w, struct smd_ch_info, read_w);
struct rmnet_ctrl_port *port = c->port;
int sz;
size_t len;
void *buf;
unsigned long flags;

	spin_lock_irqsave(&port->port_lock, flags);
	while (c->ch) {
                if (c->ch == NULL)
                        break;
		sz = smd_cur_packet_size(c->ch);
		if (sz <= 0)
			break;

		if (smd_read_avail(c->ch) < sz)
			break;

		spin_unlock_irqrestore(&port->port_lock, flags);

		buf = kmalloc(sz, GFP_KERNEL);
		if (!buf)
			return;

		len = smd_read(c->ch, buf, sz);

		/* send it to USB here */
		spin_lock_irqsave(&port->port_lock, flags);
		if (port->port_usb && port->port_usb->send_cpkt_response) {
			port->port_usb->send_cpkt_response(port->port_usb,
							buf, len);
			c->to_host++;
		}
		kfree(buf);
	}
	spin_unlock_irqrestore(&port->port_lock, flags);
}
开发者ID:KylessOpenlp,项目名称:caf-port,代码行数:39,代码来源:u_rmnet_ctrl_smd.c


示例8: __diag_smd_send_req

void __diag_smd_send_req(int context)
{
	void *buf;

	if (driver->ch && (!driver->in_busy)) {
		int r = smd_read_avail(driver->ch);

	if (r > USB_MAX_IN_BUF) {
		if (r < MAX_BUF_SIZE) {
				printk(KERN_ALERT "\n diag: SMD sending in "
					   "packets upto %d bytes", r);
				driver->usb_buf_in = krealloc(
					driver->usb_buf_in, r, GFP_KERNEL);
		} else {
			printk(KERN_ALERT "\n diag: SMD sending in "
				 "packets more than %d bytes", MAX_BUF_SIZE);
			return;
		}
	}
		if (r > 0) {

			buf = driver->usb_buf_in;
			if (!buf) {
				printk(KERN_INFO "Out of diagmem for a9\n");
			} else {
				APPEND_DEBUG('i');
				if (context == SMD_CONTEXT)
					smd_read_from_cb(driver->ch, buf, r);
				else
					smd_read(driver->ch, buf, r);
				APPEND_DEBUG('j');
				driver->usb_write_ptr->length = r;
				driver->in_busy = 1;
				diag_device_write(buf, MODEM_DATA);
			}
		}
	}
}
开发者ID:AntonioPT,项目名称:u8150-kernel-pulse-port,代码行数:38,代码来源:diagfwd.c


示例9: wcn36xx_smd_work

static void wcn36xx_smd_work(struct work_struct *work)
{
	int msg_len;
	int avail;
	void *msg;
	int ret;
	struct wcn36xx *wcn =
		container_of(work, struct wcn36xx, smd_work);

	if (!wcn)
		return;

	while (1) {
		msg_len = smd_cur_packet_size(wcn->smd_ch);
		if (0 == msg_len) {
			complete(&wcn->smd_compl);
			return;
		}

		avail = smd_read_avail(wcn->smd_ch);
		if (avail < msg_len) {
			complete(&wcn->smd_compl);
			return;
		}
		msg = kmalloc(msg_len, GFP_KERNEL);
		if (NULL == msg) {
			complete(&wcn->smd_compl);
			return;
		}
		ret = smd_read(wcn->smd_ch, msg, msg_len);
		if (ret != msg_len) {
			complete(&wcn->smd_compl);
			return;
		}
		wcn36xx_smd_rsp_process(wcn, msg, msg_len);
		kfree(msg);
	}
}
开发者ID:kvalo,项目名称:wcn36xx,代码行数:38,代码来源:smd.c


示例10: qmi_notify

static void qmi_notify(void *priv, unsigned event)
{
	struct qmi_ctxt *ctxt = priv;
	
	switch (event) {
	case SMD_EVENT_DATA: {
		int sz;
		sz = smd_cur_packet_size(ctxt->ch);
		if ((sz > 0) && (sz <= smd_read_avail(ctxt->ch))) {
			wake_lock_timeout(&ctxt->wake_lock, HZ / 2);
			queue_work(qmi_wq, &ctxt->read_work);
		}
		break;
	}
	case SMD_EVENT_OPEN:
		printk(KERN_INFO "qmi: smd opened\n");
		queue_work(qmi_wq, &ctxt->open_work);
		break;
	case SMD_EVENT_CLOSE:
		printk(KERN_INFO "qmi: smd closed\n");
		break;
	}
}
开发者ID:mustafak9,项目名称:photon-android,代码行数:23,代码来源:smd_qmi.c


示例11: grmnet_ctrl_smd_notify

static void grmnet_ctrl_smd_notify(void *p, unsigned event)
{
	struct rmnet_ctrl_port	*port = p;
	struct smd_ch_info	*c = &port->ctrl_ch;

	pr_debug("%s: EVENT_(%s)\n", __func__, get_smd_event(event));

	switch (event) {
	case SMD_EVENT_DATA:
		if (smd_read_avail(c->ch))
			queue_work(grmnet_ctrl_wq, &c->read_w);
		if (smd_write_avail(c->ch))
			queue_work(grmnet_ctrl_wq, &c->write_w);
		break;
	case SMD_EVENT_OPEN:
		set_bit(CH_OPENED, &c->flags);
		wake_up(&c->wait);
		break;
	case SMD_EVENT_CLOSE:
		clear_bit(CH_OPENED, &c->flags);
		break;
	}
}
开发者ID:dimax754,项目名称:msm_2.6.38,代码行数:23,代码来源:u_rmnet_ctrl_smd.c


示例12: diag_smd_wcnss_cntl_notify

void diag_smd_wcnss_cntl_notify(void *ctxt, unsigned event)
{
	int r1, r2;

	if (!(driver->ch_wcnss_cntl))
		return;

	switch (event) {
	case SMD_EVENT_DATA:
		r1 = smd_read_avail(driver->ch_wcnss_cntl);
		r2 = smd_cur_packet_size(driver->ch_wcnss_cntl);
		if (r1 > 0 && r1 == r2)
			queue_work(driver->diag_wq,
				 &(driver->diag_read_smd_wcnss_cntl_work));
		else
			pr_debug("diag: incomplete pkt on WCNSS CNTL ch\n");
		break;
	case SMD_EVENT_OPEN:
		queue_work(driver->diag_cntl_wq,
			 &(driver->diag_wcnss_mask_update_work));
		break;
	}
}
开发者ID:ColonelSaumon,项目名称:android_kernel_nokia_msm8x25,代码行数:23,代码来源:diagfwd_cntl.c


示例13: wcnss_smd_notify_event

static void wcnss_smd_notify_event(void *data, unsigned int event)
{
	int len = 0;

	if (penv != data) {
		pr_err("wcnss: invalid env pointer in smd callback\n");
		return;
	}
	switch (event) {
	case SMD_EVENT_DATA:
		len = smd_read_avail(penv->smd_ch);
		if (len < 0) {
			pr_err("wcnss: failed to read from smd %d\n", len);
			return;
		}
		schedule_work(&penv->wcnssctrl_rx_work);
		break;

	case SMD_EVENT_OPEN:
		pr_debug("wcnss: opening WCNSS SMD channel :%s",
				WCNSS_CTRL_CHANNEL);
		schedule_work(&penv->wcnssctrl_version_work);

		break;

	case SMD_EVENT_CLOSE:
		pr_debug("wcnss: closing WCNSS SMD channel :%s",
				WCNSS_CTRL_CHANNEL);
		/* This SMD is closed only during SSR */
		penv->ssr_boot = true;
		penv->nv_downloaded = 0;
		break;

	default:
		break;
	}
}
开发者ID:Loller79,项目名称:Solid_Kernel-STOCK-KK,代码行数:37,代码来源:wcnss_wlan.c


示例14: ssm_app_modem_work_fn

static void ssm_app_modem_work_fn(struct work_struct *work)
{
	int sz, rc;
	struct ssm_common_msg pkt;
	struct ssm_driver *ssm;

	ssm = container_of(work, struct ssm_driver, ipc_work);

	mutex_lock(&ssm->mutex);
	sz = smd_cur_packet_size(ssm->ch);
	if ((sz < SSM_MSG_FIELD_LEN) || (sz > ATOM_MSG_LEN)) {
		dev_dbg(ssm_drv->dev, "Garbled message size\n");
		goto unlock;
	}

	if (smd_read_avail(ssm->ch) < sz) {
		dev_err(ssm_drv->dev, "SMD error data in channel\n");
		goto unlock;
	}

	if (smd_read(ssm->ch, ssm->smd_buffer, sz) != sz) {
		dev_err(ssm_drv->dev, "Incomplete data\n");
		goto unlock;
	}

	rc = decode_packet(ssm->smd_buffer, &pkt);
	if (rc < 0) {
		dev_err(ssm_drv->dev, "Corrupted header\n");
		goto unlock;
	}

	process_message(pkt, ssm);

unlock:
	mutex_unlock(&ssm->mutex);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:36,代码来源:ssm.c


示例15: smd_tty_read

static void smd_tty_read(unsigned long param)
{
	unsigned char *ptr;
	int avail;
	struct smd_tty_info *info = (struct smd_tty_info *)param;
	struct tty_struct *tty = info->tty;

	if (!tty)
		return;

	for (;;) {
		if (test_bit(TTY_THROTTLED, &tty->flags)) break;
		avail = smd_read_avail(info->ch);
		if (avail == 0)
			break;

		if (avail > MAX_TTY_BUF_SIZE)
             avail = MAX_TTY_BUF_SIZE;

		avail = tty_prepare_flip_string(tty, &ptr, avail);

		if (smd_read(info->ch, ptr, avail) != avail) {
			/* shouldn't be possible since we're in interrupt
			** context here and nobody else could 'steal' our
			** characters.
			*/
			printk(KERN_ERR "OOPS - smd_tty_buffer mismatch?!");
		}

		wake_lock_timeout(&info->wake_lock, HZ / 2);
		tty_flip_buffer_push(tty);
	}

	/* XXX only when writable and necessary */
	tty_wakeup(tty);
}
开发者ID:kerneldevs,项目名称:franco.Kernel,代码行数:36,代码来源:smd_tty.c


示例16: smd_tty_chars_in_buffer

static int smd_tty_chars_in_buffer(struct tty_struct *tty)
{
	struct smd_tty_info *info = tty->driver_data;
	return smd_read_avail(info->ch);
}
开发者ID:NooNameR,项目名称:QSD3.0,代码行数:5,代码来源:smd_tty.c


示例17: diag_smd_dci_send_req

static void diag_smd_dci_send_req(int proc_num)
{
	void *buf = NULL;
	smd_channel_t *smd_ch = NULL;
	int i, r, found = 1;
	int cmd_code_len = 1;

	if (driver->in_busy_dci)
		return;

	if (proc_num == MODEM_PROC) {
		buf = driver->buf_in_dci;
		smd_ch = driver->ch_dci;
	}

	if (!smd_ch || !buf)
		return;

	r = smd_read_avail(smd_ch);
	if (r > IN_BUF_SIZE) {
		if (r < MAX_IN_BUF_SIZE) {
			pr_err("diag: SMD DCI sending pkt upto %d bytes", r);
			buf = krealloc(buf, r, GFP_KERNEL);
		} else {
			pr_err("diag: DCI pkt > %d bytes", MAX_IN_BUF_SIZE);
			return;
		}
	}
	if (buf && r > 0) {
		smd_read(smd_ch, buf, r);
		diag_printk(1,"diag:%s data received ---\n",__func__);
		for (i = 0; i < r; i++)
			diag_printk(1,"\t %x \t", *(((unsigned char *)buf)+i));

		if (*(uint8_t *)(buf+4) != DCI_CMD_CODE)
			cmd_code_len = 4; /* delayed response */
		driver->write_ptr_dci->length =
			 (int)(*(uint16_t *)(buf+2)) - (4+cmd_code_len);
		diag_printk(1,"diag:%s len = %d\n",__func__, (int)(*(uint16_t *)(buf+2))
							 - (4+cmd_code_len));
		/* look up DCI client with tag */
		for (i = 0; i < dci_max_reg; i++) {
			if (driver->dci_tbl[i].tag ==
			    *(int *)(buf+(4+cmd_code_len))) {
				found = 0;
				break;
			}
		}
		if (found)
			pr_alert("diag: No matching PID for DCI data\n");
		diag_printk(1,"\n diag:%s  PID = %d",__func__, driver->dci_tbl[i].pid);
		if (driver->dci_tbl[i].pid == 0)
			pr_alert("diag: Receiving DCI process deleted\n");
		*(int *)(buf+4+cmd_code_len) = driver->dci_tbl[i].uid;
		/* update len after adding UID */
		driver->write_ptr_dci->length =
			driver->write_ptr_dci->length + 4;
		diag_printk(1,"diag:%s data receivd, wake process\n",__func__);
		driver->in_busy_dci = 1;
		diag_update_sleeping_process(driver->dci_tbl[i].pid,
							DCI_DATA_TYPE);
		/* delete immediate response entry */
		if (driver->buf_in_dci[8+cmd_code_len] != 0x80)
			driver->dci_tbl[i].pid = 0;
		for (i = 0; i < dci_max_reg; i++)
			if (driver->dci_tbl[i].pid != 0)
				diag_printk(1,"diag:%s PID = %d, UID = %d, tag = %d\n",
				__func__,driver->dci_tbl[i].pid, driver->dci_tbl[i].uid,
				 driver->dci_tbl[i].tag);
		diag_printk(1,"diag:%s completed clearing table\n",__func__);
	}
}
开发者ID:KonstaT,项目名称:sailfishos_kernel_jolla_msm8930,代码行数:72,代码来源:diag_dci.c


示例18: WPAL_TRACE

/**
 @brief    Callback function for serializing WCTS Read
           processing in the control context

 @param    pWCTSCb  WCTS Control Block

 @see
 @return void
*/
static void
WCTS_PALReadCallback
(
   WCTS_ControlBlockType*  pWCTSCb
)
{
   void* buffer;
   int packet_size;
   int available;
   int bytes_read;

   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

   /*--------------------------------------------------------------------
     Sanity check
     --------------------------------------------------------------------*/
   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "WCTS_PALReadCallback: Invalid parameter received.");
      return;
   }

   /* iterate until no more packets are available */
   while (1) {
      /* check the length of the next packet */
      packet_size = smd_cur_packet_size(pWCTSCb->wctsChannel);
      if (0 == packet_size) {
         /* No more data to be read */
         return;
      }

      /* Check how much of the data is available */
      available = smd_read_avail(pWCTSCb->wctsChannel);
      if (available < packet_size) {
         /* Entire packet not yet ready to be read --
            There will be another notification when it is ready */
         return;
      }

      buffer = wpalMemoryAllocate(packet_size);
      if (NULL ==  buffer) {
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                    "WCTS_PALReadCallback: Memory allocation failure");
         WPAL_ASSERT(0);
         return;
      }

      bytes_read = smd_read(pWCTSCb->wctsChannel,
                            buffer,
                            packet_size);

      if (bytes_read != packet_size) {
         /*Some problem, do not forward it to WDI.*/
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                    "WCTS_PALReadCallback: Failed to read data from SMD");
         wpalMemoryFree(buffer);
         WPAL_ASSERT(0);
         return;
      }

      /* forward the message to the registered handler */
      pWCTSCb->wctsRxMsgCB((WCTS_HandleType)pWCTSCb,
                           buffer,
                           packet_size,
                           pWCTSCb->wctsRxMsgCBData);

      /* Free the allocated buffer*/
      wpalMemoryFree(buffer);
   }

} /*WCTS_PALReadCallback*/
开发者ID:chunyeow,项目名称:prima,代码行数:80,代码来源:wlan_qct_wdi_cts.c


示例19: __diag_smd_send_req

void __diag_smd_send_req(void)
{
	void *buf = NULL;
	int *in_busy_ptr = NULL;
	struct diag_request *write_ptr_modem = NULL;

	if (!driver->in_busy_1) {
		buf = driver->buf_in_1;
		write_ptr_modem = driver->write_ptr_1;
		in_busy_ptr = &(driver->in_busy_1);
	} else if (!driver->in_busy_2) {
		buf = driver->buf_in_2;
		write_ptr_modem = driver->write_ptr_2;
		in_busy_ptr = &(driver->in_busy_2);
	}

	if (driver->ch && buf) {
		int r = smd_read_avail(driver->ch);

		if (r > IN_BUF_SIZE) {
			if (r < MAX_IN_BUF_SIZE) {
				pr_err("diag: SMD sending in "
						   "packets upto %d bytes", r);
				buf = krealloc(buf, r, GFP_KERNEL);
			} else {
				pr_err("diag: SMD sending in "
				"packets more than %d bytes", MAX_IN_BUF_SIZE);
				return;
			}
		}
		if (r > 0) {
			if (!buf)
				pr_info("Out of diagmem for Modem\n");
			else {
				#ifdef CONFIG_HUAWEI_FEATURE_PHUDIAG
				mutex_lock(&phudriver->diagchar_mutex);
				if(phudriver->opened)
				{	
					if(r != phudiagfwd_ring_buf_set_data_before_process(phudriver->in_buf, r))
					{
						printk(KERN_INFO "__diag_smd_send_req write in_buf out of memory !\n");
						mutex_unlock(&phudriver->diagchar_mutex);
						return;
					}
				}
				#endif
				APPEND_DEBUG('i');
				smd_read(driver->ch, buf, r);
				APPEND_DEBUG('j');
				#ifdef CONFIG_HUAWEI_FEATURE_PHUDIAG
				if(phudriver->opened)
				{
					memcpy(phudriver->in_buf->end,buf,r);
					phudriver->in_buf->end += r;
				}
				mutex_unlock(&phudriver->diagchar_mutex);
				#endif
				write_ptr_modem->length = r;
				*in_busy_ptr = 1;
				diag_device_write(buf, MODEM_DATA,
							 write_ptr_modem);
			}
		}
	}

	#ifdef CONFIG_HUAWEI_FEATURE_PHUDIAG
	phudiagfwd_usb_diag_suspend_packet_num++;
	mutex_lock(&phudriver->diagchar_mutex);
	if(phudriver->opened && NULL == buf 
	   && phudiagfwd_usb_diag_suspend_packet_num > 10 )
	{
		phudiagfwd_usb_diag_suspend_packet_num = 10;
		phudiagfwd_read_data_from_smd();
	}
	mutex_unlock(&phudriver->diagchar_mutex);
	#endif
		
}
开发者ID:desalesouche,项目名称:kernel_huawei,代码行数:78,代码来源:diagfwd.c


示例20: rpcrouter_smd_remote_read_avail

static int rpcrouter_smd_remote_read_avail(void)
{
    return smd_read_avail(smd_remote_xprt.channel);
}
开发者ID:underdarkonsole,项目名称:huawei_vision_kernel_JB,代码行数:4,代码来源:rpcrouter_smd_xprt.c



注:本文中的smd_read_avail函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ smd_write函数代码示例发布时间:2022-05-30
下一篇:
C++ smd_read函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap