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

C++ smd_write_avail函数代码示例

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

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



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

示例1: 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) && !waitqueue_active(&c->smd_wait_q))
			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;
	}
	wake_up(&c->smd_wait_q);
}
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:43,代码来源:u_rmnet_ctrl_smd.c


示例2: _rmnet_resume_flow

static void _rmnet_resume_flow(unsigned long param)
{
	struct net_device *dev = (struct net_device *)param;
	struct rmnet_private *p = netdev_priv(dev);
	struct sk_buff *skb = NULL;
	unsigned long flags;

	/* xmit and enable the flow only once even if
	   multiple tasklets were scheduled by smd_net_notify */
	spin_lock_irqsave(&p->lock, flags);
	if (p->skb && (smd_write_avail(p->ch) >= p->skb->len)) {
		skb = p->skb;
		p->skb = NULL;
		spin_unlock_irqrestore(&p->lock, flags);
		_rmnet_xmit(skb, dev);
		netif_wake_queue(dev);
	} else
		spin_unlock_irqrestore(&p->lock, flags);
}
开发者ID:vinylfreak89,项目名称:leanKernel-tbolt-aosp,代码行数:19,代码来源:msm_rmnet.c


示例3: rmnet_check_fifo

static void rmnet_check_fifo(struct net_device *dev)
{
#if fcENABLE_FLOW_CTRL
	if (bRmnetFifoFull)
	{
		struct rmnet_private *p = netdev_priv(dev);
		int iAvail = smd_write_avail(p->ch);

		if (iAvail > (smd_total_fifo_size(p->ch) / 2))
		{
			pr_devel(LOG_TAG1 "%[email protected]%d: tx resumed\n", __func__, __LINE__);
			if (netif_carrier_ok(dev))
				netif_wake_queue(dev);
			else
				pr_err(LOG_TAG1 "%[email protected]%d: no netif_carrier_ok\n", __func__, __LINE__);
			bRmnetFifoFull = 0;
		}
	}
#endif
}
开发者ID:AKToronto,项目名称:htc-kernel-msm7227,代码行数:20,代码来源:msm_rmnet.c


示例4: smd_lge_write

static ssize_t smd_lge_write(struct file *fp, const char __user *buf,
			 size_t count, loff_t *pos)
{
	int len = 0, ch_avail = 0, ret = 0;

	SMD_LGE_DBG("%s \n", __func__);

	if (psmd_device->ch == 0) {
		SMD_LGE_INFO("%s : psmd_device->ch is NULL \n", __func__);
		return -EFAULT;
	}

	len = count ;

	if (copy_from_user(psmd_device->tx_buff, buf, count))
		return -EFAULT;

	SMD_LGE_DBG("%s : received len ( %d bytes ) from user \n",
		__func__, count);

	while (len > 0) {
		ch_avail = smd_write_avail(psmd_device->ch);
		SMD_LGE_DBG("%s : ch_avail = %d bytes, len = %d bytes \n",
			__func__, ch_avail, len);

		if (ch_avail < len) {
			ret = smd_write(psmd_device->ch, psmd_device->tx_buff,
				ch_avail);
			len -= ch_avail;
		} else {
			ret = smd_write(psmd_device->ch, psmd_device->tx_buff,
				len);
			len -= len;
		}

	}
	SMD_LGE_DBG("%s : write return value = %d \n", __func__, ret);

	return ret;
}
开发者ID:AbdulrahmanAmir,项目名称:Dorimanx-LG-G2-D802-Kernel,代码行数:40,代码来源:smd_lge_loopback.c


示例5: __apr_tal_write

int __apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data, int len)
{
	int w_len;
	unsigned long flags;


	spin_lock_irqsave(&apr_ch->w_lock, flags);
	if (smd_write_avail(apr_ch->ch) < len) {
		spin_unlock_irqrestore(&apr_ch->w_lock, flags);
		return -EAGAIN;
	}

	w_len = smd_write(apr_ch->ch, data, len);
	spin_unlock_irqrestore(&apr_ch->w_lock, flags);
	pr_debug("apr_tal:w_len = %d\n", w_len);

	if (w_len != len) {
		pr_err("apr_tal: Error in write\n");
		return -ENETRESET;
	}
	return w_len;
}
开发者ID:Illusion-MOD,项目名称:SM-G710K_Illusion_kernel,代码行数:22,代码来源:apr_tal.c


示例6: 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


示例7: smd_net_notify

static void smd_net_notify(void *_dev, unsigned event)
{
	struct rmnet_private *p = netdev_priv((struct net_device *)_dev);

	switch (event) {
	case SMD_EVENT_DATA:
		spin_lock(&p->lock);
		if (p->skb && (smd_write_avail(p->ch) >= p->skb->len)) {
			smd_disable_read_intr(p->ch);
			tasklet_hi_schedule(&p->tsklt);
		}

		spin_unlock(&p->lock);

		if (smd_read_avail(p->ch) &&
			(smd_read_avail(p->ch) >= smd_cur_packet_size(p->ch))) {
			smd_net_data_tasklet.data = (unsigned long) _dev;
			tasklet_schedule(&smd_net_data_tasklet);
		}
		break;

	case SMD_EVENT_OPEN:
		DBG0("%s: opening SMD port\n", __func__);
		netif_carrier_on(_dev);
		if (netif_queue_stopped(_dev)) {
			DBG0("%s: re-starting if queue\n", __func__);
			netif_wake_queue(_dev);
		}
		break;

	case SMD_EVENT_CLOSE:
		DBG0("%s: closing SMD port\n", __func__);
		netif_carrier_off(_dev);
		break;
	}
}
开发者ID:FPChaim,项目名称:android_kernel_lge_msm7x27-3.0.x,代码行数:36,代码来源:msm_rmnet.c


示例8: rmnet_xmit

static int rmnet_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct rmnet_private *p = netdev_priv(dev);
	smd_channel_t *ch = p->ch;
	unsigned long flags;

	if (netif_queue_stopped(dev)) {
		pr_err("fatal: rmnet_xmit called when netif_queue is stopped");
		return 0;
	}

	spin_lock_irqsave(&p->lock, flags);
	if (smd_write_avail(ch) < skb->len) {
		netif_stop_queue(dev);
		p->skb = skb;
		spin_unlock_irqrestore(&p->lock, flags);
		return 0;
	}
	spin_unlock_irqrestore(&p->lock, flags);

	_rmnet_xmit(skb, dev);

	return 0;
}
开发者ID:vinylfreak89,项目名称:leanKernel-tbolt-aosp,代码行数:24,代码来源:msm_rmnet.c


示例9: update_modem

static int update_modem(enum ssm_ipc_req ipc_req, struct ssm_driver *ssm,
		int length, char *data)
{
	unsigned int packet_len = length + SSM_MSG_FIELD_LEN;
	int rc = 0, count;

	snprintf(ssm->smd_buffer, SSM_MSG_FIELD_LEN + 1, "%10u|", ipc_req);
	memcpy(ssm->smd_buffer + SSM_MSG_FIELD_LEN, data, length);

	if (smd_write_avail(ssm->ch) < packet_len) {
		dev_err(ssm->dev, "Not enough space dropping request\n");
		rc = -ENOSPC;
		goto out;
	}

	count = smd_write(ssm->ch, ssm->smd_buffer, packet_len);
	if (count < packet_len) {
		dev_err(ssm->dev, "smd_write failed for %d\n", ipc_req);
		rc = -EIO;
	}

out:
	return rc;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:24,代码来源:ssm.c


示例10: smd_tty_write

static int smd_tty_write(struct tty_struct *tty, const unsigned char *buf, int len)
{
	struct smd_tty_info *info = tty->driver_data;
	int avail, ret, runfix = 0;
#ifdef CONFIG_MACH_HTCLEO
	static int init = 0;
	// seems to start the modem
	const unsigned char* firstcall ="[email protected]=0\r";
	// set functionality to low power mode
	const unsigned char* secondcall="AT+CFUN=0\r";
	// deregister from the network
	const unsigned char* thirdcall ="AT+COPS=2\r";
	unsigned int call_len;
#endif

	/* if we're writing to a packet channel we will
	** never be able to write more data than there
	** is currently space for
	*/
	if (is_in_reset(info))
		return -ENETRESET;

#ifdef CONFIG_MACH_HTCLEO
	if(len>7 && !init && htcleo_is_nand_boot()) {
		pr_info("NAND boot, writing additional init commands to /dev/smd0");

		call_len = strlen(firstcall);
		avail = smd_write_avail(info->ch);
		if (call_len > avail)
			call_len = avail;
		ret = smd_write(info->ch, firstcall, call_len);

		call_len = strlen(secondcall);
		avail = smd_write_avail(info->ch);
		if (call_len > avail)
			call_len = avail;
		ret = smd_write(info->ch, secondcall, call_len);

		call_len = strlen(thirdcall);
		avail = smd_write_avail(info->ch);
		if (call_len > avail)
			call_len = avail;
		ret = smd_write(info->ch, thirdcall, call_len);

		init=1;
	}
#endif

	avail = smd_write_avail(info->ch);
	/* if no space, we'll have to setup a notification later to wake up the
	 * tty framework when space becomes avaliable
	 */
	if (!avail) {
		smd_enable_read_intr(info->ch);
		return 0;
	}
	if (len > avail)
		len = avail;

	return smd_write(info->ch, buf, len);
}
开发者ID:NooNameR,项目名称:k3_bravo,代码行数:61,代码来源:smd_tty.c


示例11: WPAL_TRACE

wpt_uint32
WCTS_SendMessage
(
   WCTS_HandleType      wctsHandle,
   void*                pMsg,
   wpt_uint32           uLen
)
{
   WCTS_ControlBlockType*    pWCTSCb = (WCTS_ControlBlockType*) wctsHandle;
   WCTS_BufferType*          pBufferQueue;
   int                       len;
   int                       written = 0;
   int                       available;

   

   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) ||
       (NULL == pMsg) || (0 == uLen) || (0x7fffffff < uLen)) {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "WCTS_SendMessage: Invalid parameters received.");
      WPAL_ASSERT(0);
      if (NULL != pMsg) {
         wpalMemoryFree(pMsg);
      }
      return eWLAN_PAL_STATUS_E_INVAL;
   }

   
   len = (int)uLen;

   if (WCTS_STATE_OPEN == pWCTSCb->wctsState) {
      available = smd_write_avail(pWCTSCb->wctsChannel);
      if (available >= len) {
         written = smd_write(pWCTSCb->wctsChannel, pMsg, len);
      }
   } else if (WCTS_STATE_DEFERRED == pWCTSCb->wctsState) {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                 "WCTS_SendMessage: FIFO space not available, the packets will be queued");
   } else {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "WCTS_SendMessage: Channel in illegal state [%d].",
                 pWCTSCb->wctsState);
      
      written = -1;
   }

   if (-1 == written) {
      
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "WCTS_SendMessage: Failed to send message over the bus.");
      wpalMemoryFree(pMsg);
      return eWLAN_PAL_STATUS_E_FAILURE;
   } else if (written == len) {
      
      wpalMemoryFree(pMsg);
   } else {
      /* This much data cannot be written at this time,
         queue the rest of the data for later*/
      pBufferQueue = wpalMemoryAllocate(sizeof(WCTS_BufferType));
      if (NULL == pBufferQueue) {
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                    "WCTS_SendMessage: Cannot allocate memory for queuing the buffer");
         wpalMemoryFree(pMsg);
         WPAL_ASSERT(0);
         return eWLAN_PAL_STATUS_E_NOMEM;
      }

      pBufferQueue->bufferSize = len;
      pBufferQueue->pBuffer = pMsg;
      wpal_list_insert_back(&pWCTSCb->wctsPendingQueue, &pBufferQueue->node);

      if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) {

         pWCTSCb->wctsState = WCTS_STATE_DEFERRED;

         smd_enable_read_intr(pWCTSCb->wctsChannel);
      }

      
      return eWLAN_PAL_STATUS_E_RESOURCES;
   }

   return eWLAN_PAL_STATUS_SUCCESS;

}
开发者ID:Alex-V2,项目名称:One_M8_4.4.3_kernel,代码行数:85,代码来源:wlan_qct_wdi_cts.c


示例12: smd_tty_notify

static void smd_tty_notify(void *priv, unsigned event)
{
	struct smd_tty_info *info = priv;
	struct tty_struct *tty;
	unsigned long flags;

	switch (event) {
	case SMD_EVENT_DATA:
		spin_lock_irqsave(&info->reset_lock, flags);
		if (!info->is_open) {
			spin_unlock_irqrestore(&info->reset_lock, flags);
			break;
		}
		spin_unlock_irqrestore(&info->reset_lock, flags);
		/* There may be clients (tty framework) that are blocked
		 * waiting for space to write data, so if a possible read
		 * interrupt came in wake anyone waiting and disable the
		 * interrupts
		 */
		if (smd_write_avail(info->ch)) {
			smd_disable_read_intr(info->ch);
			tty = tty_port_tty_get(&info->port);
			if (tty)
				wake_up_interruptible(&tty->write_wait);
			tty_kref_put(tty);
		}
		spin_lock_irqsave(&info->ra_lock, flags);
		if (smd_read_avail(info->ch)) {
			wake_lock(&info->ra_wake_lock);
			tasklet_hi_schedule(&info->tty_tsklt);
		}
		spin_unlock_irqrestore(&info->ra_lock, flags);
		break;

	case SMD_EVENT_OPEN:
		spin_lock_irqsave(&info->reset_lock, flags);
		info->in_reset = 0;
		info->in_reset_updated = 1;
		info->is_open = 1;
		wake_up_interruptible(&info->ch_opened_wait_queue);
		spin_unlock_irqrestore(&info->reset_lock, flags);
		break;

	case SMD_EVENT_CLOSE:
		spin_lock_irqsave(&info->reset_lock, flags);
		info->in_reset = 1;
		info->in_reset_updated = 1;
		info->is_open = 0;
		wake_up_interruptible(&info->ch_opened_wait_queue);
		spin_unlock_irqrestore(&info->reset_lock, flags);
		/* schedule task to send TTY_BREAK */
		tasklet_hi_schedule(&info->tty_tsklt);

		tty = tty_port_tty_get(&info->port);
		if (tty->index == LOOPBACK_IDX)
			schedule_delayed_work(&loopback_work,
					msecs_to_jiffies(1000));
		tty_kref_put(tty);
		break;
#ifdef CONFIG_MSM_SMD_TTY_DS_LEGACY
		/*
		 * At current smd_tty framework, if smd_tty_open()
		 * is invoked by process before smd_tty_close() is
		 * completely finished, smd_tty_open() may fail
		 * because smd_tty_close() does not wait to close smd
		 * channel from modem. To fix this situation, new SMD
		 * notify status, SMD_EVENT_REOPEN_READY is used.
		 * Until smd_tty receive this status, smd_tty_close()
		 * will be wait(in fact, process will be wait).
		 */
	case SMD_EVENT_REOPEN_READY:
		/* smd channel is closed completely */
		spin_lock_irqsave(&info->reset_lock, flags);
		info->in_reset = 1;
		info->in_reset_updated = 1;
		info->is_open = 0;
		wake_up_interruptible(&info->ch_opened_wait_queue);
		spin_unlock_irqrestore(&info->reset_lock, flags);
		break;
#endif
	}
}
开发者ID:GAXUSXX,项目名称:GaXusKernel,代码行数:82,代码来源:smd_tty.c


示例13: smd_tty_write_room

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


示例14: rpcrouter_smd_loopback_write_avail

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


示例15: rpcrouter_smd_remote_write_avail

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


示例16: smd_net_data_handler


//.........这里部分代码省略.........

//ZTE_RIL_RJG_20101103 end

static DECLARE_TASKLET(smd_net_data_tasklet, smd_net_data_handler, 0);

static int _rmnet_xmit(struct sk_buff *skb, struct net_device *dev)
{
    struct rmnet_private *p = netdev_priv(dev);
    smd_channel_t *ch = p->ch;
    int smd_ret;
    struct QMI_QOS_HDR_S *qmih;
    u32 opmode;
    unsigned long flags;

    /* For QoS mode, prepend QMI header and assign flow ID from skb->mark */
    spin_lock_irqsave(&p->lock, flags);
    opmode = p->operation_mode;
    spin_unlock_irqrestore(&p->lock, flags);

    if (RMNET_IS_MODE_QOS(opmode)) {
        qmih = (struct QMI_QOS_HDR_S *)
               skb_push(skb, sizeof(struct QMI_QOS_HDR_S));
        qmih->version = 1;
        qmih->flags = 0;
        qmih->flow_id = skb->mark;
    }

    dev->trans_start = jiffies;
    smd_ret = smd_write(ch, skb->data, skb->len);
    if (smd_ret != skb->len) {
        pr_err("%s: smd_write returned error %d", __func__, smd_ret);
        goto xmit_out;
    }

    if (RMNET_IS_MODE_IP(opmode) ||
            count_this_packet(skb->data, skb->len)) {
        p->stats.tx_packets++;
        p->stats.tx_bytes += skb->len;
#ifdef CONFIG_MSM_RMNET_DEBUG
        p->wakeups_xmit += rmnet_cause_wakeup(p);
#endif
    }

xmit_out:
    /* data xmited, safe to release skb */
    dev_kfree_skb_irq(skb);
    return 0;
}

static void _rmnet_resume_flow(unsigned long param)
{
    struct net_device *dev = (struct net_device *)param;
    struct rmnet_private *p = netdev_priv(dev);
    struct sk_buff *skb = NULL;
    unsigned long flags;

    /* xmit and enable the flow only once even if
       multiple tasklets were scheduled by smd_net_notify */
    spin_lock_irqsave(&p->lock, flags);
    if (p->skb && (smd_write_avail(p->ch) >= p->skb->len)) {
        skb = p->skb;
        p->skb = NULL;
        spin_unlock_irqrestore(&p->lock, flags);
        _rmnet_xmit(skb, dev);
        netif_wake_queue(dev);
    } else
        spin_unlock_irqrestore(&p->lock, flags);
}

static void msm_rmnet_unload_modem(void *pil)
{
    if (pil)
        pil_put(pil);
}

static void *msm_rmnet_load_modem(struct net_device *dev)
{
    void *pil;
    int rc;
    struct rmnet_private *p = netdev_priv(dev);

    pil = pil_get("modem");
    if (IS_ERR(pil))
        pr_err("%s: modem load failed\n", __func__);
    else if (msm_rmnet_modem_wait) {
        rc = wait_for_completion_interruptible_timeout(
                 &p->complete,
                 msecs_to_jiffies(msm_rmnet_modem_wait * 1000));
        if (!rc)
            rc = -ETIMEDOUT;
        if (rc < 0) {
            pr_err("%s: wait for rmnet port failed %d\n",
                   __func__, rc);
            msm_rmnet_unload_modem(pil);
            pil = ERR_PTR(rc);
        }
    }

    return pil;
}
开发者ID:aniltolinux,项目名称:zte-turies-35,代码行数:101,代码来源:msm_rmnet.c


示例17: smd_tty_notify

static void smd_tty_notify(void *priv, unsigned event)
{
	struct smd_tty_info *info = priv;
	unsigned long flags;
	unsigned char *ptr;

	switch (event) {
	case SMD_EVENT_DATA:
		spin_lock_irqsave(&info->reset_lock, flags);
		if (!info->is_open) {
			spin_unlock_irqrestore(&info->reset_lock, flags);
			break;
		}
		spin_unlock_irqrestore(&info->reset_lock, flags);
		/* There may be clients (tty framework) that are blocked
		 * waiting for space to write data, so if a possible read
		 * interrupt came in wake anyone waiting and disable the
		 * interrupts
		 */
		if (smd_write_avail(info->ch)) {
			smd_disable_read_intr(info->ch);
			if (info->tty) {
				unsigned int n = info->tty->index;
				wake_up_interruptible(&info->tty->write_wait);

				/* use pm_qos for BT performance */
				if (n == BT_ACL_IDX || n == BT_CMD_IDX)
					schedule_work(&pm_qos_set_work);
			}
		}
		tasklet_hi_schedule(&info->tty_tsklt);
		break;

	case SMD_EVENT_OPEN:
		if (is_in_reset(info)) {
			unsigned int n = info->tty->index;
			if (n == BT_CMD_IDX) {
				pr_err("%s:  BT_CMD_IDX Sending hardware error event to stack\n", __func__);
				tty_prepare_flip_string(info->tty, &ptr, 0x03);
				ptr[0] = 0x10;
				ptr[1] = 0x01;
				ptr[2] = 0x0A;
				tty_flip_buffer_push(info->tty);
			}
		}
		spin_lock_irqsave(&info->reset_lock, flags);
		info->in_reset = 0;
		info->in_reset_updated = 1;
		info->is_open = 1;
		wake_up_interruptible(&info->ch_opened_wait_queue);
		spin_unlock_irqrestore(&info->reset_lock, flags);

		break;

	case SMD_EVENT_CLOSE:
		spin_lock_irqsave(&info->reset_lock, flags);
		info->in_reset = 1;
		info->in_reset_updated = 1;
		info->is_open = 0;
		wake_up_interruptible(&info->ch_opened_wait_queue);
		spin_unlock_irqrestore(&info->reset_lock, flags);
		/* schedule task to send TTY_BREAK */
		tasklet_hi_schedule(&info->tty_tsklt);

		if (info->tty->index == LOOPBACK_IDX)
			schedule_delayed_work(&loopback_work,
					msecs_to_jiffies(1000));
		break;
	}
}
开发者ID:1n,项目名称:xperia-m-source,代码行数:70,代码来源:smd_tty.c


示例18: WPAL_TRACE

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

 @param    pWCTSCb  WCTS Control Block

 @see
 @return void
*/
static void
WCTS_PALWriteCallback
(
   WCTS_ControlBlockType*  pWCTSCb
)
{
   wpt_list_node*      pNode;
   WCTS_BufferType*    pBufferQueue;
   void*               pBuffer;
   int                 len;
   int                 available;
   int                 written;

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

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

   /* if we are not deferred, then there are no pending packets */
   if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) {
      return;
   }

   /* Keep sending deferred messages as long as there is room in
      the channel.  Note that we initially peek at the head of the
      list to access the parameters for the next message; we don't
      actually remove the next message from the deferred list until
      we know the channel can handle it */
   while (eWLAN_PAL_STATUS_SUCCESS ==
          wpal_list_peek_front(&pWCTSCb->wctsPendingQueue, &pNode)) {
      pBufferQueue = container_of(pNode, WCTS_BufferType, node);
      pBuffer = pBufferQueue->pBuffer;
      len = pBufferQueue->bufferSize;

      available = smd_write_avail(pWCTSCb->wctsChannel);
      if (available < len) {
         /* channel has no room for the next packet so we are done */
         return;
      }

      /* there is room for the next message, so we can now remove
         it from the deferred message queue and send it */
      wpal_list_remove_front(&pWCTSCb->wctsPendingQueue, &pNode);

      /* note that pNode will be the same as when we peeked, so
         there is no need to update pBuffer or len */

      written = smd_write(pWCTSCb->wctsChannel, pBuffer, len);
      if (written != len) {
         /* Something went wrong */
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                    "WCTS_PALWriteCallback: channel write failure");

         /* we were unable to send the message that was at the head
            of the deferred list.  there is nothing else we can do
            other than drop it, so we will just fall through to the
            "success" processing.
            hopefully the client can recover from this since there is
            nothing else we can do here */
      }

      /* whether we had success or failure, reclaim all memory */
      wpalMemoryFree(pBuffer);
      wpalMemoryFree(pBufferQueue);

      /* we'll continue to iterate until the channel is full or all
         of the deferred messages have been sent */
   }

   /* if we've exited the loop, then we have drained the deferred queue.
      set the state to indicate we are no longer deferred, and turn off
      the remote read interrupt */
   pWCTSCb->wctsState = WCTS_STATE_OPEN;
   smd_disable_read_intr(pWCTSCb->wctsChannel);

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


示例19: smd_tty_notify

static void smd_tty_notify(void *priv, unsigned event)
{
    struct smd_tty_info *info = priv;
    unsigned long flags;

    switch (event) {
    case SMD_EVENT_DATA:
        spin_lock_irqsave(&info->reset_lock, flags);
        if (!info->is_open) {
            spin_unlock_irqrestore(&info->reset_lock, flags);
            break;
        }
        spin_unlock_irqrestore(&info->reset_lock, flags);
        /* There may be clients (tty framework) that are blocked
         * waiting for space to write data, so if a possible read
         * interrupt came in wake anyone waiting and disable the
         * interrupts
         */
        if (smd_write_avail(info->ch)) {
            smd_disable_read_intr(info->ch);
            if (info->tty)
                wake_up_interruptible(&info->tty->write_wait);
        }
        tasklet_hi_schedule(&info->tty_tsklt);
        break;

    case SMD_EVENT_OPEN:
        spin_lock_irqsave(&info->reset_lock, flags);
        info->in_reset = 0;
        info->in_reset_updated = 1;
        info->is_open = 1;
        wake_up_interruptible(&info->ch_opened_wait_queue);
        spin_unlock_irqrestore(&info->reset_lock, flags);
        break;

    case SMD_EVENT_CLOSE:
        spin_lock_irqsave(&info->reset_lock, flags);
        info->in_reset = 1;
        info->in_reset_updated = 1;
        info->is_open = 0;
        wake_up_interruptible(&info->ch_opened_wait_queue);
        spin_unlock_irqrestore(&info->reset_lock, flags);
        /* schedule task to send TTY_BREAK */
        tasklet_hi_schedule(&info->tty_tsklt);

        if (info->tty->index == LOOPBACK_IDX)
            schedule_delayed_work(&loopback_work,
                                  msecs_to_jiffies(1000));
        break;
#ifdef CONFIG_LGE_USES_SMD_DS_TTY
    /*









    */
    case SMD_EVENT_REOPEN_READY:
        /* smd channel is closed completely */
        spin_lock_irqsave(&info->reset_lock, flags);
        info->in_reset = 1;
        info->in_reset_updated = 1;
        info->is_open = 0;
        wake_up_interruptible(&info->ch_opened_wait_queue);
        spin_unlock_irqrestore(&info->reset_lock, flags);
        break;
#endif
    }
}
开发者ID:rhino889a,项目名称:Freedom-Kernel-l0,代码行数:73,代码来源:smd_tty.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ smem_get_entry函数代码示例发布时间:2022-05-30
下一篇:
C++ smd_write函数代码示例发布时间: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