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

C++ rt_memcpy函数代码示例

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

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



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

示例1: si_update_wl_collect_data

/*
 * 如果已缓存, 则更新;否则,当有空闲空间时,插入新数据;其他情况返回失败
 * */
int si_update_wl_collect_data(char *sn, union sinkinfo_ptc_ctc_st *data, rt_tick_t time_stamp)
{
	struct sinkinfo_wl_data_item_st *p;
	rt_err_t ret;

	if (NULL==sn || NULL==data) {
		printf_syn("func:%s(), param is NULL\n", __FUNCTION__);
		return FAIL;
	}

	if (NULL == sink_wl_collect_data) {
		printf_syn("func:%s(),  sink_wl_collect_data is NULL\n", __FUNCTION__);
		return FAIL;
	}

	ret = rt_sem_take(&sink_wl_data_sem, RT_WAITING_FOREVER);
	if (RT_EOK != ret) {
		printf_syn("take sink_wl_data_sem fail(%d)\n", ret);
		return SIE_FAIL;
	}

	sinki_debug_data(("func:%s(), line:%d, sn:%s\n", __FUNCTION__, __LINE__, sn));

	p = si_lookup_item_in_wl_data(sn);
	if (NULL != p) {
#if 0
		enum sink_data_dev_type_e dev_type;

		dev_type = si_get_dev_type(sn);
		if (SDDT_PT == dev_type) {
			rt_memcpy(&p->item.ptc_data, &data->ptc_data, sizeof(p->item.ptc_data));
		} else if (SDDT_PT == dev_type) {
			rt_memcpy(&p->item.ctc_data, &data->ctc_data, sizeof(p->item.ctc_data));
		} else {
			/* mark by David */
		}
#else
		rt_memcpy(&p->item, data, sizeof(p->item));
#endif
		p->time_stamp = time_stamp;
	} else {
		si_insert_item_to_wl_data(sn, data, time_stamp);
	}

	rt_sem_release(&sink_wl_data_sem);

	return SUCC;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:51,代码来源:sink-data-proc.c


示例2: rt_tetris_update_brick

static rt_err_t rt_tetris_update_brick(rt_tetris_t* thiz)
{
	int index;

	RT_ASSERT(thiz != RT_NULL);

	index = (int)(7.0 * rand()/(RAND_MAX + 1.0)); 

	rt_memcpy(thiz->brick, thiz->next_brick, 4 * sizeof(rt_uint32_t));
	rt_memcpy(thiz->next_brick, g_brick[index], 4 * sizeof(rt_uint32_t));

	/* update next brick on view */
	thiz->view->update_next_brick(thiz->view, thiz);
		
	return RT_EOK;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:16,代码来源:tetris_modal.c


示例3: framebuffer_draw_raw_hline

/* draw raw hline */
static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
	rt_uint8_t *dst;

	dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
	rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel/8));
}
开发者ID:mojingxian,项目名称:tq2440radio,代码行数:8,代码来源:framebuffer_driver.c


示例4: rt_mq_recv

rt_err_t rt_mq_recv (rt_mq_t *mq, void* buffer, rt_size_t size)
{
	rt_err_t r;
	struct rt_mq_message *msg;

	/* mq is empty */
	if (mq->entry == 0)
	{
		return -RT_ETIMEOUT;
	}

	/* get message from queue */
	msg = (struct rt_mq_message*) mq->head;

	/* move message queue head */
	mq->head = msg->next;

	/* reach queue tail, set to NULL */
	if (mq->tail == msg) mq->tail = RT_NULL;

	/* decrease message entry */
	mq->entry --;

	/* copy message */
	rt_memcpy(buffer, msg + 1, size > mq->msg_size ? (mq->msg_size) : size);

	/* put message to free list */
	msg->next = (struct rt_mq_message*)mq->free;
	mq->free = msg;

	return RT_EOK;
}
开发者ID:amsl,项目名称:RTGUI_NoOS,代码行数:32,代码来源:mq.c


示例5: miniStm32_oled_control

/***************************************************************************//**
* @brief
*   Configure OLED device
*
* @details
*
* @note
*
* @param[in] dev
*   Pointer to device descriptor
*
* @param[in] cmd
*   IIC control command
*
* @param[in] args
*   Arguments
*
* @return
*   Error code
******************************************************************************/
static rt_err_t miniStm32_oled_control(rt_device_t dev, int cmd, void *args)
{
	switch (cmd)
	{
	case RTGRAPHIC_CTRL_RECT_UPDATE:
//        miniStm32_oled_update((struct rt_device_rect_info *)args);
        oled_debug("OLED: update\n");
		break;
	case RTGRAPHIC_CTRL_POWERON:
		break;
	case RTGRAPHIC_CTRL_POWEROFF:
		break;
	case RTGRAPHIC_CTRL_GET_INFO:
	{
	    struct rt_device_graphic_info oled_info = {
            RTGRAPHIC_PIXEL_FORMAT_MONO,    // pixel_format
            1,                              // bits_per_pixel
            0,                              // reserved
            MINISTM32_OLED_WIDTH,           // width
            MINISTM32_OLED_HEIGHT,          // height
            RT_NULL                         // framebuffer
	    };
		rt_memcpy(args, &oled_info, sizeof(oled_info));
		break;
	}
	case RTGRAPHIC_CTRL_SET_MODE:
		break;
	}

	return RT_EOK;
}
开发者ID:onelife,项目名称:rt-thread,代码行数:51,代码来源:drv_oled.c


示例6: rt_stm32_eth_tx

/* transmit packet. */
rt_err_t rt_stm32_eth_tx( rt_device_t dev, struct pbuf* p)
{
	rt_err_t ret;
	struct pbuf *q;
	uint32_t l = 0;
	u8 *buffer ;
	
	if (( ret = rt_sem_take(&tx_wait, netifGUARD_BLOCK_TIME) ) == RT_EOK)
	{
		buffer =  (u8 *)(DMATxDescToSet->Buffer1Addr);
		for(q = p; q != NULL; q = q->next) 
		{
			//show_frame(q);
			rt_memcpy((u8_t*)&buffer[l], q->payload, q->len);
			l = l + q->len;
		}
		if( ETH_Prepare_Transmit_Descriptors(l) == ETH_ERROR )
			rt_kprintf("Tx Error\n");
		//rt_sem_release(xTxSemaphore);
		rt_sem_release(&tx_wait);
		//rt_kprintf("Tx packet, len = %d\n", l);
	}
	else
	{
		rt_kprintf("Tx Timeout\n");
		return ret;
	}

	/* Return SUCCESS */
	return RT_EOK;
}
开发者ID:bbw2008good,项目名称:rt-thread,代码行数:32,代码来源:stm32f2_eth.c


示例7: rt_memcpy

struct rtgui_dc *rtgui_dc_buffer_create_from_dc(struct rtgui_dc* dc)
{
    struct rtgui_dc_buffer *buffer;

    if (dc == RT_NULL)
        return RT_NULL;

    if (dc->type == RTGUI_DC_BUFFER)
    {
        struct rtgui_dc_buffer *d = (struct rtgui_dc_buffer*) dc;

        /* buffer clone */
        buffer = (struct rtgui_dc_buffer*)rtgui_dc_buffer_create_pixformat(d->pixel_format,
                                                                           d->width,
                                                                           d->height);
        if (buffer != RT_NULL)
        {
            rt_memcpy(buffer->pixel, d->pixel, d->pitch * d->height);

            return RTGUI_DC(buffer);
        }
    }

    return RT_NULL;
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:25,代码来源:dc_buffer.c


示例8: rtgui_recv_filter

rt_err_t rtgui_recv_filter(rt_uint32_t type, rtgui_event_t *event, rt_size_t event_size)
{
	rtgui_event_t *e;
    struct rtgui_app *app;

    RT_ASSERT(event != RT_NULL);
    RT_ASSERT(event_size != 0);

    app = (struct rtgui_app *)(rt_thread_self()->user_data);
    if (app == RT_NULL)
        return -RT_ERROR;

	e = (rtgui_event_t*)&app->event_buffer[0];
    while (rt_mq_recv(app->mq, e, sizeof(union rtgui_event_generic), RT_WAITING_FOREVER) == RT_EOK)
    {
        if (e->type == type)
        {
            rt_memcpy(event, e, event_size);
            return RT_EOK;
        }
        else
        {
            if (RTGUI_OBJECT(app)->event_handler != RT_NULL)
            {
                RTGUI_OBJECT(app)->event_handler(RTGUI_OBJECT(app), e);
            }
        }
    }

    return -RT_ERROR;
}
开发者ID:Cheong2K,项目名称:rt-thread,代码行数:31,代码来源:rtgui_system.c


示例9: si_insert_item_to_wl_data

/*
 * 将新数据插入到下标最小的空位置
 * */
static int si_insert_item_to_wl_data(char *sn, union sinkinfo_ptc_ctc_st *data, rt_tick_t time_stamp)
{
	int i;
	struct sinkinfo_wl_data_item_st *p;

	/* 查找是否已存储到缓冲区 */
	p = sink_wl_collect_data;
	for (i=0; i<SINKINFO_WL_DATA_ITEM_MAX_NO; ++i) {
		if ('\0' == p->pt_ct_sn[0])
			break;
		++p;
	}

	if (i < SINKINFO_WL_DATA_ITEM_MAX_NO) {
		rt_strncpy(p->pt_ct_sn, sn, sizeof(p->pt_ct_sn));
		rt_memcpy(&p->item, data, sizeof(p->item));
		p->time_stamp = time_stamp;

		sinki_debug_data(("func:%s(), inser data sn:%s\n", __FUNCTION__, sn));
	} else {
		printf_syn("func:%s(), wl-data-buffer is full\n", __FUNCTION__);
		return FAIL;
	}

	return SUCC;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:29,代码来源:sink-data-proc.c


示例10: SendNullPacket

/** 
 *  @brief This function tells firmware to send a NULL data packet.
 *  
 *  @param priv     A pointer to wlan_private structure
 *  @param flags    Trasnit Pkt Flags
 *  @return 	    n/a
 */
int SendNullPacket(WlanCard *cardinfo, struct pbuf *packet, u8 flags)
{
	WlanCard *card = cardinfo;
	TxPD txpd;
	int ret = WLAN_STATUS_SUCCESS;
	u8 *ptr = card->TmpTxBuf;

	if (card->MediaConnectStatus == WlanMediaStateDisconnected)
	{
		ret = WLAN_STATUS_FAILURE;
		WlanDebug(WlanErr,"NULL packet wlan did not connect\r\n");
		goto done;
	}

	rt_memset(&txpd, 0, sizeof(TxPD));

	txpd.TxControl = card->PktTxCtrl;
	txpd.Flags = flags;
	txpd.Priority = WMM_HIGHEST_PRIORITY;
	txpd.TxPacketLocation = sizeof(TxPD);

	rt_memcpy(ptr, &txpd, sizeof(TxPD));

	ret = sbi_host_to_card(card, MVMS_DAT, card->TmpTxBuf, sizeof(TxPD));

	if (ret != 0)
	{
		WlanDebug(WlanErr,"TX Error: SendNullPacket failed!\n");
		goto done;
	}
	WlanDebug(WlanMsg,"Null data => FW\n");

done:
	return ret;
}
开发者ID:wanghuaiyu,项目名称:one,代码行数:42,代码来源:wlan_tx.c


示例11: wlan_get_Mac_Address

int wlan_get_Mac_Address(WlanCard *cardinfo)
{

	WlanCard *card = cardinfo;
	HostCmd_DS_COMMAND *CmdPtr = NULL;
	HostCmd_DS_GET_HW_SPEC *hwspec;
	int ret = WLAN_STATUS_SUCCESS;

	rt_memset(card->MyMacAddress, 0xff, MRVDRV_ETH_ADDR_LEN);
	CmdPtr = rt_malloc(sizeof(HostCmd_DS_COMMAND));
	if (CmdPtr == NULL)
	{
		WlanDebug(WlanErr,"memory allocate failed for Get Mac\r\n");
		return WLAN_STATUS_FAILURE;

	}
	/* Set sequence number, command and INT option */
	card->SeqNum++;
	CmdPtr->SeqNum = card->SeqNum;
	CmdPtr->Command = HostCmd_CMD_GET_HW_SPEC;
	CmdPtr->Result = 0;
	hwspec = &CmdPtr->params.hwspec;
	CmdPtr->Size = sizeof(HostCmd_DS_GET_HW_SPEC) + S_DS_GEN;
	rt_memcpy(hwspec->PermanentAddr, card->MyMacAddress, MRVDRV_ETH_ADDR_LEN);

	ret = WlanExecuteCommand(cardinfo, CmdPtr);

	if (ret)
	{
		WlanDebug(WlanErr,"Falure for Get Mac\r\n");
		ret = WLAN_STATUS_FAILURE;
	}
	rt_free(CmdPtr);
	return ret;
}
开发者ID:lynx19890808,项目名称:LynxFlyOpen,代码行数:35,代码来源:wlan_cmd.c


示例12: si_get_item_in_wl_data

int si_get_item_in_wl_data(char *sn, union sinkinfo_ptc_ctc_st *item, rt_tick_t *time_stamp)
{
	rt_err_t sem_ret;
	struct sinkinfo_wl_data_item_st *p;
	int ret = SUCC;

	if (NULL==sn || NULL==item || NULL==time_stamp) {
		printf_syn("func:%s(), param is NULL\n", __FUNCTION__);
		return FAIL;
	}

	sem_ret = rt_sem_take(&sink_wl_data_sem, RT_WAITING_FOREVER);
	if (RT_EOK != sem_ret) {
		printf_syn("take sink_wl_data_sem fail(%d)\n", ret);
		return FAIL;
	}

	p = si_lookup_item_in_wl_data(sn);
	if (NULL == p) {
		ret = FAIL;
	} else {
		rt_memcpy(item, &p->item, sizeof(*item));
		*time_stamp = p->time_stamp;
	}

	rt_sem_release(&sink_wl_data_sem);

	return ret;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:29,代码来源:sink-data-proc.c


示例13: rt_dram_write

static rt_size_t rt_dram_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{
    uint8_t *p;
    p = (uint8_t*)((uint32_t)DRAMStartAddr + pos * RAM_SECTOR_SIZE);
    rt_memcpy(p, buffer, size * RAM_SECTOR_SIZE);

	return size;
}
开发者ID:jeenter,项目名称:CH-K-Lib,代码行数:8,代码来源:drv_ram_disk.c


示例14: make_int32

int make_int32(char* ptr)
{
	int ret = 0;
	int temp = 0;//(short)*ptr;
	rt_memcpy((char*)&temp,(char*)ptr,4);
	ret = (int)ntohl((u_int)temp);
	return ret;
}
开发者ID:SH-WHJ,项目名称:rau-platform,代码行数:8,代码来源:clientDataProc.c


示例15: make_int16

short make_int16(char* ptr)
{
	short ret = 0;
	short temp = 0;//(short)*ptr;
	rt_memcpy((char*)&temp,(char*)ptr,2);
	ret = (short)ntohs((u_short)temp);
	return ret;
}
开发者ID:SH-WHJ,项目名称:rau-platform,代码行数:8,代码来源:clientDataProc.c


示例16: getForwardReply

int getForwardReply(int index,char* from, char* to,char* msg,int msgLen,send_data_t* sptr)
{
	int len=0,dlen=0;
	char* p=NULL;
	//dlen = 2*MAX_NAME_LEN+strlen(fdReplyStr)+msgLen;
	dlen = 2*MAX_NAME_LEN+msgLen;
	len = 1+2+2+4+4+1+dlen;
	
	if((len>sptr->data_len) || sptr->data_ptr==NULL)
	{
		p = (char*)rt_malloc(len);
		if(p==NULL)
		{
			return -1;
		}
		sptr->data_ptr = p;
		sptr->data_len = len;

		rt_memset(p,0,len);
	}
	else 
	{
		p = sptr->data_ptr;
		rt_memset(p,0,sptr->data_len);
	}
	
	*p = 0x02;
	p++;
	make_net16(p,0x0001);
	p+=2;
	make_net16(p,0x0004);
	p+=2;

	make_net32(p,index);
	p+=4;

	make_net32(p,dlen);
	p+=4;

	strcpy(p,to);
	p+=MAX_NAME_LEN;

	strcpy(p,from);
	p+=MAX_NAME_LEN;

/*	strcpy(p,fdReplyStr);
	p+=strlen(fdReplyStr);
*/
//	strcpy(p,msg);
	rt_memcpy(p,msg,msgLen);
	p+=msgLen;

	*p = 0x03;

	return len;
}
开发者ID:SH-WHJ,项目名称:rau-platform,代码行数:56,代码来源:clientDataProc.c


示例17: rt_strlen

/**
 * This function will duplicate a string.
 *
 * @param s the string to be duplicated
 *
 * @return the duplicated string pointer
 */
char *rt_strdup(const char *s)
{
	rt_size_t len = rt_strlen(s) + 1;
	char *tmp = (char *)rt_malloc(len);

	if (!tmp) return RT_NULL;

	rt_memcpy(tmp, s, len);
	return tmp;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:17,代码来源:kservice.c


示例18: framebuffer_draw_raw_hline

/* draw raw hline */
static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
    struct rtgui_graphic_driver *drv;
    rt_uint8_t *dst;

    drv = rtgui_graphic_get_device();
    dst = GET_PIXEL(drv, x1, y, rt_uint8_t);
    rt_memcpy(dst, pixels,
              (x2 - x1) * _UI_BITBYTES(drv->bits_per_pixel));
}
开发者ID:Cheong2K,项目名称:rt-thread,代码行数:11,代码来源:rtgui_driver.c


示例19: app_getGUID

void app_getGUID(void)
{
	unsigned int inparam[4]={54,0};
	unsigned int outparam[8]={0};
	iap_entry = (IAP)IAP_LOCATION;
	iap_entry(inparam,outparam);
	inparam[0]=58;
	iap_entry(inparam,outparam);
	rt_memcpy(devguid,outparam+1,sizeof(devguid));
}
开发者ID:aspirefhaha,项目名称:smartcontroller_rtthread,代码行数:10,代码来源:startup.c


示例20: rt_mq_recv

rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeout)
{
	rt_err_t r;
	struct rt_mq_message *msg;

	SDL_SemWait(hmq->mutex);

	/* mq is empty */
	if (mq->entry == 0)
	{
		SDL_SemPost(hmq->mutex);

		if (timeout == RT_WAITING_FOREVER)
		{
			r = SDL_SemWait(hmq->msg);
		}
		else
		{
			r = SDL_SemWaitTimeout(hmq->msg, timeout * 10);
		}

		if (r != 0) return -RT_ERROR;

		SDL_SemWait(hmq->mutex);
	}
	else
	{
		/* take one message */
		SDL_SemWait(hmq->msg);
	}

	/* get message from queue */
	msg = (struct rt_mq_message*) mq->msg_queue_head;

	/* move message queue head */
	mq->msg_queue_head = msg->next;

	/* reach queue tail, set to NULL */
	if (mq->msg_queue_tail == msg) mq->msg_queue_tail = RT_NULL;

	/* copy message */
	rt_memcpy(buffer, msg + 1,
		size > mq->msg_size? (unsigned short)(mq->msg_size) : (unsigned short)size);

	/* put message to free list */
	msg->next = (struct rt_mq_message*)mq->msg_queue_free;
	mq->msg_queue_free = msg;

	/* decrease message entry */
	mq->entry --;

	SDL_SemPost(hmq->mutex);

	return RT_EOK;
}
开发者ID:sharpglasses,项目名称:ServerSkeleton,代码行数:55,代码来源:mq.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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