您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DBG_MSG函数代码示例

51自学网 2021-06-01 20:18:17
  C++
这篇教程C++ DBG_MSG函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CHECK

//------------------------------------------------------------------------------//!voidBIH::create(   const Vector<AABBoxf*>& bboxes,   const Vector<Vec3f>&    centers,   Vector<uint>*           ids,   uint                    leafSize,   uint                    maxDepth){   CHECK( bboxes.size() == centers.size() );   DBG_BLOCK( os_bih, "Start computing BIH..." );   DBG( Timer timer );   // Initialization.   DBG_MSG( os_bih, "# of elements: " << bboxes.size() << " " << centers.size() << "/n" );   // 1. Init maximum recursion level.   if( maxDepth == 0 )   {      maxDepth = (int)CGM::log2( float(centers.size()) ) * 2 + 1;   }   _maxDepth = CGM::min( maxDepth, (uint)100 );   // 2. Init ids.   if( ids == 0 )   {      _ids.resize( centers.size() );      for( uint i = 0; i < _ids.size(); ++i )      {         _ids[i] = i;      }   }   else   {      _ids.swap( *ids );   }      Vector<uint>  remap( centers.size() );   for( uint i = 0; i < remap.size(); ++i )   {      remap[i] = i;   }   // 3. Init nodes and root.   //_nodes.reserve();   _nodes.resize(1);   // 4. Compute bounding box.   AABBoxf nodeBox  = AABBoxf::empty();   for( uint i = 0; i < bboxes.size(); ++i )   {      nodeBox |= *bboxes[i];   }   AABBoxf splitBox = nodeBox;   // 5. Stack.   Vector<BuildStackNode> stack( maxDepth );   uint stackID = 0;   uint maxPrim = 0;   uint maxD = 0;   // Construct BIH.   uint begin = 0;   uint end   = uint(_ids.size());   uint depth = 1;   uint node  = 0;   while( 1 )   {      // Do we have a root node?      if( (end - begin <= leafSize) || depth >= maxDepth )      {         // Root node.         _nodes[node]._index = (begin << 3) + 3;         _nodes[node]._numElements = end-begin;         maxPrim = CGM::max( maxPrim, end-begin );         maxD = CGM::max( maxD, depth );         // Are we done?         if( stackID == 0 )         {            break;         }         stack[--stackID].get( node, begin, end, depth, nodeBox, splitBox );      }      else      {         // Compute split plane and axis.         uint axis        = splitBox.longestSide();         float splitPlane = splitBox.center( axis );         // Partition primitives.         AABBoxf leftNodeBox  = AABBoxf::empty();         AABBoxf rightNodeBox = AABBoxf::empty();         uint pivot = begin;         for( uint i = begin; i < end; ++i )         {//.........这里部分代码省略.........
开发者ID:LudoSapiens,项目名称:Dev,代码行数:101,


示例2: vGet8FootnotesText

/* * Build the list with footnote text information for Word 8/9/10 files */static voidvGet8FootnotesText(FILE *pFile, const pps_info_type *pPPS,	const ULONG *aulBBD, size_t tBBDLen,	const ULONG *aulSBD, size_t tSBDLen,	const UCHAR *aucHeader){	footnote_local_type	*pCurr;	const ULONG	*aulBlockDepot;	UCHAR	*aucBuffer;	ULONG	ulCharPos, ulBeginOfFootnotes, ulOffset, ulBeginFootnoteText;	size_t	tFootnoteTextLen, tBlockDepotLen, tBlockSize;	size_t	tIndex;	TRACE_MSG("vGet8FootnotesText");	ulBeginOfFootnotes = ulGetLong(0x18, aucHeader); /* fcMin */	ulBeginOfFootnotes += ulGetLong(0x4c, aucHeader); /* ccpText */	NO_DBG_HEX(ulBeginOfFootnotes);	ulBeginFootnoteText = ulGetLong(0xb2, aucHeader); /* fcPlcffndTxt */	NO_DBG_HEX(ulBeginFootnoteText);	tFootnoteTextLen =		(size_t)ulGetLong(0xb6, aucHeader); /* lcbPlcffndTxt */	NO_DBG_DEC(tFootnoteTextLen);	if (tFootnoteTextLen < 12) {		DBG_MSG("No Footnote text in this document");		return;	}	NO_DBG_DEC(pPPS->tTable.ulSB);	NO_DBG_HEX(pPPS->tTable.ulSize);	if (pPPS->tTable.ulSize == 0) {		DBG_MSG("No footnote text information");		return;	}	if (pPPS->tTable.ulSize < MIN_SIZE_FOR_BBD_USE) {	  	/* Use the Small Block Depot */		aulBlockDepot = aulSBD;		tBlockDepotLen = tSBDLen;		tBlockSize = SMALL_BLOCK_SIZE;	} else {	  	/* Use the Big Block Depot */		aulBlockDepot = aulBBD;		tBlockDepotLen = tBBDLen;		tBlockSize = BIG_BLOCK_SIZE;	}	aucBuffer = xmalloc(tFootnoteTextLen);	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,			aulBlockDepot, tBlockDepotLen, tBlockSize,			aucBuffer, ulBeginFootnoteText, tFootnoteTextLen)) {		aucBuffer = xfree(aucBuffer);		return;	}	NO_DBG_PRINT_BLOCK(aucBuffer, tFootnoteTextLen);	fail(tFootnoteTextLength != 0);	tFootnoteTextLength = tFootnoteTextLen / 4 - 2;	fail(tFootnoteTextLength == 0);	fail(pFootnoteText != NULL);	pFootnoteText = xcalloc(tFootnoteTextLength,				sizeof(footnote_local_type));	for (tIndex = 0; tIndex < tFootnoteTextLength; tIndex++) {		pCurr = pFootnoteText + tIndex;		pCurr->tInfo.szText = NULL;		ulOffset = ulGetLong(tIndex * 4, aucBuffer);		NO_DBG_HEX(ulOffset);		ulCharPos = ulBeginOfFootnotes + ulOffset;		NO_DBG_HEX(ulCharPos);		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosStart = ulCharPos;		ulOffset = ulGetLong(tIndex * 4 + 4, aucBuffer);		NO_DBG_HEX(ulOffset);		ulCharPos = ulBeginOfFootnotes + ulOffset;		NO_DBG_HEX(ulCharPos);		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosNext = ulCharPos;		pCurr->bUseful = pCurr->ulCharPosStart != pCurr->ulCharPosNext;	}	aucBuffer = xfree(aucBuffer);} /* end of vGet8FootnotesText */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:87,


示例3: vGet8EndnotesInfo

/* * Build the list with endnote information for Word 8/9/10 files */static voidvGet8EndnotesInfo(FILE *pFile, const pps_info_type *pPPS,	const ULONG *aulBBD, size_t tBBDLen,	const ULONG *aulSBD, size_t tSBDLen,	const UCHAR *aucHeader){	const ULONG	*aulBlockDepot;	UCHAR	*aucBuffer;	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginEndnoteInfo;	size_t	tEndnoteInfoLen, tBlockDepotLen, tBlockSize;	size_t	tIndex;	TRACE_MSG("vGet8EndnotesInfo");	ulBeginOfText = ulGetLong(0x18, aucHeader); /* fcMin */	NO_DBG_HEX(ulBeginOfText);	ulBeginEndnoteInfo = ulGetLong(0x20a, aucHeader); /* fcPlcfendRef */	NO_DBG_HEX(ulBeginEndnoteInfo);	tEndnoteInfoLen = (size_t)ulGetLong(0x20e, aucHeader); /* lcbPlcfendRef */	NO_DBG_DEC(tEndnoteInfoLen);	if (tEndnoteInfoLen < 10) {		DBG_MSG("No endnotes in this document");		return;	}	NO_DBG_DEC(pPPS->tTable.ulSB);	NO_DBG_HEX(pPPS->tTable.ulSize);	if (pPPS->tTable.ulSize == 0) {		DBG_MSG("No endnotes information");		return;	}	if (pPPS->tTable.ulSize < MIN_SIZE_FOR_BBD_USE) {	  	/* Use the Small Block Depot */		aulBlockDepot = aulSBD;		tBlockDepotLen = tSBDLen;		tBlockSize = SMALL_BLOCK_SIZE;	} else {	  	/* Use the Big Block Depot */		aulBlockDepot = aulBBD;		tBlockDepotLen = tBBDLen;		tBlockSize = BIG_BLOCK_SIZE;	}	aucBuffer = xmalloc(tEndnoteInfoLen);	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,			aulBlockDepot, tBlockDepotLen, tBlockSize,			aucBuffer, ulBeginEndnoteInfo, tEndnoteInfoLen)) {		aucBuffer = xfree(aucBuffer);		return;	}	NO_DBG_PRINT_BLOCK(aucBuffer, tEndnoteInfoLen);	fail(tEndnoteListLength != 0);	tEndnoteListLength = (tEndnoteInfoLen - 4) / 6;	fail(tEndnoteListLength == 0);	fail(aulEndnoteList != NULL);	aulEndnoteList = xcalloc(tEndnoteListLength, sizeof(ULONG));	for (tIndex = 0; tIndex < tEndnoteListLength; tIndex++) {		ulOffset = ulGetLong(tIndex * 4, aucBuffer);		NO_DBG_HEX(ulOffset);		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);		NO_DBG_HEX(ulFileOffset);		aulEndnoteList[tIndex] = ulFileOffset;	}	aucBuffer = xfree(aucBuffer);} /* end of vGet8EndnotesInfo */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:72,


示例4: Lens_Init

INT32 Lens_Init(LENS_INIT_STATE part){    INT32 ERROR_STATUS;    switch(part)    {        case LENS_INIT_ZOOM_PART1:            //Step 1. Initiate zoom part1            DBG_MSG("Start of LENS_INIT_ZOOM_PART1/r/n");            //Callback function            //TM_Begin(LENS_ZOOM_INIT);            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITZOOM1_START, NULL);            }            gLensCtrlObj.pLens->zoom_initPart1();            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITZOOM1_END, NULL);            }            Lens_Module_SetState(LENS_STATE_INIT_PART1);            DBG_MSG("End of LENS_STATE_INIT_PART1/r/n");    // --> LENS_STATE_INIT_PART1            return ERR_OK;        case LENS_INIT_ZOOM_PART2:            //Step 2. Initiate zoom part2            DBG_MSG("Start of LENS_INIT_ZOOM_PART2/r/n");            //TM_Begin(LENS_ZOOM_INITWAIT);            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITZOOM2_START, NULL);            }            ERROR_STATUS = gLensCtrlObj.pLens->zoom_initPart2();            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITZOOM2_END, NULL);            }            //TM_End(LENS_ZOOM_INITWAIT);            DBG_MSG("End of LENS_INIT_ZOOM_PART2/r/n");            return ERROR_STATUS;        case LENS_INIT_APERTURE:            //Step 3. Initiate aperture            DBG_MSG("Start of LENS_INIT_APERTURE/r/n");            //TM_Begin(LENS_APER_INIT);            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITAPERTURE_START, NULL);            }            gLensCtrlObj.pLens->aperture_init();            //#NT#2010/09/23#Jeffery Chuang -begin            //Add shutter init here until add new api            gLensCtrlObj.pMotor->shutter_setState(MOTOR_SHUTTER_NORMAL,OPEN);            //#NT#2010/09/23#Jeffery Chuang -end            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITAPERTURE_END, NULL);            }            //TM_End(LENS_APER_INIT);            DBG_MSG("End of LENS_INIT_APERTURE/r/n");            return ERR_OK;        case LENS_INIT_FOCUS:            //TM_Begin(LENS_FOCUS_INIT);            DBG_MSG("Start of LENS_INIT_FOCUS/r/n");            //Callback function            if(gLensCtrlObj.APICB!=NULL)            {                gLensCtrlObj.APICB(LENS_CB_INITFOCUS_START, NULL);            }            #if 1 // Could be migrated to other place in the near future.            {                PPSTORE_SECTION_HANDLE  pSection;                INT16 iTmpIdx[15] = {0};                UINT32 uiCalTblSize = Lens_Zoom_GetSection(ZOOM_MAX_SECTION)/* Table size of DemoKit is '11'. */, i;                if(sizeof(iTmpIdx) >= uiCalTblSize)                {                    if ((pSection = PStore_OpenSection(PS_FOCUS_DATA, PS_RDWR)) != E_PS_SECHDLER)//.........这里部分代码省略.........
开发者ID:github188,项目名称:NT9665X_GMD_V18,代码行数:101,


示例5: vGet1FontInfo

/* * Fill the font information block with information * from a WinWord 1 file. */voidvGet1FontInfo(int iFodo,	const UCHAR *aucGrpprl, size_t tBytes, font_block_type *pFont){	BOOL	bIcoChange, bFtcChange, bHpsChange, bKulChange;	USHORT	usTmp;	UCHAR	ucTmp;	UCHAR	aucChpx[12];	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);	if (tBytes > sizeof(aucChpx)) {		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);		return;	}	/* Build the CHPX structure */	(void)memset(aucChpx, 0, sizeof(aucChpx));	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));	usTmp = usGetWord(0, aucChpx);	if ((usTmp & BIT(0)) != 0) {		pFont->usFontStyle ^= FONT_BOLD;	}	if ((usTmp & BIT(1)) != 0) {		pFont->usFontStyle ^= FONT_ITALIC;	}	if ((usTmp & BIT(2)) != 0) {		pFont->usFontStyle ^= FONT_STRIKE;	}	if ((usTmp & BIT(5)) != 0) {		pFont->usFontStyle ^= FONT_SMALL_CAPITALS;	}	if ((usTmp & BIT(6)) != 0) {		pFont->usFontStyle ^= FONT_CAPITALS;	}	if ((usTmp & BIT(7)) != 0) {		pFont->usFontStyle ^= FONT_HIDDEN;	}	ucTmp = ucGetByte(5, aucChpx);	if (ucTmp != 0) {		if (ucTmp < 128) {			pFont->usFontStyle |= FONT_SUPERSCRIPT;			DBG_MSG("Superscript");		} else {			pFont->usFontStyle |= FONT_SUBSCRIPT;			DBG_MSG("Subscript");		}	}	bIcoChange = (usTmp & BIT(10)) != 0;	bFtcChange = (usTmp & BIT(11)) != 0;	bHpsChange = (usTmp & BIT(12)) != 0;	bKulChange = (usTmp & BIT(13)) != 0;	if (bFtcChange) {		usTmp = usGetWord(2, aucChpx);		if (usTmp <= (USHORT)UCHAR_MAX) {			pFont->ucFontNumber = (UCHAR)usTmp;		} else {			pFont->ucFontNumber = 0;		}	}	if (bHpsChange) {		pFont->usFontSize = (USHORT)ucGetByte(4, aucChpx);	}	if (bIcoChange || bKulChange) {		usTmp = usGetWord(6, aucChpx);		if (bIcoChange) {			pFont->ucFontColor = (UCHAR)((usTmp & 0x0f00) >> 8);			if (pFont->ucFontColor <= 7) {				/* Add 1 for compatibility with Word 2 and up */				pFont->ucFontColor++;			} else {				DBG_DEC(pFont->ucFontColor);				pFont->ucFontColor = 0;			}		}		if (bKulChange) {			usTmp = (usTmp & 0x7000) >> 12;			DBG_DEC_C(usTmp > 4, usTmp);			if (usTmp == 0) {				pFont->usFontStyle &= ~FONT_UNDERLINE;			} else {				pFont->usFontStyle |= FONT_UNDERLINE;			}		}	}
开发者ID:pocketbook-free,项目名称:antiword,代码行数:95,


示例6: level1_cache_flush_all

static void level1_cache_flush_all(void){	DBG_MSG(4, ("meson_drm_ump_osk_msync(): Flushing the whole L1 cache/n"));	__cpuc_flush_kern_all();}
开发者ID:nmadrane,项目名称:linux-meson,代码行数:5,


示例7: ump_dmabuf_import_wrapper

int ump_dmabuf_import_wrapper(u32 __user *argument,				struct ump_session_data  *session_data){	ump_session_memory_list_element *session = NULL;	struct ump_uk_dmabuf ump_dmabuf;	ump_dd_handle *ump_handle;	ump_dd_physical_block *blocks;	struct dma_buf_attachment *attach;	struct dma_buf *dma_buf;	struct sg_table *sgt;	struct scatterlist *sgl;	unsigned long block_size;	/* FIXME */	struct device dev;	unsigned int i = 0, npages;	int ret;	/* Sanity check input parameters */	if (!argument || !session_data) {		MSG_ERR(("NULL parameter./n"));		return -EINVAL;	}	if (copy_from_user(&ump_dmabuf, argument,				sizeof(struct ump_uk_dmabuf))) {		MSG_ERR(("copy_from_user() failed./n"));		return -EFAULT;	}	dma_buf = dma_buf_get(ump_dmabuf.fd);	if (IS_ERR(dma_buf))		return PTR_ERR(dma_buf);	/*	 * check whether dma_buf imported already exists or not.	 *	 * TODO	 * if already imported then dma_buf_put() should be called	 * and then just return dma_buf imported.	 */	attach = dma_buf_attach(dma_buf, &dev);	if (IS_ERR(attach)) {		ret = PTR_ERR(attach);		goto err_dma_buf_put;	}	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);	if (IS_ERR(sgt)) {		ret = PTR_ERR(sgt);		goto err_dma_buf_detach;	}	npages = sgt->nents;	/* really need? */	ump_dmabuf.ctx = (void *)session_data;	block_size = sizeof(ump_dd_physical_block) * npages;	blocks = (ump_dd_physical_block *)_mali_osk_malloc(block_size);	if (NULL == blocks) {		MSG_ERR(("Failed to allocate blocks/n"));		ret = -ENOMEM;		goto err_dmu_buf_unmap;	}	sgl = sgt->sgl;	while (i < npages) {		blocks[i].addr = sg_phys(sgl);		blocks[i].size = sg_dma_len(sgl);		sgl = sg_next(sgl);		i++;	}	/*	 * Initialize the session memory list element, and add it	 * to the session object	 */	session = _mali_osk_calloc(1, sizeof(*session));	if (!session) {		DBG_MSG(1, ("Failed to allocate session./n"));		ret = -EFAULT;		goto err_free_block;	}	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, i);	if (UMP_DD_HANDLE_INVALID == ump_handle) {		DBG_MSG(1, ("Failed to create ump handle./n"));		ret = -EFAULT;		goto err_free_session;	}	session->mem = (ump_dd_mem *)ump_handle;	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);	_mali_osk_list_add(&(session->list),			&(session_data->list_head_session_memory_list));//.........这里部分代码省略.........
开发者ID:AndreiLux,项目名称:Perseus-S3,代码行数:101,


示例8: ump_ion_import_wrapper

/* * IOCTL operation; Import fd to  UMP memory */int ump_ion_import_wrapper(u32 __user * argument, struct ump_session_data  * session_data){	_ump_uk_ion_import_s user_interaction;	ump_dd_handle *ump_handle;	ump_dd_physical_block * blocks;	unsigned long num_blocks;	struct ion_handle *ion_hnd;	struct scatterlist *sg;	struct scatterlist *sg_ion;	unsigned long i = 0;	ump_session_memory_list_element * session_memory_element = NULL;	if (ion_client_ump==NULL)	    ion_client_ump = ion_client_create(ion_exynos, -1, "ump");	/* Sanity check input parameters */	if (NULL == argument || NULL == session_data)	{		MSG_ERR(("NULL parameter in ump_ioctl_allocate()/n"));		return -ENOTTY;	}	/* Copy the user space memory to kernel space (so we safely can read it) */	if (0 != copy_from_user(&user_interaction, argument, sizeof(user_interaction)))	{		MSG_ERR(("copy_from_user() in ump_ioctl_allocate()/n"));		return -EFAULT;	}	user_interaction.ctx = (void *) session_data;	/* translate fd to secure ID*/	ion_hnd = ion_import_fd(ion_client_ump, user_interaction.ion_fd);	sg_ion = ion_map_dma(ion_client_ump,ion_hnd);	blocks = (ump_dd_physical_block*)_mali_osk_malloc(sizeof(ump_dd_physical_block)*1024);	if (NULL == blocks) {		MSG_ERR(("Failed to allocate blocks in ump_ioctl_allocate()/n"));		return -ENOMEM;	}	sg = sg_ion;	do {		blocks[i].addr = sg_phys(sg);		blocks[i].size = sg_dma_len(sg);		i++;		if (i>=1024) {			_mali_osk_free(blocks);			MSG_ERR(("ion_import fail() in ump_ioctl_allocate()/n"));			return -EFAULT;		}		sg = sg_next(sg);	} while(sg);	num_blocks = i;	/* Initialize the session_memory_element, and add it to the session object */	session_memory_element = _mali_osk_calloc( 1, sizeof(ump_session_memory_list_element));	if (NULL == session_memory_element)	{		_mali_osk_free(blocks);		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()/n"));		return -EFAULT;	}	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, num_blocks);	if (UMP_DD_HANDLE_INVALID == ump_handle)	{		_mali_osk_free(session_memory_element);		_mali_osk_free(blocks);		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()/n"));		return -EFAULT;	}	session_memory_element->mem = (ump_dd_mem*)ump_handle;	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);	_mali_osk_list_add(&(session_memory_element->list), &(session_data->list_head_session_memory_list));	_mali_osk_lock_signal(session_data->lock, _MALI_OSK_LOCKMODE_RW);	ion_unmap_dma(ion_client_ump,ion_hnd);	ion_free(ion_client_ump, ion_hnd);	_mali_osk_free(blocks);	user_interaction.secure_id = ump_dd_secure_id_get(ump_handle);	user_interaction.size = ump_dd_size_get(ump_handle);	user_interaction.ctx = NULL;	if (0 != copy_to_user(argument, &user_interaction, sizeof(user_interaction)))	{		/* If the copy fails then we should release the memory. We can use the IOCTL release to accomplish this */		MSG_ERR(("copy_to_user() failed in ump_ioctl_allocate()/n"));		return -EFAULT;	}//.........这里部分代码省略.........
开发者ID:AndreiLux,项目名称:Perseus-S3,代码行数:101,


示例9: _ump_ukk_allocate

_mali_osk_errcode_t _ump_ukk_allocate( _ump_uk_allocate_s *user_interaction ){	ump_session_data * session_data = NULL;	ump_dd_mem *new_allocation = NULL;	ump_session_memory_list_element * session_memory_element = NULL;	int map_id;	DEBUG_ASSERT_POINTER( user_interaction );	DEBUG_ASSERT_POINTER( user_interaction->ctx );	session_data = (ump_session_data *) user_interaction->ctx;	session_memory_element = _mali_osk_calloc( 1, sizeof(ump_session_memory_list_element));	if (NULL == session_memory_element)	{		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()/n"));		return _MALI_OSK_ERR_NOMEM;	}	new_allocation = _mali_osk_calloc( 1, sizeof(ump_dd_mem));	if (NULL==new_allocation)	{		_mali_osk_free(session_memory_element);		DBG_MSG(1, ("Failed to allocate ump_dd_mem in _ump_ukk_allocate()/n"));		return _MALI_OSK_ERR_NOMEM;	}	/* Create a secure ID for this allocation */	_mali_osk_lock_wait(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);	map_id = ump_descriptor_mapping_allocate_mapping(device.secure_id_map, (void*)new_allocation);	if (map_id < 0)	{		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);		_mali_osk_free(session_memory_element);		_mali_osk_free(new_allocation);		DBG_MSG(1, ("Failed to allocate secure ID in ump_ioctl_allocate()/n"));		return - _MALI_OSK_ERR_INVALID_FUNC;	}	/* Initialize the part of the new_allocation that we know so for */	new_allocation->secure_id = (ump_secure_id)map_id;	_mali_osk_atomic_init(&new_allocation->ref_count,1);	if ( 0==(UMP_REF_DRV_UK_CONSTRAINT_USE_CACHE & user_interaction->constraints) )		 new_allocation->is_cached = 0;	else new_allocation->is_cached = 1;	/* special case a size of 0, we should try to emulate what malloc does in this case, which is to return a valid pointer that must be freed, but can't be dereferences */	if (0 == user_interaction->size)	{		user_interaction->size = 1; /* emulate by actually allocating the minimum block size */	}	new_allocation->size_bytes = UMP_SIZE_ALIGN(user_interaction->size); /* Page align the size */	new_allocation->lock_usage = UMP_NOT_LOCKED;	/* Now, ask the active memory backend to do the actual memory allocation */	if (!device.backend->allocate( device.backend->ctx, new_allocation ) )	{		DBG_MSG(3, ("OOM: No more UMP memory left. Failed to allocate memory in ump_ioctl_allocate(). Size: %lu, requested size: %lu/n", new_allocation->size_bytes, (unsigned long)user_interaction->size));		ump_descriptor_mapping_free(device.secure_id_map, map_id);		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);		_mali_osk_free(new_allocation);		_mali_osk_free(session_memory_element);		return _MALI_OSK_ERR_INVALID_FUNC;	}	new_allocation->hw_device = _UMP_UK_USED_BY_CPU;	new_allocation->ctx = device.backend->ctx;	new_allocation->release_func = device.backend->release;	_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);	/* Initialize the session_memory_element, and add it to the session object */	session_memory_element->mem = new_allocation;	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);	_mali_osk_list_add(&(session_memory_element->list), &(session_data->list_head_session_memory_list));	_mali_osk_lock_signal(session_data->lock, _MALI_OSK_LOCKMODE_RW);	user_interaction->secure_id = new_allocation->secure_id;	user_interaction->size = new_allocation->size_bytes;	DBG_MSG(3, ("UMP memory allocated. ID: %u, size: %lu/n", new_allocation->secure_id, new_allocation->size_bytes));	return _MALI_OSK_ERR_OK;}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:85,


示例10: ump_dd_handle_create_from_phys_blocks

UMP_KERNEL_API_EXPORT ump_dd_handle ump_dd_handle_create_from_phys_blocks(ump_dd_physical_block * blocks, unsigned long num_blocks){	ump_dd_mem * mem;	unsigned long size_total = 0;	int map_id;	u32 i;	/* Go through the input blocks and verify that they are sane */	for (i=0; i < num_blocks; i++)	{		unsigned long addr = blocks[i].addr;		unsigned long size = blocks[i].size;		DBG_MSG(5, ("Adding physical memory to new handle. Address: 0x%08lx, size: %lu/n", addr, size));		size_total += blocks[i].size;		if (0 != UMP_ADDR_ALIGN_OFFSET(addr))		{			MSG_ERR(("Trying to create UMP memory from unaligned physical address. Address: 0x%08lx/n", addr));			return UMP_DD_HANDLE_INVALID;		}		if (0 != UMP_ADDR_ALIGN_OFFSET(size))		{			MSG_ERR(("Trying to create UMP memory with unaligned size. Size: %lu/n", size));			return UMP_DD_HANDLE_INVALID;		}	}	/* Allocate the ump_dd_mem struct for this allocation */	mem = _mali_osk_malloc(sizeof(*mem));	if (NULL == mem)	{		DBG_MSG(1, ("Could not allocate ump_dd_mem in ump_dd_handle_create_from_phys_blocks()/n"));		return UMP_DD_HANDLE_INVALID;	}	/* Find a secure ID for this allocation */	_mali_osk_lock_wait(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);	map_id = ump_descriptor_mapping_allocate_mapping(device.secure_id_map, (void*) mem);	if (map_id < 0)	{		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);		_mali_osk_free(mem);		DBG_MSG(1, ("Failed to allocate secure ID in ump_dd_handle_create_from_phys_blocks()/n"));		return UMP_DD_HANDLE_INVALID;	}	/* Now, make a copy of the block information supplied by the user */	mem->block_array = _mali_osk_malloc(sizeof(ump_dd_physical_block)* num_blocks);	if (NULL == mem->block_array)	{		ump_descriptor_mapping_free(device.secure_id_map, map_id);		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);		_mali_osk_free(mem);		DBG_MSG(1, ("Could not allocate a mem handle for function ump_dd_handle_create_from_phys_blocks()./n"));		return UMP_DD_HANDLE_INVALID;	}	_mali_osk_memcpy(mem->block_array, blocks, sizeof(ump_dd_physical_block) * num_blocks);	/* And setup the rest of the ump_dd_mem struct */	_mali_osk_atomic_init(&mem->ref_count, 1);	mem->secure_id = (ump_secure_id)map_id;	mem->size_bytes = size_total;	mem->nr_blocks = num_blocks;	mem->backend_info = NULL;	mem->ctx = NULL;	mem->release_func = phys_blocks_release;	/* For now UMP handles created by ump_dd_handle_create_from_phys_blocks() is forced to be Uncached */	mem->is_cached = 0;	mem->hw_device = _UMP_UK_USED_BY_CPU;	mem->lock_usage = UMP_NOT_LOCKED;	_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);	DBG_MSG(3, ("UMP memory created. ID: %u, size: %lu/n", mem->secure_id, mem->size_bytes));	return (ump_dd_handle)mem;}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:80,


示例11: Power_StopUSBCharge

void Power_StopUSBCharge(void){    //DBG_MSG("  gIsUSBInsert=%d,gIsBattInsert=%d,gIsBattDead=%d,gIsUSBAdapter=%d/r/n",gIsUSBInsert,gIsBattInsert,gIsBattDead,gIsUSBAdapter);    if (!gIsBattInsert)    {        DBG_DUMP("  NO Battery, Ignore STOP/r/n");        return;    }#if _MIPS_TODO    //#NT#2010/12/10#Jeah Yen -begin    if((USB_GetSource() == USB_SRC_USB_ADAPTER) && (Power_GetSource() != POWER_SRC_USB_ADAPTER))    {        //Not charge yet, just start check low-battery        DBG_DUMP("GxPower: Start low-battery check./r/n");        GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);    }    //#NT#2010/12/10#Jeah Yen -end    //#NT#2011/3/30#Jeah Yen -begin    if((USB_GetSource() == USB_SRC_NONE) && (Power_GetSource() != POWER_SRC_USB_ADAPTER))    {        //Cannot charge, start check low-battery        DBG_DUMP("GxPower: Start low-battery check./r/n");        GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);    }    //#NT#2011/3/30#Jeah Yen -end    if((USB_GetSource() == USB_SRC_USB_ADAPTER))    {        //DBG_MSG("  USB Src = Adaptor/r/n");        GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_CURRENT,BATT_CHARGE_CURRENT_LOW);        DBG_MSG("  Charge Current = %d/r/n", BATT_CHARGE_CURRENT_LOW);    }#endif    if((USB_GetSource() == USB_SRC_USB_PC))    {        //DBG_MSG("  USB Src = PC/r/n");        GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_CURRENT,BATT_CHARGE_CURRENT_LOW);        DBG_MSG("  Charge Current = %d/r/n", BATT_CHARGE_CURRENT_LOW);    }    if (!GxPower_GetControl(GXPWR_CTRL_BATTERY_CHARGE_EN))    {        DBG_DUMP("  Already NOT Charge, Ignore STOP/r/n");        return;    }    //#NT#2010/12/10#Jeah Yen -begin    DBG_DUMP("GxPower: Stop to Charge Battery/r/n");    GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_EN,FALSE);#if _MIPS_TODO    if(!gIsUSBChargePreCheck        && (GxSystem_GetState(SYSTEM_STATE_POWERON) != SYSTEM_POWERON_CHARGE)        )    {#if (USB_CHARGE_VERIFY == ENABLE)#else        GxLED_SetCtrl(KEYSCAN_LED_GREEN,SET_TOGGLE_LED,FALSE);        GxLED_SetCtrl(KEYSCAN_LED_GREEN,TURNON_LED,TRUE);#endif        //GxLED_SetCtrl(KEYSCAN_LED_RED,SET_TOGGLE_LED,FALSE);        //GxLED_SetCtrl(KEYSCAN_LED_RED,TURNON_LED,FALSE);    }#endif    DBG_DUMP("GxPower: Start low-battery check./r/n");    GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);    // enable flash re-charge    SxTimer_SetFuncActive(SX_TIMER_DET_RECHARGE_ID,TRUE);    //#NT#2010/12/10#Jeah Yen -end}
开发者ID:magic-gjh,项目名称:NT96655_S600_A5,代码行数:71,


示例12: pOpenFontTableFile

/* * pOpenFontTableFile - open the Font translation file * Copy the file to the proper place if necessary. * * Returns the file pointer or NULL */FILE *pOpenFontTableFile(void){    FILE	*pFileR, *pFileW;    char	*szFontNamesFile;    size_t	tSize;    BOOL	bFailed;    char	acBuffer[256];    pFileR = fopen("<AntiWord$FontNamesFile>", "r");    if (pFileR != NULL) {        /* The font table is already in the right directory */        return pFileR;    }    szFontNamesFile = getenv("AntiWord$FontNamesSave");    if (szFontNamesFile == NULL) {        werr(0, "Warning: Name of the FontNames file not found");        return NULL;    }    DBG_MSG(szFontNamesFile);    pFileR = fopen("<AntiWord$Dir>.Resources.Default", "r");    if (pFileR == NULL) {        werr(0, "I can't find 'Resources.Default'");        return NULL;    }    /* Here the default font translation table is known to exist */    if (!bMakeDirectory(szFontNamesFile)) {        werr(0,             "I can't make a directory for the FontNames file");        return NULL;    }    /* Here the proper directory is known to exist */    pFileW = fopen(szFontNamesFile, "w");    if (pFileW == NULL) {        (void)fclose(pFileR);        werr(0, "I can't create a default FontNames file");        return NULL;    }    /* Here the proper directory is known to be writeable */    /* Copy the default FontNames file */    bFailed = FALSE;    while (!feof(pFileR)) {        tSize = fread(acBuffer, 1, sizeof(acBuffer), pFileR);        if (ferror(pFileR)) {            DBG_MSG("Read error");            bFailed = TRUE;            break;        }        if (fwrite(acBuffer, 1, tSize, pFileW) != tSize) {            DBG_MSG("Write error");            bFailed = TRUE;            break;        }    }    (void)fclose(pFileW);    (void)fclose(pFileR);    if (bFailed) {        DBG_MSG("Copying the FontNames file failed");        (void)remove(szFontNamesFile);        return NULL;    }    return fopen(szFontNamesFile, "r");} /* end of pOpenFontTableFile */
开发者ID:rogerdehe,项目名称:antiword,代码行数:74,


示例13: DBG_BLOCK

//------------------------------------------------------------------------------//!boolBIH::trace( const Rayf& ray, Hit& hit, IntersectFunc intersect, void* data ) const{   DBG_BLOCK( os_bih_trace, "BIH::trace(" << ray.origin() << ray.direction() << " hit: t=" << hit._t << " id=" << hit._id << ")" );   if( _nodes.empty() )   {      return false;   }   Vec3f invDir = ray.direction().getInversed();    // Compute traversal order.   uint order[3];   order[0] = invDir(0) >= 0.0f ? 0 : 1;   order[1] = invDir(1) >= 0.0f ? 0 : 1;   order[2] = invDir(2) >= 0.0f ? 0 : 1;   float tmin  = 0.0f;   float tmax  = hit._t;   bool impact = false;   // Traverse tree.   Vector<TraversalStackNode> stack( _maxDepth );   uint stackID = 0;   const Node* node = &_nodes[0];   while( 1 )   {      DBG_MSG( os_bih_trace, "Visiting " << *node );      if( node->isInteriorNode() )      {         uint axis     = node->axis();         float tplane0 = ( node->_plane[order[axis]] - ray.origin()(axis)) * invDir(axis);         float tplane1 = ( node->_plane[1-order[axis]] - ray.origin()(axis)) * invDir(axis);         // Clip node.         if( node->isClipNode() )         {            // FIXME: we could probably do better (not traversing this node).            node = &_nodes[node->index()];            tmin = CGM::max( tmin, tplane0 );            tmax = CGM::min( tmax, tplane1 );            continue;         }         bool traverse0 = tmin < tplane0;         bool traverse1 = tmax > tplane1;         if( traverse0 )         {            if( traverse1 )            {               stack[stackID++].set(                  &_nodes[node->index() + 1-order[axis]],                  CGM::max( tmin, tplane1 ),                  tmax               );            }            node = &_nodes[node->index() + order[axis]];            tmax = CGM::min( tmax, tplane0 );         }         else         {            if( traverse1 )            {               node = &_nodes[node->index() + 1-order[axis]];               tmin = CGM::max( tmin, tplane1 );            }            else            {               // Unstack.               do               {                  if( stackID == 0 )                  {                     return impact;                  }                  stack[--stackID].get( node, tmin, tmax );                  tmax = CGM::min( tmax, hit._t );               } while( tmin > tmax );            }         }      }      else      {         // We are in a leaf node.         // Intersects all primitives in it.         uint numElems = node->_numElements;         uint id       = node->index();         for( uint i = 0; i < numElems; ++i, ++id )         {            if( intersect( ray, _ids[id], hit._t, data ) )            {               impact  = true;               hit._id = _ids[id];            }//.........这里部分代码省略.........
开发者ID:LudoSapiens,项目名称:Dev,代码行数:101,


示例14: eGet8RowInfo

/* * Translate the rowinfo to a member of the row_info enumeration */row_info_enumeGet8RowInfo(int iFodo,	const UCHAR *aucGrpprl, int iBytes, row_block_type *pRow){	int	iFodoOff, iInfoLen;	int	iIndex, iSize, iCol;	int	iPosCurr, iPosPrev;	USHORT	usTmp;	BOOL	bFound2416_0, bFound2416_1, bFound2417_0, bFound2417_1;	BOOL	bFound244b_0, bFound244b_1, bFound244c_0, bFound244c_1;	BOOL	bFoundd608;	fail(iFodo < 0 || aucGrpprl == NULL || pRow == NULL);	iFodoOff = 0;	bFound2416_0 = FALSE;	bFound2416_1 = FALSE;	bFound2417_0 = FALSE;	bFound2417_1 = FALSE;	bFound244b_0 = FALSE;	bFound244b_1 = FALSE;	bFound244c_0 = FALSE;	bFound244c_1 = FALSE;	bFoundd608 = FALSE;	while (iBytes >= iFodoOff + 2) {		iInfoLen = 0;		switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {		case 0x2416:	/* fInTable */			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {				bFound2416_1 = TRUE;			} else {				bFound2416_0 = TRUE;			}			break;		case 0x2417:	/* fTtp */			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {				bFound2417_1 = TRUE;			} else {				bFound2417_0 = TRUE;			}			break;		case 0x244b:	/* sub-table fInTable */			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {				bFound244b_1 = TRUE;			} else {				bFound244b_0 = TRUE;			}			break;		case 0x244c:	/* sub-table fTtp */			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {				bFound244c_1 = TRUE;			} else {				bFound244c_0 = TRUE;			}			break;		case 0x6424:	/* brcTop */			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);			usTmp &= 0xff00;			NO_DBG_DEC(usTmp >> 8);			if (usTmp == 0) {				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;			} else {				pRow->ucBorderInfo |= TABLE_BORDER_TOP;			}			break;		case 0x6425:	/* brcLeft */			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);			usTmp &= 0xff00;			NO_DBG_DEC(usTmp >> 8);			if (usTmp == 0) {				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;			} else {				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;			}			break;		case 0x6426:	/* brcBottom */			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);			usTmp &= 0xff00;			NO_DBG_DEC(usTmp >> 8);			if (usTmp == 0) {				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;			} else {				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;			}			break;		case 0x6427:	/* brcRight */			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);			usTmp &= 0xff00;			NO_DBG_DEC(usTmp >> 8);			if (usTmp == 0) {				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;			} else {				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;			}			break;		case 0xd606:	/* cDefTable10 */			DBG_MSG("0xd606: sprmTDefTable10");//.........这里部分代码省略.........
开发者ID:pocketbook-free,项目名称:antiword,代码行数:101,


示例15: UIDisplay_Init

void UIDisplay_Init(UINT8 iDD, BOOL bClear, ISIZE* pDeviceSize){    RESULT r;    LAYER_INIT LayerInit;    UINT32 uiBufAddr;    //fixed buffer size    UINT32 osd_w = OSD_W;    UINT32 osd_h = OSD_H;    //fixed buffer size    UINT32 vdo_w = OSD_W;    UINT32 vdo_h = OSD_H;    //ISIZE DeviceSize;    LAYER_INIT* pLayerInit = (LAYER_INIT*)&LayerInit; //layer init parameter    //DeviceSize = GxVideo_GetDeviceSize(DOUT1);    ISIZE DeviceSize = pDeviceSize[0];    DBG_MSG("DOUT=%d/n/r",iDD>>4);    switch(iDD & 0x0f) //check layer    {    case LAYER_OSD1:        uiBufAddr = OS_GetMempoolAddr(POOL_ID_DISP_OSD1);        pLayerInit->uiType = TYPE_FB;        pLayerInit->uiPxlfmt = DISPLAY_OSD_FMT;        pLayerInit->uiWidth = osd_w;        pLayerInit->uiHeight = osd_h;#if (OSD_USE_DOUBLE_BUFFER == ENABLE)pLayerInit->uiBufCount = 1;pLayerInit->uiSwapEffect = SWAPEFFECT_COPY;#elsepLayerInit->uiBufCount = 0;pLayerInit->uiSwapEffect = SWAPEFFECT_DISCARD;#endifswitch(pLayerInit->uiPxlfmt){case PXLFMT_INDEX1: pLayerInit->uiBufSize = (osd_w*osd_h)>>3; break;case PXLFMT_INDEX2: pLayerInit->uiBufSize = (osd_w*osd_h)>>2; break;case PXLFMT_INDEX4: pLayerInit->uiBufSize = (osd_w*osd_h)>>1; break;case PXLFMT_INDEX8: pLayerInit->uiBufSize = (osd_w*osd_h)>>0; break;}pLayerInit->pBufAddr[0] = uiBufAddr;#if (OSD_USE_DOUBLE_BUFFER == ENABLE)pLayerInit->pBufAddr[1] = uiBufAddr + pLayerInit->uiBufSize;#elsepLayerInit->pBufAddr[1] = 0;#endifpLayerInit->pBufAddr[2] = 0;//dynamic window sizepLayerInit->win.x= 0;pLayerInit->win.y = 0;pLayerInit->win.w = DeviceSize.w;pLayerInit->win.h = DeviceSize.h;pLayerInit->uiWinAttr = 0;#if (OSD_USE_ROTATE_BUFFER == ENABLE)if(gbOsdRotate == 1){DBG_MSG("^YEnable Rotate/r/n");//prepare show DCUINT32 buf_w = pLayerInit->uiWidth;UINT32 buf_h = pLayerInit->uiHeight;UINT32 win_w = pLayerInit->win.w;UINT32 win_h = pLayerInit->win.h;pLayerInit->uiWidth = buf_h;pLayerInit->uiHeight = buf_w;pLayerInit->uiBufCount = 0;pLayerInit->uiSwapEffect = SWAPEFFECT_DISCARD;pLayerInit->pBufAddr[0] = uiBufAddr;pLayerInit->pBufAddr[1] = 0;pLayerInit->pBufAddr[2] = 0;pLayerInit->win.w = win_h;pLayerInit->win.h = win_w;        //prepare paint DC        memset(pPaintDC, 0, sizeof(DC));        GxGfx_AttachDC(pPaintDC, TYPE_FB,                       pLayerInit->uiPxlfmt, buf_w, buf_h, buf_w,                       (UINT8*)(uiBufAddr + pLayerInit->uiBufSize), 0, 0);    }    else    {        DBG_MSG("^YDisable Rotate/r/n");    }#endif    r = GxDisplay_InitLayer(iDD, &LayerInit, bClear);    UI_DirtyDisplaySource(iDD); //must force flush to update new swap-buffer and new swap-effect    DBG_MSG("OSD1 buf=%08x, size=%08x/n/r",LayerInit.pBufAddr[0], LayerInit.uiBufSize);    DBG_MSG("OSD1 buf.w=%d, buf.h=%d;/n/r",LayerInit.uiWidth, LayerInit.uiHeight);    DBG_MSG("OSD1 win.w=%d, win.h=%d;/n/r",LayerInit.win.w, LayerInit.win.h);//.........这里部分代码省略.........
开发者ID:magic-gjh,项目名称:NT96655_FHD6600,代码行数:101,


示例16: vGet8LstInfo

/* * Build the list with List Information for Word 8/9/10/11 files */voidvGet8LstInfo(FILE *pFile, const pps_info_type *pPPS,	const ULONG *aulBBD, size_t tBBDLen,	const ULONG *aulSBD, size_t tSBDLen,	const UCHAR *aucHeader){	list_block_type	tList;	const ULONG	*aulBlockDepot;	UCHAR	*aucLfoInfo, *aucLstfInfo, *aucPapx, *aucXString;	ULONG	ulBeginLfoInfo, ulBeginLstfInfo, ulBeginLvlfInfo;	ULONG	ulListID, ulStart;	size_t	tBlockDepotLen, tBlockSize;	size_t	tLfoInfoLen, tLstfInfoLen, tPapxLen, tXstLen, tOff;	size_t	tLstfRecords, tStart, tIndex;	int	iNums;	USHORT	usIstd;	UCHAR	ucTmp, ucListLevel, ucMaxLevel, ucChpxLen;	UCHAR	aucLvlfInfo[28], aucXst[2];	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);	fail(aulBBD == NULL || aulSBD == NULL);	NO_DBG_DEC(pPPS->tTable.ulSB);	NO_DBG_HEX(pPPS->tTable.ulSize);	if (pPPS->tTable.ulSize == 0) {		DBG_MSG("No list information");		return;	}	if (pPPS->tTable.ulSize < MIN_SIZE_FOR_BBD_USE) {		/* Use the Small Block Depot */		aulBlockDepot = aulSBD;		tBlockDepotLen = tSBDLen;		tBlockSize = SMALL_BLOCK_SIZE;	} else {		/* Use the Big Block Depot */		aulBlockDepot = aulBBD;		tBlockDepotLen = tBBDLen;		tBlockSize = BIG_BLOCK_SIZE;	}	/* LFO (List Format Override) */	ulBeginLfoInfo = ulGetLong(0x2ea, aucHeader); /* fcPlfLfo */	DBG_HEX(ulBeginLfoInfo);	tLfoInfoLen = (size_t)ulGetLong(0x2ee, aucHeader); /* lcbPlfLfo */	DBG_DEC(tLfoInfoLen);	if (tLfoInfoLen == 0) {		DBG_MSG("No lists in this document");		return;	}	aucLfoInfo = xmalloc(tLfoInfoLen);	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,			aulBlockDepot, tBlockDepotLen, tBlockSize,			aucLfoInfo, ulBeginLfoInfo, tLfoInfoLen)) {		aucLfoInfo = xfree(aucLfoInfo);		return;	}	NO_DBG_PRINT_BLOCK(aucLfoInfo, tLfoInfoLen);	vBuildLfoList(aucLfoInfo, tLfoInfoLen);	aucLfoInfo = xfree(aucLfoInfo);	/* LSTF (LiST data on File) */	ulBeginLstfInfo = ulGetLong(0x2e2, aucHeader); /* fcPlcfLst */	DBG_HEX(ulBeginLstfInfo);	tLstfInfoLen = (size_t)ulGetLong(0x2e6, aucHeader); /* lcbPlcfLst */	DBG_DEC(tLstfInfoLen);	if (tLstfInfoLen == 0) {		DBG_MSG("No list data on file");		return;	}	aucLstfInfo = xmalloc(tLstfInfoLen);	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,			aulBlockDepot, tBlockDepotLen, tBlockSize,			aucLstfInfo, ulBeginLstfInfo, tLstfInfoLen)) {		aucLstfInfo = xfree(aucLstfInfo);		return;	}	NO_DBG_PRINT_BLOCK(aucLstfInfo, tLstfInfoLen);	tLstfRecords = (size_t)usGetWord(0, aucLstfInfo);	if (2 + tLstfRecords * 28 < tLstfInfoLen) {		DBG_DEC(2 + tLstfRecords * 28);		DBG_DEC(tLstfInfoLen);		aucLstfInfo = xfree(aucLstfInfo);		return;	}	/* LVLF (List leVeL on File) */	ulBeginLvlfInfo = ulBeginLstfInfo + tLstfInfoLen;	DBG_HEX(ulBeginLvlfInfo);	aucXString = NULL;	ulStart = ulBeginLvlfInfo;	for (tIndex = 0, tStart = 2;//.........这里部分代码省略.........
开发者ID:pocketbook-free,项目名称:antiword,代码行数:101,


示例17: System_OnStrgInit_FWS

void System_OnStrgInit_FWS(void){    BOOL bLZC = FALSE;    ER er;    UINT32 m_LdLoadedOffest;    DX_HANDLE pStrgDev = 0;    DBG_MSG("Init!/r/n");    DBG_IND("^M LD_BLOCK=%d/r/n", gBinInfo.ld.LdBlockCount);    DBG_IND("^M FW_MAX_SIZE=%08X/r/n", gBinInfo.ld.FWResvSize);    DBG_IND("^MFW_validate-update:");    //ValidateUpdateFW    {        UINT32 bUpdate = ((gBinInfo.ld.LdCtrl2 & LDCF_UPDATE_FW)!=0);        UINT32 uiUpdateResult = ((gBinInfo.ld.LdCtrl2 & LDCF_UPDATE_FW_DONE)!=0);        if(bUpdate)        {            DBG_IND("/r/n^MFW is just updated./r/n");            if(!uiUpdateResult)            {                DBG_FATAL("/r/nFW updated: fail!/r/n");            }        }    }    DBG_IND("^M ok/r/n");    pStrgDev = Dx_GetObject(DX_CLASS_STORAGE_EXT|DX_TYPE_NAND0);    #if (_INTERSTORAGE_==_INTERSTORAGE_SPI_)    bLZC = TRUE;    #else    bLZC = FALSE;    #endif    if(bLZC)    {        gPL_Init.PlInit.DataType = PARTLOAD_DATA_TYPE_COMPRESS_LZ;        gPL_BufAddr = OS_GetMempoolAddr(POOL_ID_APP);        gPL_BufSize = POOL_SIZE_APP;    }    else    {        gPL_Init.PlInit.DataType = PARTLOAD_DATA_TYPE_UNCOMPRESS;        gPL_BufAddr = OS_GetMempoolAddr(POOL_ID_FWS_BUFFER);        gPL_BufSize = POOL_SIZE_FWS_BUFFER;    }    m_LdLoadedOffest = gBinInfo.ld.LdLoadSize; //Get Ld loaded size    gPL_Init.uiApiVer = FWSRV_API_VERSION;    gPL_Init.TaskID = 0;    gPL_Init.SemID = 0;    gPL_Init.FlagID = 0;    gPL_Init.PlInit.uiApiVer = PARTLOAD_API_VERSION;    gPL_Init.PlInit.hStrg = pStrgDev;    gPL_Init.PlInit.uiAddrBegin = OS_GetMemAddr(MEM_CODE)+m_LdLoadedOffest; //Must be block boundary align    gPL_Init.PlInit.uiWorkingAddr = gPL_BufAddr;    gPL_Init.PlInit.uiWorkingSize = gPL_BufSize;    er = FwSrv_Init(&gPL_Init);    if(er != FWSRV_ER_OK)    {        DBG_ERR("Init failed!/r/n");    }    er = FwSrv_Open();    if(er != FWSRV_ER_OK)    {        DBG_ERR("Open failed!/r/n");    }}
开发者ID:magic-gjh,项目名称:NT96655_K12B,代码行数:70,


示例18: System_OnStrg_DownloadFW

void System_OnStrg_DownloadFW(UINT32* SecOrderTable, void (*LoadCallback)(const UINT32 Idx)){    BOOL bEnablePartload = FALSE;    int nSect = 0;    DBG_MSG("Init!/r/n");    DBG_DUMP("^G[LOAD-FW]/r/n");    nSect = OS_GetMemSectionCount(MEM_CODE);  //How to get last section ZI    DBG_DUMP("^GTotal Sections = %d/r/n", nSect);    if(LoadCallback)        LoadCallback(CODE_SECTION_01);    DBG_IND("^M P1_LOAD_SIZE=%08X, TIME=%d/r/n", gBinInfo.ld.LdLoadSize, gBinInfo.ld.LdLoadTime);    DBG_IND("^MPL_check_Ld:/r/n");    DBG_IND("^M PL_EN=%08X/r/n", gBinInfo.ld.LdCtrl & LDCF_PARTLOAD_EN);    DBG_IND("^M LZ_EN=%08X/r/n", gBinInfo.head.BinCtrl & HDCF_LZCOMPRESS_EN);    bEnablePartload = ((gBinInfo.ld.LdCtrl & LDCF_PARTLOAD_EN)!=0);    if(!bEnablePartload)        return;    DBG_IND("^MPL_validate-p1-range:");    //ValidatePartOne    {        // Make Sure: Partloader start (PART-2 start) <= Loader loaded end        int i;        UINT32 FwSize = 0;        UINT32 uiDestAddress = OS_GetMemAddr(MEM_CODE)+gBinInfo.ld.LdLoadSize;        if((uiDestAddress != 0) && (uiDestAddress < OS_GetMemAddr(1)))        {            DBG_FATAL("PART_TWO start (%08x) > PART_ONE loaded end (%08x)!/r/n",                OS_GetMemAddr(1), uiDestAddress );        }        // Make Sure: Partloader end (PART-last end) <= MEM_CODE end        for(i=0;i<nSect;i++)        {            DBG_IND("Sect%d: Addr:%08X, Size:%08X/r/n",i,OS_GetMemAddr(i),OS_GetMemSize(i));            FwSize += OS_GetMemSize(i);        }        if (OS_GetMemAddr(0)+FwSize > OS_GetMemAddr(MEM_CODE)+OS_GetMemSize(MEM_CODE))        {            DBG_FATAL("PART_LAST end (%08x) > MEM_CODE end (%08x)!/r/n",                OS_GetMemAddr(0)+FwSize, OS_GetMemAddr(MEM_CODE)+OS_GetMemSize(MEM_CODE));        }    }    DBG_IND("^M ok/r/n");    DBG_DUMP("^MPL_begin/r/n");    {        ER er;        gPL_In.puiIdxSequence = SecOrderTable;        gPL_In.fpLoadedCb = LoadCallback;        gPL_Cmd.Idx = FWSRV_CMD_IDX_PL_LOAD_BURST; //continue load        gPL_Cmd.In.pData = &gPL_In;        gPL_Cmd.In.uiNumByte = sizeof(gPL_In);        gPL_Cmd.Prop.bExitCmdFinish = TRUE;        er = FwSrv_Cmd(&gPL_Cmd);        if(er != FWSRV_ER_OK)        {            DBG_ERR("Process failed!/r/n");        }    }    DBG_DUMP("^MPL_end/r/n");}
开发者ID:magic-gjh,项目名称:NT96655_K12B,代码行数:65,


示例19: meson_drm_ump_osk_msync

/* This is a copy of _ump_osk_msync from drivers/amlogic/gpu/ump/linux/ump_osk_low_level_mem.c * with adapted parameters */static void meson_drm_ump_osk_msync(struct drm_gem_cma_object *cma_obj, void *virt, u32 offset, size_t size, enum drm_meson_msync_op op, struct meson_drm_session_data *session_data){	struct drm_gem_object *gem_obj;	u32 start_p, end_p;	/* Flush L1 using virtual address, the entire range in one go.	 * Only flush if user space process has a valid write mapping on given address. */	if ((cma_obj) && (virt != NULL) && (access_ok(VERIFY_WRITE, virt, size))) {		__cpuc_flush_dcache_area(virt, size);		DBG_MSG(3, ("meson_drm_ump_osk_msync(): Flushing CPU L1 Cache. CPU address: %x, size: %x/n", virt, size));	} else {		if (session_data) {			if (op == DRM_MESON_MSYNC_FLUSH_L1) {				DBG_MSG(4, ("meson_drm_ump_osk_msync(): Pending %d L1 cache flushes/n", session_data->has_pending_level1_cache_flush));				session_data->has_pending_level1_cache_flush = 0;				level1_cache_flush_all();				return;			} else {				if (session_data->cache_operations_ongoing) { /* This is set in cache_operations_control(start) */					session_data->has_pending_level1_cache_flush++;					DBG_MSG(4, ("meson_drm_ump_osk_msync(): Defering L1 cache flush (%d pending)/n" session_data->has_pending_level1_cache_flush));				} else {					/* Flushing the L1 cache for each switch_user() if ump_cache_operations_control(START) is not called */					level1_cache_flush_all();				}			}		} else {			DBG_MSG(4, ("Unkown state %s %d/n", __FUNCTION__, __LINE__));			level1_cache_flush_all();		}	}	if (!cma_obj)		return;	gem_obj = &cma_obj->base;	DBG_MSG(3, ("meson_drm_ump_osk_msync(): Flushing CPU L2 Cache/n"));	/* Flush L2 using physical addresses	 * Our allocations are always contiguous (GEM CMA), so we have only one mem block */	if (offset >= gem_obj->size) {		offset -= gem_obj->size;		return;	}	if (offset) {		start_p = (u32)cma_obj->paddr + offset;		/* We'll zero the offset later, after using it to calculate end_p. */	} else {		start_p = (u32)cma_obj->paddr;	}	if (size < gem_obj->size - offset) {		end_p = start_p + size;		size = 0;	} else {		if (offset) {			end_p = start_p + (gem_obj->size - offset);			size -= gem_obj->size - offset;			offset = 0;		} else {			end_p = start_p + gem_obj->size;			size -= gem_obj->size;		}	}	switch (op) {	case DRM_MESON_MSYNC_CLEAN:		outer_clean_range(start_p, end_p);		break;	case DRM_MESON_MSYNC_CLEAN_AND_INVALIDATE:		outer_flush_range(start_p, end_p);		break;	case DRM_MESON_MSYNC_INVALIDATE:		outer_inv_range(start_p, end_p);		break;	default:		break;	}	return;}
开发者ID:nmadrane,项目名称:linux-meson,代码行数:85,


示例20: block_allocator_allocate

static int block_allocator_allocate(void* ctx, ump_dd_mem * mem){	block_allocator * allocator;	u32 left;	block_info * last_allocated = NULL;	int i = 0;	BUG_ON(!ctx);	BUG_ON(!mem);	allocator = (block_allocator*)ctx;	left = mem->size_bytes;	BUG_ON(!left);	BUG_ON(!&allocator->mutex);	mem->nr_blocks = ((left + UMP_BLOCK_SIZE - 1) & ~(UMP_BLOCK_SIZE - 1)) / UMP_BLOCK_SIZE;	mem->block_array = (ump_dd_physical_block*)vmalloc(sizeof(ump_dd_physical_block) * mem->nr_blocks);	if (NULL == mem->block_array) {		MSG_ERR(("Failed to allocate block array/n"));		return 0;	}	if (down_interruptible(&allocator->mutex)) {		MSG_ERR(("Could not get mutex to do block_allocate/n"));		return 0;	}	mem->size_bytes = 0;	while ((left > 0) && (allocator->first_free)) {		block_info * block;		block = allocator->first_free;		allocator->first_free = allocator->first_free->next;		block->next = last_allocated;		last_allocated = block;		allocator->num_free--;		mem->block_array[i].addr = get_phys(allocator, block);		mem->block_array[i].size = UMP_BLOCK_SIZE;		mem->size_bytes += UMP_BLOCK_SIZE;		i++;		if (left < UMP_BLOCK_SIZE) left = 0;		else left -= UMP_BLOCK_SIZE;	}	if (left) {		block_info * block;		/* release all memory back to the pool */		while (last_allocated) {			block = last_allocated->next;			last_allocated->next = allocator->first_free;			allocator->first_free = last_allocated;			last_allocated = block;			allocator->num_free++;		}		vfree(mem->block_array);		mem->backend_info = NULL;		mem->block_array = NULL;		DBG_MSG(4, ("Could not find a mem-block for the allocation./n"));		up(&allocator->mutex);		return 0;	}	mem->backend_info = last_allocated;	up(&allocator->mutex);	mem->is_cached=0;	return 1;}
开发者ID:HuaweiHonor4C,项目名称:kernel_hi6210sft_mm,代码行数:77,


示例21: CPAL_I2C_ERR_UserCallback

void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t Device_Error) {    DBG_MSG("Error: %d", Device_Error);}
开发者ID:593141477,项目名称:SkyMouse-Firmware,代码行数:4,


示例22: config_set

void ICACHE_FLASH_ATTR config_set(serverConnData *conn, uint8_t argc, char *argv[]){    bool err = false;    cJSON * config = NULL;    cJSON * lastchild = NULL;    char *stmp = NULL;    DBG_MSG("config_set argc: %d/r/n", argc);    if (argc == 0)        espbuffsentprintf(conn, "Usage: set <key> [value]/r/nUse help for more details/r/n");    else if (argc == 1) {        // Delete config        DBG_MSG("Delete config %s/r/n", argv[1]);        config = get_parent_by_key(jconfig_root, argv[1], &stmp);        if (config != NULL) lastchild = cJSON_GetObjectItem(config, stmp);        DBG_MSG("config: %p, stmp: %p/r/n", config, stmp);        if (config == NULL) {            espbuffsentprintf(conn, "Could not found parent config with key [%s]./r/n", argv[1]);        }else if(lastchild == NULL) {            espbuffsentprintf(conn, "Could not found lastchild config with key [%s]./r/n", argv[1]);        } else {            char *tmp;            DBG_MSG("Delete %s from %s./r/n", lastchild->string, config->string);            cJSON_DeleteItemFromObject(config, lastchild->string);            tmp = cJSON_PrintUnformatted(config);            espbuffsentstring(conn, "Deleted. Now content is:/r/n");            espbuffsentstring(conn, tmp);            os_free(tmp);        }    } else {        // Update config value        char value[255];        uint8_t i;        uint32_t idx = 0;        os_bzero(value, sizeof(value));        for (i=2; i<=argc; ++i) {            DBG_MSG("argv[%d] = %s./r/n", i, argv[i]);            os_sprintf(value + idx, "%s ", argv[i]);            idx += os_strlen(argv[i]) + 1;        }        value[idx - 1] = 0;        DBG_MSG("Update config %s to %s./r/n", argv[1], value);        config = get_parent_by_key(jconfig_root, argv[1], &stmp);        DBG_MSG("config: %p, stmp: %p/r/n", config, stmp);        if (config == NULL) {            espbuffsentprintf(conn, "Could not found parent config with key [%s]./r/n", argv[1]);        }else if (stmp == NULL) {            espbuffsentprintf(conn, "Could not found last config with key [%s]./r/n", argv[1]);        } else {            char *tmp;            int i;            cJSON *newchild = NULL;            DBG_MSG("stmp: %s, valuetype: %c./r/n", stmp, value[0]);            lastchild = cJSON_GetObjectItem(config, stmp);            DBG_MSG("lastchild: %p./r/n", lastchild);            switch (value[0]) {                case 'i':                if (os_strlen(value) < 2) {                    espbuffsentstring(conn, "value is invalid format: i10/r/n");                    break;                }                i = atoi(&value[1]);                newchild = cJSON_CreateNumber(i);                break;                case 's':                if (os_strlen(value) < 2) {                    espbuffsentstring(conn, "value is invalid format: slamp/r/n");                    break;                }                newchild = cJSON_CreateString(&value[1]);                DBG_MSG("Create item: %s -> %p./r/n", &value[1], newchild);                break;                default:                    espbuffsentstring(conn, "value is invalid format/r/n");                    newchild = NULL;                break;            }            if (newchild != NULL) {                if (lastchild != NULL) {                    cJSON_ReplaceItemInObject(config, lastchild->string, newchild);                } else {                    DBG_MSG("Add config %s to %s./r/n", stmp, config->string);                    cJSON_AddItemToObject(config, stmp, newchild);                }                tmp = cJSON_PrintUnformatted(config);                espbuffsentstring(conn, "Updated. Now content is:/r/n");                espbuffsentstring(conn, tmp);                os_free(tmp);            }        }    }    if (err)        espbuffsentstring(conn, MSG_ERROR);    else        espbuffsentstring(conn, MSG_OK);}
开发者ID:nvl1109,项目名称:esp8266-dev,代码行数:98,


示例23: vGet6FootnotesText

/* * Build the list with footnote text information for Word 6/7 files */static voidvGet6FootnotesText(FILE *pFile, ULONG ulStartBlock,	const ULONG *aulBBD, size_t tBBDLen,	const UCHAR *aucHeader){	footnote_local_type	*pCurr;	UCHAR	*aucBuffer;	ULONG	ulCharPos, ulBeginOfFootnotes, ulOffset, ulBeginFootnoteText;	size_t	tFootnoteTextLen;	size_t	tIndex;	TRACE_MSG("vGet6FootnotesText");	fail(pFile == NULL || aucHeader == NULL);	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);	fail(aulBBD == NULL);	ulBeginOfFootnotes = ulGetLong(0x18, aucHeader); /* fcMin */	ulBeginOfFootnotes += ulGetLong(0x34, aucHeader); /* ccpText */	NO_DBG_HEX(ulBeginOfFootnotes);	ulBeginFootnoteText = ulGetLong(0x70, aucHeader); /* fcPlcffndTxt */	NO_DBG_HEX(ulBeginFootnoteText);	tFootnoteTextLen =		(size_t)ulGetLong(0x74, aucHeader); /* lcbPlcffndTxt */	NO_DBG_DEC(tFootnoteTextLen);	if (tFootnoteTextLen < 12) {		DBG_MSG("No Footnote text in this document");		return;	}	aucBuffer = xmalloc(tFootnoteTextLen);	if (!bReadBuffer(pFile, ulStartBlock,			aulBBD, tBBDLen, BIG_BLOCK_SIZE,			aucBuffer, ulBeginFootnoteText, tFootnoteTextLen)) {		aucBuffer = xfree(aucBuffer);		return;	}	NO_DBG_PRINT_BLOCK(aucBuffer, tFootnoteTextLen);	fail(tFootnoteTextLength != 0);	tFootnoteTextLength = tFootnoteTextLen / 4 - 2;	fail(tFootnoteTextLength == 0);	fail(pFootnoteText != NULL);	pFootnoteText = xcalloc(tFootnoteTextLength,				sizeof(footnote_local_type));	for (tIndex = 0; tIndex < tFootnoteTextLength; tIndex++) {		pCurr = pFootnoteText + tIndex;		pCurr->tInfo.szText = NULL;		ulOffset = ulGetLong(tIndex * 4, aucBuffer);		NO_DBG_HEX(ulOffset);		ulCharPos = ulBeginOfFootnotes + ulOffset;		NO_DBG_HEX(ulCharPos);		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosStart = ulCharPos;		ulOffset = ulGetLong(tIndex * 4 + 4, aucBuffer);		NO_DBG_HEX(ulOffset);		ulCharPos = ulBeginOfFootnotes + ulOffset;		NO_DBG_HEX(ulCharPos);		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosNext = ulCharPos;		pCurr->bUseful = pCurr->ulCharPosStart != pCurr->ulCharPosNext;	}	aucBuffer = xfree(aucBuffer);} /* end of vGet6FootnotesText */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:71,


示例24: ota_upgrade

void ICACHE_FLASH_ATTR ota_upgrade(serverConnData *conn, uint8_t argc, char *argv[]) {    espbuffsentprintf(conn, "START OTA UPGRADE...CUR ROM: %d./r/n", ROMNUM);    if (argc == 0)        espbuffsentstring(conn, "OTA <SRV IP> <PORT> <FOLDER PATH>/r/n");    else if (argc != 3)        espbuffsentstring(conn, MSG_ERROR);    else {        uint16_t port = atoi(argv[2]);        uint8_t iparr[4];        uint8_t i;        char tmp[4];        char* pCurIp = argv[1];        char * ch;        DBG_MSG("OTA UPGRADE with IP:%s, port:%d, path:%s./r/n", argv[1], argv[2], argv[3]);        for (i=0; i<protocol_idx; ++i) {            DBG_MSG("protocol_disconnect res: %d, index: %d/r/n", protocol_disconnect(&protocol_list[i]), i);        }        ch = strchr(pCurIp, '.');        DBG_MSG("First: %s/r/n", pCurIp);        DBG_MSG("After: %s/r/n", ch);        for (i = 0; i < 4; ++i) {            if (i < (ch - pCurIp + 1)) {                tmp[i] = pCurIp[i];            } else {                tmp[i] = 0;            }        }        iparr[0] = atoi(tmp);        pCurIp = ch + 1;        ch = strchr(pCurIp, '.');        DBG_MSG("First: %s/r/n", pCurIp);        DBG_MSG("After: %s/r/n", ch);        for (i = 0; i < 4; ++i) {            if (i < (ch - pCurIp + 1)) {                tmp[i] = pCurIp[i];            } else {                tmp[i] = 0;            }        }        iparr[1] = atoi(tmp);        pCurIp = ch + 1;        ch = strchr(pCurIp, '.');        DBG_MSG("First: %s/r/n", pCurIp);        DBG_MSG("After: %s/r/n", ch);        for (i = 0; i < 4; ++i) {            if (i < (ch - pCurIp + 1)) {                tmp[i] = pCurIp[i];            } else {                tmp[i] = 0;            }        }        iparr[2] = atoi(tmp);        pCurIp = ch + 1;        ch = strchr(pCurIp, '.');        DBG_MSG("First: %s/r/n", pCurIp);        DBG_MSG("After: %s/r/n", ch);        for (i = 0; i < 4; ++i) {            if (i < (argv[1] + strlen(argv[1]) - pCurIp + 1)) {                tmp[i] = pCurIp[i];            } else {                tmp[i] = 0;            }        }        iparr[3] = atoi(tmp);        DBG_MSG("=> IP: %d %d %d %d/r/n", iparr[0], iparr[1], iparr[2], iparr[3]);        if ((port == 0)||(port>65535)) {             espbuffsentstring(conn, MSG_ERROR);        } else {            espbuffsentstring(conn, MSG_OK);            handleUpgrade(2, iparr, port, argv[3]);        }    }}
开发者ID:nvl1109,项目名称:esp8266-dev,代码行数:82,


示例25: vGet0FootnotesInfoAndText

/* * Build the list with footnote information for Word for DOS files */static voidvGet0FootnotesInfoAndText(FILE *pFile, const UCHAR *aucHeader){	footnote_local_type	*pCurr;	UCHAR	*aucBuffer;	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginFootnoteInfo;	ULONG	ulCharPos, ulBeginNextBlock;	size_t	tFootnotes, tFootnoteInfoLen;	size_t	tIndex;	UCHAR   aucTmp[2];	TRACE_MSG("vGet0FootnotesInfoAndText");	fail(pFile == NULL || aucHeader == NULL);	ulBeginOfText = 128;	NO_DBG_HEX(ulBeginOfText);	ulBeginFootnoteInfo =  128 * (ULONG)usGetWord(0x14, aucHeader);	DBG_HEX(ulBeginFootnoteInfo);	ulBeginNextBlock = 128 * (ULONG)usGetWord(0x16, aucHeader);	DBG_HEX(ulBeginNextBlock);	if (ulBeginFootnoteInfo == ulBeginNextBlock) {		DBG_MSG("No Footnotes in this document");		return;	}	/* Read the the number of footnotes + 1 */	if (!bReadBytes(aucTmp, 2, ulBeginFootnoteInfo, pFile)) {		return;	}	tFootnotes = (size_t)usGetWord(0, aucTmp);	if (tFootnotes < 2) {		DBG_MSG("No Footnotes in this document (2)");	}	DBG_DEC(tFootnotes);	tFootnoteInfoLen =  8 * tFootnotes;	aucBuffer = xmalloc(tFootnoteInfoLen);	if (!bReadBytes(aucBuffer,			tFootnoteInfoLen, ulBeginFootnoteInfo + 4, pFile)) {		aucBuffer = xfree(aucBuffer);		return;	}	DBG_PRINT_BLOCK(aucBuffer, tFootnoteInfoLen);	/* Get footnote information */	fail(tFootnoteListLength != 0);	tFootnoteListLength = tFootnotes - 1;	fail(tFootnoteListLength == 0);	fail(aulFootnoteList != NULL);	aulFootnoteList = xcalloc(tFootnoteListLength, sizeof(ULONG));	for (tIndex = 0; tIndex < tFootnoteListLength; tIndex++) {		ulOffset = ulGetLong(tIndex * 8, aucBuffer);		DBG_HEX(ulOffset);		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);		DBG_HEX(ulFileOffset);		aulFootnoteList[tIndex] = ulFileOffset;	}	/* Get footnote text */	fail(tFootnoteTextLength != 0);	tFootnoteTextLength = tFootnotes - 1;	fail(tFootnoteTextLength == 0);	fail(pFootnoteText != NULL);	pFootnoteText = xcalloc(tFootnoteTextLength,				sizeof(footnote_local_type));	for (tIndex = 0; tIndex < tFootnoteTextLength; tIndex++) {		pCurr = pFootnoteText + tIndex;		pCurr->tInfo.szText = NULL;		ulOffset = ulGetLong(tIndex * 8 + 4, aucBuffer);		DBG_HEX(ulOffset);		ulCharPos = ulBeginOfText + ulOffset;		DBG_HEX(ulCharPos);		DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosStart = ulCharPos;		ulOffset = ulGetLong((tIndex + 1) * 8 + 4, aucBuffer);		DBG_HEX(ulOffset);		ulCharPos = ulBeginOfText + ulOffset;		DBG_HEX(ulCharPos);		DBG_HEX(ulCharPos2FileOffset(ulCharPos));		pCurr->ulCharPosNext = ulCharPos;		pCurr->bUseful = pCurr->ulCharPosStart != pCurr->ulCharPosNext;	}	aucBuffer = xfree(aucBuffer);} /* end of vGet0FootnotesInfoAndText */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:93,


示例26: vGet8FontInfo

//.........这里部分代码省略.........				pFont->usFontStyle ^= FONT_CAPITALS;				break;			default:				DBG_DEC(ucTmp);				DBG_FIXME();				break;			}			break;		case 0x083c:	/* fVanish */			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);			switch (ucTmp) {			case   0:	/* Unset */				pFont->usFontStyle &= ~FONT_HIDDEN;				break;			case   1:	/* Set */				pFont->usFontStyle |= FONT_HIDDEN;				break;			case 128:	/* Unchanged */				break;			case 129:	/* Negation */				pFont->usFontStyle ^= FONT_HIDDEN;				break;			default:				DBG_DEC(ucTmp);				DBG_FIXME();				break;			}			break;		case 0x2a32:	/* cDefault */			pFont->usFontStyle &= FONT_HIDDEN;			pFont->ucFontColor = FONT_COLOR_DEFAULT;			break;		case 0x2a33:	/* cPlain */			DBG_MSG("2a33: cPlain");			vFillFontFromStylesheet(usIstd, pFont);			break;		case 0x2a3e:	/* cKul */			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);			if (ucTmp == 0 || ucTmp == 5) {				pFont->usFontStyle &= ~FONT_UNDERLINE;			} else {				NO_DBG_MSG("Underline text");				pFont->usFontStyle |= FONT_UNDERLINE;				if (ucTmp == 6) {					DBG_MSG("Bold text");					pFont->usFontStyle |= FONT_BOLD;				}			}			break;		case 0x2a42:	/* cIco */			pFont->ucFontColor =				ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);			NO_DBG_DEC(pFont->ucFontColor);			break;		case 0x2a44:	/* cHpsInc */			DBG_MSG("0x2a44: sprmCHpsInc");			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);			DBG_DEC(ucTmp);			break;		case 0x2a48:	/* cIss */			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);			ucTmp &= 0x07;			if (ucTmp == 1) {				pFont->usFontStyle |= FONT_SUPERSCRIPT;				NO_DBG_MSG("Superscript");			} else if (ucTmp == 2) {
开发者ID:pocketbook-free,项目名称:antiword,代码行数:67,


示例27: DrvPower_GetBatteryLevel

static UINT32 DrvPower_GetBatteryLevel(void){    static UINT32   uiPreBatteryLvl    = DRVPWR_BATTERY_LVL_UNKNOWN;    static UINT32   uiPreBatteryADC    = 0;    static UINT32   uiRetBatteryLvl;    static UINT32   uiEmptycount =0;    static UINT32   uiCount = 0;    UINT32          uiCurBatteryADC, uiCurBatteryLvl,i;    BOOL            isMatch = FALSE;    uiCurBatteryLvl = 0;    if(uiPreBatteryLvl== DRVPWR_BATTERY_LVL_UNKNOWN)    {        uiCurBatteryADC = DrvPower_GetBatteryADC();        uiPreBatteryADC = DrvPower_GetBatteryADC()-1;        for (i = 0; i<BATT_SLIDE_WINDOW_COUNT; i++)        {            uiBattADCSlideWin[i] = uiCurBatteryADC;            DBG_MSG("AVG=%d/r/n",uiCurBatteryADC);        }    }    else    {        uiCurSlideWinCnt = BATT_SLIDE_WINDOW_COUNT;        uiBattADCSlideWin[uiBattSlideIdx++] = DrvPower_GetBatteryADC();        if (uiBattSlideIdx >= uiCurSlideWinCnt)        {            uiBattSlideIdx = 0;        }        uiCurBatteryADC = 0;        for (i = 0; i<uiCurSlideWinCnt; i++)        {            uiCurBatteryADC+=uiBattADCSlideWin[i];            DBG_MSG("A[%d]=%d,",i,uiBattADCSlideWin[i]);        }        uiCurBatteryADC/=uiCurSlideWinCnt;        DBG_MSG("AVG=%d",uiCurBatteryADC);        DBG_MSG(", V=%d",uiCurBatteryADC*42/9100);        DBG_MSG(".%02d/r/n",(uiCurBatteryADC*42/91)%100);    }    //DBG_IND("%d,%d,%d/r/n",VOLDET_BATTERY_ADC_LVL0,VOLDET_BATTERY_ADC_LVL1,VOLDET_BATTERY_ADC_LVL2);    // Rising    if (uiCurBatteryADC > uiPreBatteryADC)    {        for (i=BATT_LEVEL_COUNT; i>0; i--)        {            if (uiCurBatteryADC > pBattAdcLevelValue[i-1])            {                uiCurBatteryLvl = i;                isMatch = TRUE;                break;            }        }        if (isMatch != TRUE)        {            uiCurBatteryLvl = 0;        }    }    // Falling    else    {        for (i=BATT_LEVEL_COUNT; i>0; i--)        {            if (uiCurBatteryADC > pBattAdcLevelValue[i-1])            {                uiCurBatteryLvl = i;                isMatch = TRUE;                break;            }        }        if (isMatch != TRUE)        {            uiCurBatteryLvl = 0;        }    }    // Debounce    if ((uiCurBatteryLvl == uiPreBatteryLvl) ||            (uiPreBatteryLvl == DRVPWR_BATTERY_LVL_UNKNOWN))    {        uiRetBatteryLvl = uiCurBatteryLvl;    }    uiPreBatteryLvl = uiCurBatteryLvl;    uiPreBatteryADC = uiCurBatteryADC;    if(uiCount % 2 == 0)    {        uiRetBatteryLvl = uiPreBatteryLvl;    }    uiCount++;    //    if(uiEmptycount|| uiRetBatteryLvl == DRVPWR_BATTERY_LVL_0)    {        uiEmptycount++;        if (uiEmptycount >= 15)        {            return DRVPWR_BATTERY_LVL_EMPTY;        }    }//.........这里部分代码省略.........
开发者ID:magic-gjh,项目名称:NT96650_K12,代码行数:101,


示例28: main

intmain(int argc, char **argv){	options_type	tOptions;	const char	*szWordfile;	int	iFirst, iIndex, iGoodCount;	BOOL	bUsage, bMultiple, bUseTXT, bUseXML;	if (argc <= 0) {		return EXIT_FAILURE;	}	szTask = szBasename(argv[0]);	if (argc <= 1) {		iFirst = 1;		bUsage = TRUE;	} else {		iFirst = iReadOptions(argc, argv);		bUsage = iFirst <= 0;	}	if (bUsage) {		vUsage();		return iFirst < 0 ? EXIT_FAILURE : EXIT_SUCCESS;	}#if defined(N_PLAT_NLM) && !defined(_VA_LIST)	nwinit();#endif /* N_PLAT_NLM && !_VA_LIST */	vGetOptions(&tOptions);#if !defined(__dos)	if (is_locale_utf8()) {#if defined(__STDC_ISO_10646__)		/*		 * If the user wants UTF-8 and the envirionment variables		 * support UTF-8, than set the locale accordingly		 */		if (tOptions.eEncoding == encoding_utf_8) {			if (setlocale(LC_CTYPE, "") == NULL) {				werr(1, "Can't set the UTF-8 locale! "					"Check LANG, LC_CTYPE, LC_ALL.");			}			DBG_MSG("The UTF-8 locale has been set");		} else {			(void)setlocale(LC_CTYPE, "C");		}#endif /* __STDC_ISO_10646__ */	} else {		if (setlocale(LC_CTYPE, "") == NULL) {			werr(0, "Can't set the locale! Will use defaults");			(void)setlocale(LC_CTYPE, "C");		}		DBG_MSG("The locale has been set");	}#endif /* !__dos */	bMultiple = argc - iFirst > 1;	bUseTXT = tOptions.eConversionType == conversion_text ||		tOptions.eConversionType == conversion_fmt_text;	bUseXML = tOptions.eConversionType == conversion_xml;	iGoodCount = 0;#if defined(__dos)	if (tOptions.eConversionType == conversion_pdf) {		/* PDF must be written as a binary stream */		setmode(fileno(stdout), O_BINARY);	}#endif /* __dos */	if (bUseXML) {		fprintf(stdout,	"<?xml version=/"1.0/" encoding=/"utf-8/"?>/n"	"<!DOCTYPE %s PUBLIC /"-//OASIS//DTD DocBook XML V4.1.2//EN/"/n"	"/t/"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd/">/n",		bMultiple ? "set" : "book");		if (bMultiple) {			fprintf(stdout, "<set>/n");		}	}	for (iIndex = iFirst; iIndex < argc; iIndex++) {		if (bMultiple && bUseTXT) {			szWordfile = szBasename(argv[iIndex]);			fprintf(stdout, "::::::::::::::/n");			fprintf(stdout, "%s/n", szWordfile);			fprintf(stdout, "::::::::::::::/n");		}		if (bProcessFile(argv[iIndex])) {			iGoodCount++;		}	}	if (bMultiple && bUseXML) {		fprintf(stdout, "</set>/n");	}	DBG_DEC(iGoodCount);	return iGoodCount <= 0 ? EXIT_FAILURE : EXIT_SUCCESS;//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:101,



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


C++ DBG_PRINT函数代码示例
C++ DBG_LOG函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。