当前位置: 首页>>代码示例>>C++>>正文


C++ IS_VALID_CARD函数代码示例

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


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

示例1: setup_buffers

int setup_buffers(int card, int c)
{
	unsigned int nBuffers, i, cBase;
	unsigned int buffer_size;
	LLData	RcvBuffOffset;

	if(!IS_VALID_CARD(card)) {
		pr_debug("invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	/*
	 * Calculate the buffer offsets (send/recv/send/recv)
	 */
	pr_debug("%s: setting up channel buffer space in shared RAM\n",
			sc_adapter[card]->devicename);
	buffer_size = BUFFER_SIZE;
	nBuffers = ((sc_adapter[card]->ramsize - BUFFER_BASE) / buffer_size) / 2;
	nBuffers = nBuffers > BUFFERS_MAX ? BUFFERS_MAX : nBuffers;
	pr_debug("%s: calculating buffer space: %d buffers, %d big\n",
		sc_adapter[card]->devicename,
		nBuffers, buffer_size);
	if(nBuffers < 2) {
		pr_debug("%s: not enough buffer space\n",
			sc_adapter[card]->devicename);
		return -1;
	}
	cBase = (nBuffers * buffer_size) * (c - 1);
	pr_debug("%s: channel buffer offset from shared RAM: 0x%x\n",
			sc_adapter[card]->devicename, cBase);
	sc_adapter[card]->channel[c-1].first_sendbuf = BUFFER_BASE + cBase;
	sc_adapter[card]->channel[c-1].num_sendbufs = nBuffers / 2;
	sc_adapter[card]->channel[c-1].free_sendbufs = nBuffers / 2;
	sc_adapter[card]->channel[c-1].next_sendbuf = 0;
	pr_debug("%s: send buffer setup complete: first=0x%x n=%d f=%d, nxt=%d\n",
				sc_adapter[card]->devicename,
				sc_adapter[card]->channel[c-1].first_sendbuf,
				sc_adapter[card]->channel[c-1].num_sendbufs,
				sc_adapter[card]->channel[c-1].free_sendbufs,
				sc_adapter[card]->channel[c-1].next_sendbuf);

	/*
	 * Prep the receive buffers
	 */
	pr_debug("%s: adding %d RecvBuffers:\n",
			sc_adapter[card]->devicename, nBuffers /2);
	for (i = 0 ; i < nBuffers / 2; i++) {
		RcvBuffOffset.buff_offset = 
			((sc_adapter[card]->channel[c-1].first_sendbuf +
			(nBuffers / 2) * buffer_size) + (buffer_size * i));
		RcvBuffOffset.msg_len = buffer_size;
		pr_debug("%s: adding RcvBuffer #%d offset=0x%x sz=%d bufsz:%d\n",
				sc_adapter[card]->devicename,
				i + 1, RcvBuffOffset.buff_offset, 
				RcvBuffOffset.msg_len,buffer_size);
		sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead,
				c, sizeof(LLData), (unsigned int *)&RcvBuffOffset);
	} 
	return 0;
}
开发者ID:chm088,项目名称:linux-2.6.18,代码行数:60,代码来源:packet.c

示例2: memcpy_toshmem

void memcpy_toshmem(int card, void *dest, const void *src, size_t n)
{
	unsigned long flags;
	unsigned char ch;
	unsigned long dest_rem = ((unsigned long) dest) % 0x4000;

	if (!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return;
	}

	if (n > SRAM_PAGESIZE)
		return;

	/*
	 * determine the page to load from the address
	 */
	ch = (unsigned long) dest / SRAM_PAGESIZE;
	pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename,ch);
	/*
	 * Block interrupts and load the page
	 */
	spin_lock_irqsave(&sc_adapter[card]->lock, flags);

	outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80,
		sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]);
	memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n);
	spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
	pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename,
		((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80);
	pr_debug("%s: copying %zu bytes from %#lx to %#lx\n",
		sc_adapter[card]->devicename, n,
		(unsigned long) src,
		sc_adapter[card]->rambase + ((unsigned long) dest %0x4000));
}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:35,代码来源:shmem.c

示例3: memset_shmem

void memset_shmem(int card, void *dest, int c, size_t n)
{
	unsigned long flags;
	unsigned char ch;

	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return;
	}

	if(n > SRAM_PAGESIZE) {
		return;
	}

	/*
	 * determine the page to load from the address
	 */
	ch = (unsigned long) dest / SRAM_PAGESIZE;
	pr_debug("%s: loaded page %d\n",sc_adapter[card]->devicename,ch);

	/*
	 * Block interrupts and load the page
	 */
	spin_lock_irqsave(&sc_adapter[card]->lock, flags);

	outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80,
		sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]);
	memset_io(sc_adapter[card]->rambase +
		((unsigned long) dest % 0x4000), c, n);
	pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename,
		((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80);
	spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.0.10mp5_OpenSrc,代码行数:33,代码来源:shmem.c

示例4: reset

int reset(int card)
{
	unsigned long flags;

	if (!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	indicate_status(card, ISDN_STAT_STOP, 0, NULL);

	if (sc_adapter[card]->EngineUp) {
		del_timer(&sc_adapter[card]->stat_timer);
	}

	sc_adapter[card]->EngineUp = 0;

	spin_lock_irqsave(&sc_adapter[card]->lock, flags);
	init_timer(&sc_adapter[card]->reset_timer);
	sc_adapter[card]->reset_timer.function = sc_check_reset;
	sc_adapter[card]->reset_timer.data = card;
	sc_adapter[card]->reset_timer.expires = jiffies + CHECKRESET_TIME;
	add_timer(&sc_adapter[card]->reset_timer);
	spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);

	outb(0x1, sc_adapter[card]->ioport[SFT_RESET]);

	pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename);
	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:30,代码来源:command.c

示例5: setl2

/*
 * Set the layer 2 protocol (X.25, HDLC, Raw)
 */
static int setl2(int card, unsigned long arg)
{
	int status = 0;
	int protocol, channel;

	if (!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}
	protocol = arg >> 8;
	channel = arg & 0xff;
	sc_adapter[card]->channel[channel].l2_proto = protocol;

	/*
	 * check that the adapter is also set to the correct protocol
	 */
	pr_debug("%s: Sending GetFrameFormat for channel %d\n",
		 sc_adapter[card]->devicename, channel + 1);
	status = sendmessage(card, CEPID, ceReqTypeCall,
			     ceReqClass0,
			     ceReqCallGetFrameFormat,
			     (unsigned char)channel + 1,
			     1,
			     (unsigned int *)protocol);
	if (status)
		return status;
	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:31,代码来源:command.c

示例6: dial

/*
 * Dials the number passed in
 */
static int dial(int card, unsigned long channel, setup_parm setup)
{
	int status;
	char Phone[48];

	if (!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	/*extract ISDN number to dial from eaz/msn string*/
	strcpy(Phone, setup.phone);

	/*send the connection message*/
	status = sendmessage(card, CEPID, ceReqTypePhy,
			     ceReqClass1,
			     ceReqPhyConnect,
			     (unsigned char)channel + 1,
			     strlen(Phone),
			     (unsigned int *)Phone);

	pr_debug("%s: Dialing %s on channel %lu\n",
		 sc_adapter[card]->devicename, Phone, channel + 1);

	return status;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:29,代码来源:command.c

示例7: getl3

/*
 * Get the layer 3 protocol
 */
int getl3(int card, unsigned long arg) 
{
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	pr_debug("%s: Level 3 protocol for channel %d reported as %s\n",
			adapter[card]->devicename, arg+1,
			l3protos[adapter[card]->channel[arg].l3_proto]);
	return adapter[card]->channel[arg].l3_proto;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:15,代码来源:command.c

示例8: setl3

/*
 * Set the layer 3 protocol
 */
static int setl3(int card, unsigned long channel)
{
	int protocol = channel >> 8;

	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	sc_adapter[card]->channel[channel].l3_proto = protocol;
	return 0;
}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:15,代码来源:command.c

示例9: command

int command(isdn_ctrl *cmd)
{
	int card;

	card = get_card_from_id(cmd->driver);
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	pr_debug("%s: Received %s command from Link Layer\n",
		sc_adapter[card]->devicename, commands[cmd->command]);

	/*
	 * Dispatch the command
	 */
	switch(cmd->command) {
	case ISDN_CMD_IOCTL:
	{
		unsigned long 	cmdptr;
		scs_ioctl	ioc;

		memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long));
		if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr,
				   sizeof(scs_ioctl))) {
			pr_debug("%s: Failed to verify user space 0x%x\n",
				sc_adapter[card]->devicename, cmdptr);
			return -EFAULT;
		}
		return sc_ioctl(card, &ioc);
	}
	case ISDN_CMD_DIAL:
		return dial(card, cmd->arg, cmd->parm.setup);
	case ISDN_CMD_HANGUP:
		return hangup(card, cmd->arg);
	case ISDN_CMD_ACCEPTD:
		return answer(card, cmd->arg);
	case ISDN_CMD_ACCEPTB:
		return acceptb(card, cmd->arg);
	case ISDN_CMD_CLREAZ:
		return clreaz(card, cmd->arg);
	case ISDN_CMD_SETEAZ:
		return seteaz(card, cmd->arg, cmd->parm.num);
	case ISDN_CMD_SETL2:
		return setl2(card, cmd->arg);
	case ISDN_CMD_SETL3:
		return setl3(card, cmd->arg);
	default:
		return -EINVAL;
	}
	return 0;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:52,代码来源:command.c

示例10: clreaz

static int clreaz(int card, unsigned long arg)
{
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	strcpy(sc_adapter[card]->channel[arg].eazlist, "");
	sc_adapter[card]->channel[arg].eazclear = 1;
	pr_debug("%s: EAZ List cleared for channel %lu\n",
		sc_adapter[card]->devicename, arg+1);
	return 0;
}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:13,代码来源:command.c

示例11: getsil

int getsil(int card, unsigned long arg, char *num)
{
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	strcpy(num, adapter[card]->channel[arg].sillist);
	pr_debug("%s: SIL for channel %d reported: %s\n",
		adapter[card]->devicename, arg+1,
		adapter[card]->channel[arg].sillist);
	return 0;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:13,代码来源:command.c

示例12: setsil

int setsil(int card, unsigned long arg, char *num)
{
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	strcpy(adapter[card]->channel[arg].sillist, num);
	pr_debug("%s: Service Indicators for channel %d set: %s\n",
		adapter[card]->devicename, arg+1,
		adapter[card]->channel[arg].sillist);
	return 0;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:13,代码来源:command.c

示例13: rcvpkt

void rcvpkt(int card, RspMessage *rcvmsg)
{
	LLData newll;
	struct sk_buff *skb;

	if(!IS_VALID_CARD(card)) {
		pr_debug("invalid param: %d is not a valid card id\n", card);
		return;
	}

	switch(rcvmsg->rsp_status){
	case 0x01:
	case 0x02:
	case 0x70:
		pr_debug("%s: error status code: 0x%x\n",
			sc_adapter[card]->devicename, rcvmsg->rsp_status);
		return;
	case 0x00: 
	    if (!(skb = dev_alloc_skb(rcvmsg->msg_data.response.msg_len))) {
			printk(KERN_WARNING "%s: rcvpkt out of memory, dropping packet\n",
				sc_adapter[card]->devicename);
			return;
		}
		skb_put(skb, rcvmsg->msg_data.response.msg_len);
		pr_debug("%s: getting data from offset: 0x%x\n",
			sc_adapter[card]->devicename,
			rcvmsg->msg_data.response.buff_offset);
		memcpy_fromshmem(card,
			skb_put(skb, rcvmsg->msg_data.response.msg_len),
		 	(char *)rcvmsg->msg_data.response.buff_offset,
			rcvmsg->msg_data.response.msg_len);
		sc_adapter[card]->card->rcvcallb_skb(sc_adapter[card]->driverId,
			rcvmsg->phy_link_no-1, skb);

	case 0x03:
		/*
	 	 * Recycle the buffer
	 	 */
		pr_debug("%s: buffer size : %d\n",
				sc_adapter[card]->devicename, BUFFER_SIZE);
/*		memset_shmem(card, rcvmsg->msg_data.response.buff_offset, 0, BUFFER_SIZE); */
		newll.buff_offset = rcvmsg->msg_data.response.buff_offset;
		newll.msg_len = BUFFER_SIZE;
		pr_debug("%s: recycled buffer at offset 0x%x size %d\n",
			sc_adapter[card]->devicename,
			newll.buff_offset, newll.msg_len);
		sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead,
			rcvmsg->phy_link_no, sizeof(LLData), (unsigned int *)&newll);
	}

}
开发者ID:chm088,项目名称:linux-2.6.18,代码行数:51,代码来源:packet.c

示例14: setl3

/*
 * Set the layer 3 protocol
 */
int setl3(int card, unsigned long channel) 
{
	int protocol = channel >> 8;

	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	adapter[card]->channel[channel].l3_proto = protocol;
	pr_debug("%s: Level 3 protocol for channel %d set to %s\n",
		adapter[card]->devicename, channel+1, l3protos[protocol]);
	return 0;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:17,代码来源:command.c

示例15: seteaz

static int seteaz(int card, unsigned long arg, char *num)
{
	if(!IS_VALID_CARD(card)) {
		pr_debug("Invalid param: %d is not a valid card id\n", card);
		return -ENODEV;
	}

	strcpy(sc_adapter[card]->channel[arg].eazlist, num);
	sc_adapter[card]->channel[arg].eazclear = 0;
	pr_debug("%s: EAZ list for channel %lu set to: %s\n",
		sc_adapter[card]->devicename, arg+1,
		sc_adapter[card]->channel[arg].eazlist);
	return 0;
}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:14,代码来源:command.c


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